ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 06 Nov 2013 10:48:08 +0100strange way to simplify square rootshttps://ask.sagemath.org/question/9534/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?
Wed, 14 Nov 2012 13:48:49 +0100https://ask.sagemath.org/question/9534/strange-way-to-simplify-square-roots/Answer by kcrisman for <p>Hi!</p>
<p>Let us consider the number</p>
<blockquote>
<p>a=1/sqrt(4-2*sqrt(3))-1/(sqrt(3)-1)</p>
</blockquote>
<p>which is zero. If we simplify</p>
<blockquote>
<p>a.simplify_full().n()</p>
</blockquote>
<p>we obtain</p>
<p>-2.73205080756888 - 8.36449319149292e-17*I,</p>
<p>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?</p>
https://ask.sagemath.org/question/9534/strange-way-to-simplify-square-roots/?answer=14269#post-id-14269 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](http://trac.sagemath.org/sage_trac/ticket/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
Wed, 14 Nov 2012 14:16:51 +0100https://ask.sagemath.org/question/9534/strange-way-to-simplify-square-roots/?answer=14269#post-id-14269Answer by kcrisman for <p>Hi!</p>
<p>Let us consider the number</p>
<blockquote>
<p>a=1/sqrt(4-2*sqrt(3))-1/(sqrt(3)-1)</p>
</blockquote>
<p>which is zero. If we simplify</p>
<blockquote>
<p>a.simplify_full().n()</p>
</blockquote>
<p>we obtain</p>
<p>-2.73205080756888 - 8.36449319149292e-17*I,</p>
<p>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?</p>
https://ask.sagemath.org/question/9534/strange-way-to-simplify-square-roots/?answer=15667#post-id-15667Update: 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
Wed, 06 Nov 2013 10:48:08 +0100https://ask.sagemath.org/question/9534/strange-way-to-simplify-square-roots/?answer=15667#post-id-15667