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.Wed, 26 Jun 2013 13:30:46 +0200solving radical equations with parametershttps://ask.sagemath.org/question/10277/solving-radical-equations-with-parameters/I would like to find the solutions $y$ to this type of equations: $$\left(1+x -\sqrt{(1+x)^2-4y}\right)^2=z$$
with conditions on $x,y,z$ (like $0\lt y\lt x\leq \frac18$ and $0\lt z\lt x^2$).
Using `solve` with the option `to_poly_solve`:
sage: solve((1+x - sqrt((1+x)^2-4*y))^2 == z, y, to_poly_solve=True)
[y == 1/2*x^2 - 1/2*(x + 1)*sqrt(x^2 + 2*x - 4*y + 1) + x - 1/4*z + 1/2]
does not seem to work because $y$ appears on the right side of the solution. I expect to find a solution like
$$y=\frac14\left((1+x)^2-\left(1+x-\sqrt{z}\right)^2\right).$$
I also tried the same after specifying the conditions with `assume()`, without success.Tue, 25 Jun 2013 10:00:31 +0200https://ask.sagemath.org/question/10277/solving-radical-equations-with-parameters/Answer by ndomes for <p>I would like to find the solutions $y$ to this type of equations: $$\left(1+x -\sqrt{(1+x)^2-4y}\right)^2=z$$
with conditions on $x,y,z$ (like $0\lt y\lt x\leq \frac18$ and $0\lt z\lt x^2$).</p>
<p>Using <code>solve</code> with the option <code>to_poly_solve</code>:</p>
<pre><code>sage: solve((1+x - sqrt((1+x)^2-4*y))^2 == z, y, to_poly_solve=True)
[y == 1/2*x^2 - 1/2*(x + 1)*sqrt(x^2 + 2*x - 4*y + 1) + x - 1/4*z + 1/2]
</code></pre>
<p>does not seem to work because $y$ appears on the right side of the solution. I expect to find a solution like
$$y=\frac14\left((1+x)^2-\left(1+x-\sqrt{z}\right)^2\right).$$</p>
<p>I also tried the same after specifying the conditions with <code>assume()</code>, without success.</p>
https://ask.sagemath.org/question/10277/solving-radical-equations-with-parameters/?answer=15143#post-id-15143I tinkered with your equation and finally had something that looks like a solution.
But this is not the way I expect solving equations with sage.
var('x y z')
expr = (1+x - sqrt((1+x)^2-4*y))^2
eqn1 = expr.expand().simplify_full() == z
show(eqn1)
eqn2 = eqn1.subtract_from_both_sides(2*x^2 +4*x -4*y +2)
eqn3 = eqn2.lhs()^2 == eqn2.rhs()^2
show(eqn3)
eqn4 = eqn3.expand()
eqn5 = eqn4.subtract_from_both_sides(eqn4.lhs())
show(eqn5)
sol = solve(eqn5,y)
for s in sol: show(s)
Wed, 26 Jun 2013 13:30:46 +0200https://ask.sagemath.org/question/10277/solving-radical-equations-with-parameters/?answer=15143#post-id-15143