2022考研笔记-数学(python实现-参数法下的各种图形)

134 阅读1分钟

1.参数法下的各种图形

import numpy as np 
import matplotlib.pyplot as plt

#摆线
a = 1
#theta = np.arange(0, 4 * np.pi, np.pi / 180)
theta = np.linspace(0, 2*np.pi, 1000)
x = a * (theta - np.sin(theta))
y = a * (1 - np.cos(theta))
plt.plot(x, y, label = r'$ x=a(\theta-sin\theta),\quad y=a(1-cos\theta) \quad|a=1$')
plt.show()

#心形线
a = 1
theta = np.arange(0, 2 * np.pi, np.pi / 180)
x = a * np.cos(theta) ** 3
y = a * np.sin(theta) ** 3
plt.plot(x, y, label = r'$ x=acos^3\theta, y=asin^3\theta \quad|a=1$')
plt.show()

画出二个图形如下:
在这里插入图片描述
在这里插入图片描述