Robert Bradshaw wrote:
> I've actually been working on a patch for coercion that will allow  
> number fields to come with specified embeddings, in which case we  
> will let I be in QQ[sqrt(-1)] (or even perhaps ZZ[sqrt(-1)]), but  
> with a specified embedding into CC (and by extension SR) so that  
> stuff like I + sqrt(2) works as expected, but (1-I)/(1+I) simplifies  
> automatically (and fast).


How will this work with cwitty's AA and QQbar classes?  If I understand 
things correctly, this is the sort of things that his classes handle 
pretty nicely.


Also, note that Carl's QQbar class can provide an answer to the original 
question:


sage: i=QQbar(I)
sage: 1/(1+i)
-1/2*I + 1/2
sage: (1-i)/(1+i)
-1*I
sage: sqrt(2)*i
1.414213562373095?*I

This last number is actually sqrt(2), it just prints it out as a 
floating point approximation.  Behind the scenes, Sage knows that it is 
sqrt(2):

sage: a=sqrt(2)*i
sage: a
1.414213562373095?*I
sage: a.minpoly()
x^2 + 2

This says that the number is a root of x^2+2 (i.e., in this case, 
sqrt(2)*I).


Maybe QQbar could be enhanced to print out square roots exactly if it 
knows that it has a square root (without doing any extra calculations). 
  It may not always recognize that it has an exact square root after a 
long calculation, but it would probably work fine for most cases.

Thanks,

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to