ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 16 Aug 2020 17:35:37 -0500Why can't I solve a simple root equation?https://ask.sagemath.org/question/53056/why-cant-i-solve-a-simple-root-equation/ I can do this simple root equation by hand rather quickly for x=3/2. but Sage just throws the equality back at me.
Of course I don't need it for simple algebra, but I'm wondering what makes it choke, and what that means for more complex solutions.
var('x')
solve((x-1)^.5-(2*x-3)^.5-(3*x-4)^.5==0,x)
ans:
[sqrt(x - 1) == sqrt(3*x - 4) + sqrt(2*x - 3)]
Sun, 16 Aug 2020 02:15:50 -0500https://ask.sagemath.org/question/53056/why-cant-i-solve-a-simple-root-equation/Answer by rburing for <pre><code>I can do this simple root equation by hand rather quickly for x=3/2. but Sage just throws the equality back at me.
Of course I don't need it for simple algebra, but I'm wondering what makes it choke, and what that means for more complex solutions.
var('x')
solve((x-1)^.5-(2*x-3)^.5-(3*x-4)^.5==0,x)
ans:
[sqrt(x - 1) == sqrt(3*x - 4) + sqrt(2*x - 3)]
</code></pre>
https://ask.sagemath.org/question/53056/why-cant-i-solve-a-simple-root-equation/?answer=53060#post-id-53060I don't know what's hard about it (can't answer that part), but you can use some of the [options](https://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/relation.html#sage.symbolic.relation.solve) that `solve` offers:
sage: solve((x-1)^.5-(2*x-3)^.5-(3*x-4)^.5==0,x,to_poly_solve=True)
[x == (3/2)]
sage: solve((x-1)^(1/2)-(2*x-3)^(1/2)-(3*x-4)^(1/2)==0,x,algorithm='sympy') # note the 1/2
[x == (3/2)]Sun, 16 Aug 2020 04:18:19 -0500https://ask.sagemath.org/question/53056/why-cant-i-solve-a-simple-root-equation/?answer=53060#post-id-53060Comment by Emmanuel Charpentier for <p>I don't know what's hard about it (can't answer that part), but you can use some of the <a href="https://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/relation.html#sage.symbolic.relation.solve">options</a> that <code>solve</code> offers:</p>
<pre><code>sage: solve((x-1)^.5-(2*x-3)^.5-(3*x-4)^.5==0,x,to_poly_solve=True)
[x == (3/2)]
sage: solve((x-1)^(1/2)-(2*x-3)^(1/2)-(3*x-4)^(1/2)==0,x,algorithm='sympy') # note the 1/2
[x == (3/2)]
</code></pre>
https://ask.sagemath.org/question/53056/why-cant-i-solve-a-simple-root-equation/?comment=53077#post-id-53077Also:
sage: solve(sqrt(x-1)-sqrt(2*x-3)-sqrt(3*x-4),x,to_poly_solve=True)
[x == (3/2)]
Noten: when using symbolic-oriented math software, it is usually a deep error to use numerical approximations (0.5) when exact value (1/2) are available...
Similarly, replacing x^(1/2) by sqrt(x) (same number of characters to type) is more readable and may helpthe software.Sun, 16 Aug 2020 17:35:37 -0500https://ask.sagemath.org/question/53056/why-cant-i-solve-a-simple-root-equation/?comment=53077#post-id-53077Answer by Alex89 for <pre><code>I can do this simple root equation by hand rather quickly for x=3/2. but Sage just throws the equality back at me.
Of course I don't need it for simple algebra, but I'm wondering what makes it choke, and what that means for more complex solutions.
var('x')
solve((x-1)^.5-(2*x-3)^.5-(3*x-4)^.5==0,x)
ans:
[sqrt(x - 1) == sqrt(3*x - 4) + sqrt(2*x - 3)]
</code></pre>
https://ask.sagemath.org/question/53056/why-cant-i-solve-a-simple-root-equation/?answer=53063#post-id-53063Replacing 0.5 = 1/2 seems to work:
sage: var('x')
sage: solve((x-1)^1/2-(2*x-3)^1/2-(3*x-4)^1/2==0,x)
[x == (3/2)]
If you write the equation into a function you get two different functions for some reason, so I don't really know what the problem is. Maybe the devs can help us here.
sage: f(x)=(x-1)^1/2-(2*x-3)^1/2-(3*x-4)^1/2
sage: g(x)=(x-1)^.5-(2*x-3)^.5-(3*x-4)^.5
sage: plot(f(x),(x,-4,4)) + plot(g(x), (x,-4,4), color='red')
Sun, 16 Aug 2020 06:07:58 -0500https://ask.sagemath.org/question/53056/why-cant-i-solve-a-simple-root-equation/?answer=53063#post-id-53063