留言板
😄海内存知己,天涯若比邻。😊
欢迎来到cherub的博客留言板,你有什么想说的话可以在下面留言哦!💬
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
import numpy as np import matplotlib.pyplot as plt
def heart_function(x, y): return (x**2 + y**2 - 1)**3 - x**2 * y**3
x = np.linspace(-2, 2, 1000) y = np.linspace(-2, 2, 1000)
X, Y = np.meshgrid(x, y)
Z = heart_function(X, Y)
plt.contour(X, Y, Z, levels=[0]) plt.xlabel('x') plt.ylabel('y') plt.title('Heart Function in Cartesian Coordinates') plt.show()
|