scipy.special.

laguerre#

scipy.special.laguerre(n, monic=False)[原始碼]#

拉蓋爾多項式。

定義為以下方程式的解

\[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()
../../_images/scipy-special-laguerre-1.png