ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 11 Aug 2018 15:52:32 -0500How to simplify complicated expressionshttp://ask.sagemath.org/question/43321/how-to-simplify-complicated-expressions/Hello,
This complicated expression would be a zero function, but I can't achive to simplify it. I think I've run into lots of expressions like this one, but I've never come up with a solution.
This is mi code:
var('R d',domain='positive')
var('p',domain='real')
var('t',domain='real',latex_name="\\theta")
f=(R*cos(t) - d)*p/(-2*R*d*cos(t) + R^2 + d^2)^(3/2) + (R*cos(t) -R^2/d)*R^3*p/((-2*R^3*cos(t)/d + R^2 + R^4/d^2)^(3/2)*d^3) +R*p/(sqrt(-2*R^3*cos(t)/d + R^2 + R^4/d^2)*d^2Fri, 10 Aug 2018 16:38:52 -0500http://ask.sagemath.org/question/43321/how-to-simplify-complicated-expressions/Comment by slelievre for <p>Hello, </p>
<p>This complicated expression would be a zero function, but I can't achive to simplify it. I think I've run into lots of expressions like this one, but I've never come up with a solution.</p>
<p>This is mi code:</p>
<pre><code>var('R d',domain='positive')
var('p',domain='real')
var('t',domain='real',latex_name="\\theta")
f=(R*cos(t) - d)*p/(-2*R*d*cos(t) + R^2 + d^2)^(3/2) + (R*cos(t) -R^2/d)*R^3*p/((-2*R^3*cos(t)/d + R^2 + R^4/d^2)^(3/2)*d^3) +R*p/(sqrt(-2*R^3*cos(t)/d + R^2 + R^4/d^2)*d^2
</code></pre>
http://ask.sagemath.org/question/43321/how-to-simplify-complicated-expressions/?comment=43346#post-id-43346Thanks for your edits. Your question is much easier to read and to work on now.Sat, 11 Aug 2018 15:52:32 -0500http://ask.sagemath.org/question/43321/how-to-simplify-complicated-expressions/?comment=43346#post-id-43346Answer by slelievre for <p>Hello, </p>
<p>This complicated expression would be a zero function, but I can't achive to simplify it. I think I've run into lots of expressions like this one, but I've never come up with a solution.</p>
<p>This is mi code:</p>
<pre><code>var('R d',domain='positive')
var('p',domain='real')
var('t',domain='real',latex_name="\\theta")
f=(R*cos(t) - d)*p/(-2*R*d*cos(t) + R^2 + d^2)^(3/2) + (R*cos(t) -R^2/d)*R^3*p/((-2*R^3*cos(t)/d + R^2 + R^4/d^2)^(3/2)*d^3) +R*p/(sqrt(-2*R^3*cos(t)/d + R^2 + R^4/d^2)*d^2
</code></pre>
http://ask.sagemath.org/question/43321/how-to-simplify-complicated-expressions/?answer=43329#post-id-43329For simplifying expressions involving square roots,
it often helps to use the `canonicalize_radical` method.
In your case:
sage: f.canonicalize_radical()
0
Sat, 11 Aug 2018 03:30:56 -0500http://ask.sagemath.org/question/43321/how-to-simplify-complicated-expressions/?answer=43329#post-id-43329Comment by macavema for <p>For simplifying expressions involving square roots,
it often helps to use the <code>canonicalize_radical</code> method.</p>
<p>In your case:</p>
<pre><code>sage: f.canonicalize_radical()
0
</code></pre>
http://ask.sagemath.org/question/43321/how-to-simplify-complicated-expressions/?comment=43331#post-id-43331Problem solved, thank you very much !Sat, 11 Aug 2018 05:32:52 -0500http://ask.sagemath.org/question/43321/how-to-simplify-complicated-expressions/?comment=43331#post-id-43331