How to build 2 variables on a plane

Let's say I have an equation:

x**2 + y**2 - 4 = 0 

How can I see a circle using sympy, matplotplib or another python solution?

I know in sympy, I can

 from sympy import Plot from sympy import Symbol x = Symbol('x') y = Symbol('y') Plot(x**2 + y**2 - 4) 

But then I get z = x**2 + y**2 - 4 , a 3D graph instead of a planar intersection. I understand that it may be necessary to solve the equation.

+1
python matplotlib sympy
source share
1 answer

Yes KillianDS, now I understand that this is a duplicate. Is it possible to build implicit equations using Matplotlib?

Although I still do not know how to do it in sympathy. The answer to matplotlib would be as follows:

 import matplotlib.pyplot from numpy import arange from numpy import meshgrid delta = 0.025 xrange = arange(-3.0, 3.0, delta) yrange = arange(-2.0, 2.0, delta) X, Y = meshgrid(xrange,yrange) F = X**2 + Y**2 -4 G = 0 matplotlib.pyplot.contour(X,Y,(FG),[0]) matplotlib.pyplot.show() 

I still have problems, but I will post it with another question.

0
source share

All Articles