더북(TheBook)

In [33]:

fig, axes = plt.subplots(2, 2)
fig.tight_layout()

titles = ["$y=c_0$", "$y=c_1x+c_0$", "$y=c_2x^2+c_1x+c_0$", "$y=c_3x^3+c_2x^2+c_1x+c_0$"]

xs = np.linspace(-10, 10, 100)
for power, (ax, title) in enumerate(zip(axes.flat, titles), 1):
    coeffs = np.random.uniform(-5, 5, power)
    poly = np.poly1d(coeffs)
    ax.plot(xs, poly(xs))
    ax.set_title(title)
신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.