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.Tue, 23 Jul 2013 13:56:51 +0200Get Sage to display the 2nd x value, when function is set to 0?https://ask.sagemath.org/question/10232/get-sage-to-display-the-2nd-x-value-when-function-is-set-to-0/I did the following and only got 3/2 as an answer, instead of getting 3/2 & 8, as an answer:
ans=solve(2*x^2-19*x+24==0,x)
x0=ans[0].rhs()
show(x0)
Doing, factor(2*x^2-19*x+24), displays, (x - 8)*(2*x - 3).
Tue, 23 Jul 2013 13:43:59 +0200https://ask.sagemath.org/question/10232/get-sage-to-display-the-2nd-x-value-when-function-is-set-to-0/Answer by calc314 for <p>I did the following and only got 3/2 as an answer, instead of getting 3/2 & 8, as an answer:</p>
<pre><code>ans=solve(2*x^2-19*x+24==0,x)
x0=ans[0].rhs()
show(x0)
</code></pre>
<p>Doing, factor(2<em>x^2-19</em>x+24), displays, (x - 8)<em>(2</em>x - 3).</p>
https://ask.sagemath.org/question/10232/get-sage-to-display-the-2nd-x-value-when-function-is-set-to-0/?answer=15269#post-id-15269If you `print ans`, you will see that the result of `solve` is:
[x == (3/2),x == 8]
When you do `ans[0].rhs()`, you are grabbing the right hand side of the first statement. To get the second one, do `ans[1].rhs()`.Tue, 23 Jul 2013 13:56:51 +0200https://ask.sagemath.org/question/10232/get-sage-to-display-the-2nd-x-value-when-function-is-set-to-0/?answer=15269#post-id-15269