pythonで二次関数のグラフを描く。三次関数は
\begin{align}
f(x)=ax^3+bx^2+cx+d(a≠0)
\end{align}
のような関数でこれをただ計算すればいい。例えば
\begin{align}
y=x^3+2x^2+4x+3
\end{align}
であれば結果は次のようになる
![](https://sironekolab.com/wp/wp-content/uploads/2022/06/Figure_1-1.png)
以下ソースコード
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-10.0, 10.0, 0.02)
plt.plot(x, x**3 + 2 * x ** 2 + 4 * x + 3, 'k-')
plt.grid()
plt.show()
![](https://m.media-amazon.com/images/I/512KR5MxspL._SL160_.jpg)
![](https://sironekolab.com/wp/wp-content/plugins/yyi-rinker/img/arrow-right.png)
コメント