2009/9/2 Jan Groenewald <j...@aims.ac.za> > > Hi William > > On Wed, Sep 02, 2009 at 10:31:01PM -0700, William Stein wrote: > > Is this the intended behaviour? > > > > sage: z=1.+sqrt(-1); print z; z.base_ring() > > 1.00000000000000 + 1.00000000000000*I > > Symbolic Ring > > sage: z=1.+sqrt(-1.); print z; z.base_ring() > > 1.00000000000000 + 1.00000000000000*I > > Real Field with 53 bits of precision > > note the sqrt(-1) versus sqrt(-1.) > > > > Yes, this is definitely the intended behavior. Why do you think > either > > one is wrong? > > Uhm, I have asked the originator to join the thread. > > The first one, I is not a symbolic variable, it is sqrt(-1). > I am not sure what something like "integers with I adjoined" is? >
If you take any integer (or rational) alpha such that alpha is not a perfect square, and try to compute sqrt(alpha), Sage promotes alpha to the symbolic ring (SR) and takes the square root there. Thus the first is correct, since sqrt(-1) is not in ZZ, so the square root is instead taken in the symbolic ring, which yields I. In the second case, the expression z=1.+sqrt(-1.) is in the complex real field with 53 bits precision. The *base ring* of that field is the real field with 53 bits precision. Maybe you were instead thinking about the parent of z? William > > The second is not a real field, it is the complex field? > > regards, > Jan > > -- > .~. > /V\ Jan Groenewald > /( )\ www.aims.ac.za > ^^-^^ > > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---