Thank you for this explanation.

Now the problem has gotten a bit worse. I thought that AA(x) - AA(x)
== 0 always returned True, which is what was really mattered for my
needs. But now:

sage: b = 1/6*sqrt(3*(1/18*sqrt(3)*sqrt(283) + 1/2)^(2/3) - 4)*sqrt(3)/
(1/18*sqrt(3)*sqrt(283) + 1/2)^(1/6) + 1/6*sqrt(-
(3*(1/18*sqrt(3)*sqrt(283) + 1/2)^(2/3) - 4)^(3/2) +
6*sqrt(1/18*sqrt(3)*sqrt(283) + 1/2)*sqrt(3))*sqrt(3)/
((3*(1/18*sqrt(3)*sqrt(283) + 1/2)^(2/3) -
4)^(1/4)*(1/18*sqrt(3)*sqrt(283) + 1/2)^(1/6))
sage: AA(b) - AA(b)
0.?e-17
sage: AA(b) - AA(b) == 0
...
sage: AA(b) == AA(b)
...

These last two instruction eat all my CPU and never ends (I have to
ctrl+c them). However, this works fine:

sage: AA(b) == 0
False

Is there any way I can fix this problem?
[For the curious, b is the positive real root of the polynomial x^4 -
x - 1.]


On 22 mar, 19:27, Robert Bradshaw <[email protected]>
wrote:
> 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