Reputation: 61
I've been trying to get the x & y values from a "solve list". So I have this code where I solve for x and y from a eq:
from sympy import *
x,y = symbols('x,y')
eq = -2*x**2 + 4*x - y**2 - 2*y
pdx = diff(eq, x)
pdy = diff(eq, y)
result = solve((Eq(pdx, 0), Eq(pdy, 0)), x, y)
print(result)
And the output is:
{x: 1, y: -1}
I would like to assign the output x and y values to a new x0 and y0, but I don't know how.
I have been trying somthing like:
x0 = tuple(result)[0]
but then it makes x0 to x and not 1!
Upvotes: 0
Views: 73