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.Mon, 12 Sep 2016 21:22:16 -0500won't evaluate answers given by solve()http://ask.sagemath.org/question/34805/wont-evaluate-answers-given-by-solve/I am solving an equation and then trying to plug in the answers it gives to show that the answers are correct, but sage will not evaluate the answers i plug in.
solve(x^3+1==0,x)
yields
[x == 1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3),
x == -1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3),
x == (-1)^(1/3)]
if you then put into sage `(1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3))^3+1`
the result it gives is `(1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3))^3 + 1`. it's like it doesn't know what to do with it's own answers.Mon, 12 Sep 2016 15:40:58 -0500http://ask.sagemath.org/question/34805/wont-evaluate-answers-given-by-solve/Comment by tmonteil for <p>I am solving an equation and then trying to plug in the answers it gives to show that the answers are correct, but sage will not evaluate the answers i plug in.</p>
<pre><code>solve(x^3+1==0,x)
</code></pre>
<p>yields</p>
<pre><code>[x == 1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3),
x == -1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3),
x == (-1)^(1/3)]
</code></pre>
<p>if you then put into sage <code>(1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3))^3+1</code>
the result it gives is <code>(1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3))^3 + 1</code>. it's like it doesn't know what to do with it's own answers.</p>
http://ask.sagemath.org/question/34805/wont-evaluate-answers-given-by-solve/?comment=34806#post-id-34806What result would you expect ?Mon, 12 Sep 2016 15:44:58 -0500http://ask.sagemath.org/question/34805/wont-evaluate-answers-given-by-solve/?comment=34806#post-id-34806Answer by calc314 for <p>I am solving an equation and then trying to plug in the answers it gives to show that the answers are correct, but sage will not evaluate the answers i plug in.</p>
<pre><code>solve(x^3+1==0,x)
</code></pre>
<p>yields</p>
<pre><code>[x == 1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3),
x == -1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3),
x == (-1)^(1/3)]
</code></pre>
<p>if you then put into sage <code>(1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3))^3+1</code>
the result it gives is <code>(1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3))^3 + 1</code>. it's like it doesn't know what to do with it's own answers.</p>
http://ask.sagemath.org/question/34805/wont-evaluate-answers-given-by-solve/?answer=34809#post-id-34809You will need to ask it to simplify.
soln=solve(x^3+1==0,x)
soln
f(x) = x^3+1
for s in soln:
f(s.rhs()).simplify_full()Mon, 12 Sep 2016 21:22:16 -0500http://ask.sagemath.org/question/34805/wont-evaluate-answers-given-by-solve/?answer=34809#post-id-34809