I got a equation: f = x**3 2*x*y y**2 - 9
, I just want direct plot it in x,y plane. But now what I'm doing is first solve(f)
, then plot the solutions one by one like the graph below, I want to know if is there a way to direct plot a curve from such an equation.
CodePudding user response:
You can use plot_implicit
:
from sympy import symbols, plot_implicit
x, y = symbols('x, y')
f = x**3 2*x*y y**2 - 9
plot_implicit(f, (x, -3, 3), (y, -5, 10))
CodePudding user response:
I believe this is the most compact way to achieve what you want.
plot(*solve(f, y), (x, -3, 3))