# strange way to simplify square roots

Hi!

Let us consider the number

a=1/sqrt(4-2*sqrt(3))-1/(sqrt(3)-1)

which is zero. If we simplify

a.simplify_full().n()

we obtain

-2.73205080756888 - 8.36449319149292e-17*I,

which of course is false. I guess it is a problem handling complex roots of degree four, but still, it don't seems to me a reasonable computation. ¿Anybody knows how to fix it?

edit retag close merge delete

Sort by » oldest newest most voted

Update: Trac 12737 has been merged in Sage.

sage: a=1/sqrt(4-2*sqrt(3))-1/(sqrt(3)-1)
sage: a.simplify_full().n()
-4.14340873563388e-16

more
sage: a.simplify_full()
-(sqrt(sqrt(3) - 2)*sqrt(2) + I*sqrt(3) - I)/(sqrt(sqrt(3) - 2)*(sqrt(2)*sqrt(3) - sqrt(2)))


See Trac 12737 for what the problem likely is for this. In my view, this is buyer beware of simplification (!) but at any rate to be fair I will link this question there as well. For now:

sage: a.simplify_trig()
-(sqrt(-2*sqrt(3) + 4) - sqrt(3) + 1)/(sqrt(-2*sqrt(3) + 4)*(sqrt(3) - 1))
sage: a.simplify_trig().n()
-4.14340873563388e-16

more