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, optional
如果 True,则将前导系数缩放为 1。默认为 False。
- 返回:
- Lorthopoly1d
拉盖尔多项式。
参见
genlaguerre
广义(关联)拉盖尔多项式。
注释
多项式 \(L_n\) 在 \([0, \infty)\) 上正交,权重函数为 \(e^{-x}\)。
参考文献
[AS]Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: 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()