scipy.special.
genlaguerre#
- scipy.special.genlaguerre(n, alpha, monic=False)[source]#
廣義(結合)拉蓋爾多項式。
定義為以下方程式的解
\[x\frac{d^2}{dx^2}L_n^{(\alpha)} + (\alpha + 1 - x)\frac{d}{dx}L_n^{(\alpha)} + nL_n^{(\alpha)} = 0,\]where \(\alpha > -1\); \(L_n^{(\alpha)}\) is a polynomial of degree \(n\).
- 參數:
- n整數
多項式的次數。
- alpha浮點數
參數,必須大於 -1。
- monic布林值,選用
若為 True,則將前導係數縮放為 1。預設值為 False。
- 回傳值:
- Lorthopoly1d
廣義拉蓋爾多項式。
註解
對於固定的 \(\alpha\),多項式 \(L_n^{(\alpha)}\) 在 \([0, \infty)\) 區間內,以權重函數 \(e^{-x}x^\alpha\) 正交。
拉蓋爾多項式是 \(\alpha = 0\) 的特例。
參考文獻
[AS]Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.
範例
廣義拉蓋爾多項式與合流超幾何函數 \({}_1F_1\) 密切相關
\[L_n^{(\alpha)} = \binom{n + \alpha}{n} {}_1F_1(-n, \alpha +1, x)\]例如,對於區間 \([-1, 1]\) 上的 \(n = \alpha = 3\),可以驗證這一點
>>> import numpy as np >>> from scipy.special import binom >>> from scipy.special import genlaguerre >>> from scipy.special import hyp1f1 >>> x = np.arange(-1.0, 1.0, 0.01) >>> np.allclose(genlaguerre(3, 3)(x), binom(6, 3) * hyp1f1(-3, 4, x)) True
這是廣義拉蓋爾多項式 \(L_3^{(\alpha)}\) 對於某些 \(\alpha\) 值的繪圖
>>> import matplotlib.pyplot as plt >>> x = np.arange(-4.0, 12.0, 0.01) >>> fig, ax = plt.subplots() >>> ax.set_ylim(-5.0, 10.0) >>> ax.set_title(r'Generalized Laguerre polynomials $L_3^{\alpha}$') >>> for alpha in np.arange(0, 5): ... ax.plot(x, genlaguerre(3, alpha)(x), label=rf'$L_3^{(alpha)}$') >>> plt.legend(loc='best') >>> plt.show()