2-3

陈元元發表於2024-10-08

import numpy as np
import matplotlib.pyplot as plt
k_values = [1, 2, 3, 4, 5, 6]
x = np.linspace(-10, 10, 100)
for k in k_values:
y = k * x ** 2 + 2 * k
label = f'k={k}'
plt.plot(x, y, label=label)
plt.xlabel('x')
plt.ylabel('y')
plt.legend()
plt.grid(True)
plt.show()

相關文章