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.Sun, 23 Oct 2016 22:16:21 +0200Simplify an expression of square rootshttps://ask.sagemath.org/question/35236/simplify-an-expression-of-square-roots/ Sage's .simplify() command is unable to simplify the expression $\sqrt{2} \cdot \sqrt{3} \cdot \sqrt{6}$: the output of both
(sqrt(6) * sqrt(3) * sqrt(2)).simplify()
and
(sqrt(6) * sqrt(3) * sqrt(2)).simplify_full()
is just sqrt(6)*sqrt(3)*sqrt(2) again.
Notably, (sqrt(6)*sqrt(3)*sqrt(2)).is_integer() also returns false.
Is there a more powerful version of the simplify command that won't get overwhelmed by an expression like this?
Sun, 23 Oct 2016 20:31:31 +0200https://ask.sagemath.org/question/35236/simplify-an-expression-of-square-roots/Answer by tmonteil for <p>Sage's .simplify() command is unable to simplify the expression $\sqrt{2} \cdot \sqrt{3} \cdot \sqrt{6}$: the output of both</p>
<p>(sqrt(6) * sqrt(3) * sqrt(2)).simplify()</p>
<p>and</p>
<p>(sqrt(6) * sqrt(3) * sqrt(2)).simplify_full()</p>
<p>is just sqrt(6)<em>sqrt(3)</em>sqrt(2) again.</p>
<p>Notably, (sqrt(6)<em>sqrt(3)</em>sqrt(2)).is_integer() also returns false.</p>
<p>Is there a more powerful version of the simplify command that won't get overwhelmed by an expression like this?</p>
https://ask.sagemath.org/question/35236/simplify-an-expression-of-square-roots/?answer=35238#post-id-35238You can do:
sage: a = sqrt(6) * sqrt(3) * sqrt(2)
sage: a.canonicalize_radical()
6
`canonicalize_radical` is not parrt of the `full_simplify` method, IIRC because of some monodromy issues (winding around singularities in the complex plane does not commute with chosing a single branch of a multi-valued function), `canonicalize_radical` is not parrt of the `full_simplify` method anymore.
Here, since everything is assumed to be real, there is no real issue.Sun, 23 Oct 2016 21:08:02 +0200https://ask.sagemath.org/question/35236/simplify-an-expression-of-square-roots/?answer=35238#post-id-35238Comment by user101214 for <p>You can do:</p>
<pre><code>sage: a = sqrt(6) * sqrt(3) * sqrt(2)
sage: a.canonicalize_radical()
6
</code></pre>
<p><code>canonicalize_radical</code> is not parrt of the <code>full_simplify</code> method, IIRC because of some monodromy issues (winding around singularities in the complex plane does not commute with chosing a single branch of a multi-valued function), <code>canonicalize_radical</code> is not parrt of the <code>full_simplify</code> method anymore.</p>
<p>Here, since everything is assumed to be real, there is no real issue.</p>
https://ask.sagemath.org/question/35236/simplify-an-expression-of-square-roots/?comment=35241#post-id-35241That's exactly what I need, thanks!Sun, 23 Oct 2016 22:16:21 +0200https://ask.sagemath.org/question/35236/simplify-an-expression-of-square-roots/?comment=35241#post-id-35241