I have an equation,
(1 - y)/y^4 = x^2
and I need to plot y(x). I have solved it using this snippet:
from sympy import symbols, Eq, solve
x, y = symbols('x y')
equation = Eq((y-1)*y**(-4), x**2)
solution = solve(equation, y)
print(solution)
And I get this monolith of an output:
[Piecewise((-sqrt(-(-1/x**4)**(1/3))/2 - sqrt((-1/x**4)**(1/3) - 2/(x**2*sqrt(-(-1/x**4)**(1/3))))/2, Eq(x**(-2), 0)), (-sqrt(2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))/2 - sqrt(-2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) - 2/(x**2*sqrt(2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))) - 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))/2, True)), Piecewise((-sqrt(-(-1/x**4)**(1/3))/2 + sqrt((-1/x**4)**(1/3) - 2/(x**2*sqrt(-(-1/x**4)**(1/3))))/2, Eq(x**(-2), 0)), (-sqrt(2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))/2 + sqrt(-2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) - 2/(x**2*sqrt(2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))) - 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))/2, True)), Piecewise((sqrt(-(-1/x**4)**(1/3))/2 - sqrt((-1/x**4)**(1/3) + 2/(x**2*sqrt(-(-1/x**4)**(1/3))))/2, Eq(x**(-2), 0)), (sqrt(2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))/2 - sqrt(-2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(x**2*sqrt(2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))) - 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))/2, True)), Piecewise((sqrt(-(-1/x**4)**(1/3))/2 + sqrt((-1/x**4)**(1/3) + 2/(x**2*sqrt(-(-1/x**4)**(1/3))))/2, Eq(x**(-2), 0)), (sqrt(2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))/2 + sqrt(-2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(x**2*sqrt(2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3) + 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))) - 2/(3*x**2*(sqrt(-1/(27*x**6) + 1/(256*x**8)) + 1/(16*x**4))**(1/3)))/2, True))]
I would like to plot it over the bounds 0 <= y <= 1
, and 0 <= x <= some_large_number
. I haven't been able to figure out how to do it, but I'm sure it's got to be easy for me, if a PITA for my CPU.
Also, it is of no interest to me to solve this analytically. I would be only too delighted to do it numerically, but I don't know how to do that either. Sympy was just a solution that presented itself to me.