On Mar 22, 2010, at 10:44 AM, Timo wrote:

Hello,


I would like the following commands to return 0 in sage:

sage: AA(1) - AA(1)
0
sage: AA(15/9) - AA(15/9)
0
sage: AA(sqrt(2)) - AA(sqrt(2))
0.?e-18
sage: AA(sqrt(3)) - AA(sqrt(3))
0.?e-18
sage: AA(3^(22/5)) - AA(3^(22/5))
0.?e-16
sage: AA(3^(222/5)) - AA(3^(222/5))
0.?e3
sage: AA(3^(222/54)) - AA(3^(222/54))
0.?e-16

All of these are == 0, it just doesn't do this by default because that may be expensive to do on every operation.


Very strange behaviour occurs (division by zero is *sometimes*
possible!):

sage: AA(0) == 0
True
sage: 1/AA(0)
ValueError: algebraic number division by zero

sage: AA(sqrt(2)) - AA(sqrt(2)) == 0
True
sage: 1/(AA(sqrt(2)) - AA(sqrt(2)))
[-infinity .. +infinity]


Is this normal behaviour of the "Algebraic Real Field" object?

Yes. It is lazy in computing exact algebraic values in these cases. (I might be in favor of exactifying division for possibly zero values.)

- Robert


--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

To unsubscribe from this group, send email to sage-support+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.

Reply via email to