Tuesday, May 24, 2022

Plotting implicit function via matplotlib Python

 Например   x^2+(5y/4-sqrt[|x|])^2=1  

(.env) boris@boris-All-Series:~/PYQT5WG$ cat plotImplicitFunct1.py

import matplotlib.pyplot as plt

import numpy as np

delta = 0.025

xrange = np.arange(-2, 2, delta)

yrange = np.arange(-2, 2, delta)

X, Y = np.meshgrid(xrange,yrange)

# F is one side of the equation, G is the other

F = X**2

G = 1- (5*Y/4 - np.sqrt(np.abs(X)))**2

plt.contour((F - G), [0])

plt.show()































No comments:

Post a Comment