# 几种正交多项式

## 一、Legendre多项式

### 定义

<figure><img src="/files/IjlhQWCWxAnVJPXlt1Oy" alt="" width="563"><figcaption></figcaption></figure>

是区间 \[ -1, 1 ] 上权函数<img src="/files/9Wz9Vm1uf52rXmSrmSKC" alt="" data-size="line">( x ) = 1 的正交多项式且满足：

1.

```
<figure><img src="/files/KmHqHOow0afknr0S9KQ7" alt="" width="563"><figcaption></figcaption></figure>
```

2. 有三项递推关系：

<figure><img src="/files/r7x9wAyf1GUjRVPq8hqe" alt="" width="563"><figcaption></figcaption></figure>

### 代码实现

```python
# 计算前 5 阶 Legendre 多项式
P = [legendre(n) for n in range(5)]
print('前 5 阶 Legendre 多项式：', P)
```

绘制图像以分别观察 3、10、50 阶的 Legendre 多项式

```python
# 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()
```

## 二、Chebyshev多项式

### 定义

<figure><img src="/files/7KOYGovoynxyBUlJzHr9" alt="" width="563"><figcaption></figcaption></figure>

是区间 \[ -1, 1 ] 上权函数 <img src="/files/jNkEi20ezRy68ZdN6b37" alt="" data-size="line"> 的正交多项式，且满足:

*

```
<figure><img src="/files/tXWl1fIW5C7HS9T7G7ea" alt=""><figcaption></figcaption></figure>
```

* 有三项递推关系：![](/files/R8ZWue7bpOypaGCE8my8)
* <img src="/files/Budx7eLRA7QVmL2FhQLt" alt="" data-size="line"> 在 \[-1,1] 上的 n 个零点为：![](/files/WTuAx7kB49kCzEGeEg5Z)

### 代码实现

```python
# 计算前 5 阶 Chebyshev 多项式
T = [chebyt(n) for n in range(5)]
print('前 5 阶 Chebyshev 多项式：', T)
```

绘制图像以分别观察 3、10、50 阶的 Chebyshev 多项式

```python
# 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()
```

## 三、Laguerre多项式

### 定义

<figure><img src="/files/0UqYnGSMLBl8d38oB4HO" alt="" width="563"><figcaption></figcaption></figure>

是区间 <img src="/files/eMej3iMy5zPBEwENVtNq" alt="" data-size="line"> 上权函数 <img src="/files/9v76iUmJSZ0r5URU72aw" alt="" data-size="line"> 的正交多项式，且满足：

*

```
<figure><img src="/files/7D5u7YVlAtZBtdEKRtc0" alt="" width="563"><figcaption></figcaption></figure>
```

* 有三项递推关系：

  <figure><img src="/files/lobUaAGDWMvO1lEbmBwZ" alt="" width="375"><figcaption></figcaption></figure>

### 代码实现

```python
# 计算前 5 阶 (α=0) Laguerre 多项式
L = [genlaguerre(n, 0) for n in range(5)]
print('前 5 阶 Laguerre 多项式 (α=0) ：', L)
```

绘制图像以分别观察 3、10、50 阶的 Laguerre 多项式

```python
# 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多项式

### 定义

<figure><img src="/files/md7dcBvriQSxMs5LkAaN" alt="" width="563"><figcaption></figcaption></figure>

是区间 <img src="/files/fyzxUyrCtNUdUWKF4yKB" alt="" data-size="line"> 上权函数 <img src="/files/GLGA2kRyCMH0TOlJiQUD" alt="" data-size="line"> 的正交多项式，且满足：

*

```
<figure><img src="/files/WEE3IS3oZaIVgm8GR3Cm" alt="" width="563"><figcaption></figcaption></figure>
```

* 有三项递推关系：

  <figure><img src="/files/35V0LYlbNZeXxB0SawLH" alt="" width="375"><figcaption></figcaption></figure>

### 代码实现

```python
# 计算 Hermite 多项式前 5 阶
H = [hermite(n) for n in range(5)]
print(H)
```

绘制图像以分别观察 3、10、50 阶的 Hermite 多项式

```python
# 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()
```

## 五、Jacobi多项式

### 定义

Jacobi 正交多项式 <img src="/files/SmhTi8cF6hJ4DjBw7Qta" alt="" data-size="line"> 可以通过正交化代数多项式基底<img src="/files/LifHN2iNhZhgDVlkNb1K" alt="" data-size="line">得到，这里的正交化是在内积空间<img src="/files/7YLZAE58R6JsXIwpMact" alt="" data-size="line">中进行的。我们称<img src="/files/bqYOX2yX44ltv5xSqFlr" alt="" data-size="line">为 n 次 Jacobi 多项式。

*

```
<figure><img src="/files/Y72BPHTlhQwub3qPye1U" alt="" width="563"><figcaption></figcaption></figure>
```

*

```
<figure><img src="/files/POM8eha6k5LI7Gp9as2j" alt="" width="563"><figcaption></figcaption></figure>
```

*

```
<figure><img src="/files/5TsfN1tSPCapzANhFphq" alt="" width="375"><figcaption></figcaption></figure>
```

*

```
<figure><img src="/files/6dOpwknAtMMwC9t8EdrG" alt=""><figcaption></figcaption></figure>
```

### 代码实现

```python
# 计算前 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 多项式

```python
# 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()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://laus-organization.gitbook.io/numerical-analysis-implementations-in-python/cha-zhi-yu-bi-jin/ji-zhong-zheng-jiao-duo-xiang-shi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
