scipy.special.
laguerre#
- scipy.special.laguerre(n, monic=False)[source]#
拉盖尔多项式。
定义为满足以下方程的解:
\[x\frac{d^2}{dx^2}L_n + (1 - x)\frac{d}{dx}L_n + nL_n = 0;\]\(L_n\) 是一个 \(n\) 次多项式。
- 参数:
- nint
多项式的次数。
- monicbool, 可选
如果为 True,则将首项系数缩放为 1。默认值为 False。
- 返回:
- Lorthopoly1d
拉盖尔多项式。
另请参阅
genlaguerre广义(伴随)拉盖尔多项式。
附注
多项式 \(L_n\) 在 \([0, \infty)\) 上关于权重函数 \(e^{-x}\) 正交。
参考文献
[AS]Milton Abramowitz 和 Irene A. Stegun 编. 带有公式、图表和数学表格的数学函数手册。纽约:Dover,1972。
示例
拉盖尔多项式 \(L_n\) 是广义拉盖尔多项式 \(L_n^{(\alpha)}\) 的特例 \(\alpha = 0\)。让我们在区间 \([-1, 1]\) 上验证它
>>> import numpy as np >>> from scipy.special import genlaguerre >>> from scipy.special import laguerre >>> x = np.arange(-1.0, 1.0, 0.01) >>> np.allclose(genlaguerre(3, 0)(x), laguerre(3)(x)) True
多项式 \(L_n\) 也满足递推关系
\[(n + 1)L_{n+1}(x) = (2n +1 -x)L_n(x) - nL_{n-1}(x)\]这可以在 \([0, 1]\) 上为 \(n = 3\) 轻松检查
>>> x = np.arange(0.0, 1.0, 0.01) >>> np.allclose(4 * laguerre(4)(x), ... (7 - x) * laguerre(3)(x) - 3 * laguerre(2)(x)) True
这是前几个拉盖尔多项式 \(L_n\) 的图
>>> import matplotlib.pyplot as plt >>> x = np.arange(-1.0, 5.0, 0.01) >>> fig, ax = plt.subplots() >>> ax.set_ylim(-5.0, 5.0) >>> ax.set_title(r'Laguerre polynomials $L_n$') >>> for n in np.arange(0, 5): ... ax.plot(x, laguerre(n)(x), label=rf'$L_{n}$') >>> plt.legend(loc='best') >>> plt.show()