几种正交多项式
调用 cipy.special 库中的 legendre, chebyt, hermite, genlaguerre, jacobi函数,我们可以轻松实现对应阶数的正交多项式。
Last updated
调用 cipy.special 库中的 legendre, chebyt, hermite, genlaguerre, jacobi函数,我们可以轻松实现对应阶数的正交多项式。
Last updated
有三项递推关系:
# 计算前 5 阶 Legendre 多项式
P = [legendre(n) for n in range(5)]
print('前 5 阶 Legendre 多项式:', P)
绘制图像以分别观察 3、10、50 阶的 Legendre 多项式
# legendre
# 生成数据
x = np.linspace(-1, 1, 4)
legendre_poly = legendre(3)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, legendre_poly, label='Legendre Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('3rd Order Legendre Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 11)
legendre_poly = legendre(10)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, legendre_poly, label='Legendre Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('10th Order Legendre Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 51)
legendre_poly = legendre(50)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, legendre_poly, label='Legendre Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('50th Order Legendre Polynomial')
plt.legend()
plt.show()
# 计算前 5 阶 Chebyshev 多项式
T = [chebyt(n) for n in range(5)]
print('前 5 阶 Chebyshev 多项式:', T)
绘制图像以分别观察 3、10、50 阶的 Chebyshev 多项式
# chebyt
# 生成数据
x = np.linspace(-1, 1, 4)
chebyt_poly = chebyt(3)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, chebyt_poly, label='Chebyt Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('3rd Order Chebyshev Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 11)
chebyt_poly = chebyt(10)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, chebyt_poly, label='Chebyt Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('10th Order Chebyshev Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 51)
chebyt_poly = chebyt(50)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, chebyt_poly, label='Chebyt Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('50th Order Chebyshev Polynomial')
plt.legend()
plt.show()
有三项递推关系:
# 计算前 5 阶 (α=0) Laguerre 多项式
L = [genlaguerre(n, 0) for n in range(5)]
print('前 5 阶 Laguerre 多项式 (α=0) :', L)
绘制图像以分别观察 3、10、50 阶的 Laguerre 多项式
# Laguerre
# 生成数据
x = np.linspace(-1, 1, 4)
Laguerre_poly = genlaguerre(3, 0)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, Laguerre_poly, label='Laguerre Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('3rd Order Laguerre Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 11)
Laguerre_poly = genlaguerre(10, 0)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, Laguerre_poly, label='Laguerre Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('10th Order Laguerre Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 51)
Laguerre_poly = genlaguerre(50, 0)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, Laguerre_poly, label='Laguerre Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('50th Order Laguerre Polynomial')
plt.legend()
plt.show()
有三项递推关系:
# 计算 Hermite 多项式前 5 阶
H = [hermite(n) for n in range(5)]
print(H)
绘制图像以分别观察 3、10、50 阶的 Hermite 多项式
# Hermite
# 生成数据
x = np.linspace(-1, 1, 4)
hermite_poly = hermite(3, 0)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, hermite_poly, label='Hermite Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('3rd Order Hermite Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 11)
hermite_poly = hermite(10)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, hermite_poly, label='Hermite Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('10th Order Hermite Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 51)
hermite_poly = hermite(50, 0)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, hermite_poly, label='Hermite Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('50th Order Hermite Polynomial')
plt.legend()
plt.show()
# 计算前 5 阶 (α=0.5, β=1.0) Jacobi 多项式
P = [jacobi(n, 0.5, 1.0) for n in range(5)]
print('前 5 阶 Jacobi 多项式 (α=0.5, β=1.0) :', P)
绘制图像以分别观察 3、10、50 阶的 Jacobi 多项式
# Jacobi
# 生成数据
x = np.linspace(-1, 1, 4)
jacobi_poly = jacobi(3, 0.5, 1.0)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, jacobi_poly, label='Jacobi Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('3rd Order Jacobi Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 11)
jacobi_poly = jacobi(10, 0.5, 1.0)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, jacobi_poly, label='Jacobi Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('10th Order Jacobi Polynomial')
plt.legend()
plt.show()
# 生成数据
x = np.linspace(-1, 1, 51)
jacobi_poly = jacobi(50, 0.5, 1.0)
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, jacobi_poly, label='Jacobi Polynomial')
plt.xlabel('x')
plt.ylabel('y')
plt.title('50th Order Jacobi Polynomial')
plt.legend()
plt.show()
是区间 [ -1, 1 ] 上权函数( x ) = 1 的正交多项式且满足:
是区间 [ -1, 1 ] 上权函数 的正交多项式,且满足:
有三项递推关系:
在 [-1,1] 上的 n 个零点为:
是区间 上权函数 的正交多项式,且满足:
是区间 上权函数 的正交多项式,且满足:
Jacobi 正交多项式 可以通过正交化代数多项式基底得到,这里的正交化是在内积空间中进行的。我们称为 n 次 Jacobi 多项式。