2.拉格朗日插值法
2.1 线性插值与抛物线插值
2.1.1 线性插值
在
(
1.1
)
(1.1)
(1.1)式中,
n
=
1
n=1
n=1时,区间
[
x
k
,
x
k
+
1
]
[x_k,x_{k+1}]
[xk,xk+1]及端点函数值
y
k
=
f
(
x
k
)
y_k=f(x_k)
yk=f(xk),
y
k
+
1
=
f
(
x
k
+
1
)
y_{k+1}=f(x_{k+1})
yk+1=f(xk+1),要求线性插值多项式
L
1
(
x
)
L_1(x)
L1(x)使满足
L
1
(
x
k
)
=
y
k
,
L
1
(
x
k
+
1
)
=
y
k
+
1
L_1(x_k)=y_k,L_1(x_{k+1})=y_{k+1}
L1(xk)=yk,L1(xk+1)=yk+1
由两点式直线方程
L
1
(
x
)
=
y
k
x
k
+
1
−
x
x
k
+
1
−
x
k
+
y
k
+
1
x
−
x
k
x
k
+
1
−
x
k
(1.6)
L_1(x)=y_k\frac{x_{k+1}-x}{x_{k+1}-x_k}+y_{k+1}\frac{x-x_k}{x_{k+1}-x_k}\tag{1.6}
L1(x)=ykxk+1−xkxk+1−x+yk+1xk+1−xkx−xk(1.6)
令
l
k
(
x
)
=
x
−
x
k
+
1
x
k
−
x
k
+
1
,
l
k
+
1
(
x
)
=
x
−
x
k
x
k
+
1
−
x
k
(1.7)
l_k(x)=\frac{x-x_{k+1}}{x_k-x_{k+1}},l_{k+1}(x)=\frac{x-x_k}{x_{k+1}-x_k}\tag{1.7}
lk(x)=xk−xk+1x−xk+1,lk+1(x)=xk+1−xkx−xk(1.7)
为线性插值函数,写成
L
1
(
x
)
=
y
k
l
k
(
x
)
+
y
k
+
1
l
k
+
1
(
x
)
(1.8)
L_1(x)=y_kl_k(x)+y_{k+1}l_{k+1}(x)\tag{1.8}
L1(x)=yklk(x)+yk+1lk+1(x)(1.8)
边界条件为
{
l
k
(
x
k
)
=
1
l
k
(
x
k
+
1
)
=
0
l
k
+
1
(
x
k
)
=
0
l
k
+
1
(
x
k
+
1
)
=
1
\begin{cases}l_k(x_k)=1\\ l_k(x_{k+1})=0\\ l_{k+1}(x_k)=0\\ l_{k+1}(x_{k+1})=1 \end{cases}
⎩
⎨
⎧lk(xk)=1lk(xk+1)=0lk+1(xk)=0lk+1(xk+1)=1
2.1.2 抛物线插值
在
(
1.1
)
(1.1)
(1.1)式中,
n
=
2
n=2
n=2时,插值节点为
x
k
−
1
,
x
k
,
x
k
+
1
x_{k-1},x_k,x_{k+1}
xk−1,xk,xk+1,要求二次插值多项式
L
2
(
x
)
L_2(x)
L2(x)满足
L
2
(
x
j
)
=
y
j
,
j
=
k
−
1
,
k
,
k
+
1
L_2(x_j)=y_j,j=k-1,k,k+1
L2(xj)=yj,j=k−1,k,k+1
边界条件为
l
k
−
1
(
x
k
−
1
)
=
1
,
l
k
−
1
(
x
k
)
=
0
,
l
k
−
1
(
x
k
+
1
)
=
0
l
k
(
x
k
−
1
)
=
0
,
l
k
(
x
k
)
=
1
,
l
k
(
x
k
+
1
)
=
0
l
k
+
1
(
x
k
−
1
)
=
0
,
l
k
+
1
(
x
k
)
=
0
,
l
k
+
1
(
x
k
+
1
)
=
1
(1.9)
\begin{matrix} l_{k-1}(x_{k-1})=1,&l_{k-1}(x_k)=0,&l_{k-1}(x_{k+1})=0\\ l_{k}(x_{k-1})=0,&l_{k}(x_k)=1,&l_{k}(x_{k+1})=0\\ l_{k+1}(x_{k-1})=0,&l_{k+1}(x_k)=0,&l_{k+1}(x_{k+1})=1\\ \end{matrix}\tag{1.9}
lk−1(xk−1)=1,lk(xk−1)=0,lk+1(xk−1)=0,lk−1(xk)=0,lk(xk)=1,lk+1(xk)=0,lk−1(xk+1)=0lk(xk+1)=0lk+1(xk+1)=1(1.9)
由抛物型曲线以及两个零点,插值函数可以设为
l
k
−
1
(
x
)
=
A
1
(
x
−
x
k
)
(
x
−
x
k
+
1
)
l
k
(
x
)
=
A
2
(
x
−
x
k
−
1
)
(
x
−
x
k
+
1
)
l
k
+
1
(
x
)
=
A
3
(
x
−
x
k
−
1
)
(
x
−
x
k
)
l_{k-1}(x)=A_1(x-x_k)(x-x_{k+1})\\ l_{k}(x)=A_2(x-x_{k-1})(x-x_{k+1})\\ l_{k+1}(x)=A_3(x-x_{k-1})(x-x_k)\\
lk−1(x)=A1(x−xk)(x−xk+1)lk(x)=A2(x−xk−1)(x−xk+1)lk+1(x)=A3(x−xk−1)(x−xk)
由
l
i
(
x
i
)
=
1
,
i
=
k
−
1
,
k
,
k
+
1
l_i(x_i)=1,i=k-1,k,k+1
li(xi)=1,i=k−1,k,k+1得
A
1
=
1
(
x
k
−
1
−
x
k
)
(
x
k
−
1
−
x
k
+
1
)
A
2
=
1
(
x
k
−
x
k
−
1
)
(
x
k
−
x
k
+
1
)
A
3
=
1
(
x
k
+
1
−
x
k
)
(
x
k
+
1
−
x
k
−
1
)
A_1=\frac{1}{(x_{k-1}-x_k)(x_{k-1}-x_{k+1})}\\ A_2=\frac{1}{(x_k-x_{k-1})(x_k-x_{k+1})}\\ A_3=\frac{1}{(x_{k+1}-x_k)(x_{k+1}-x_{k-1})}
A1=(xk−1−xk)(xk−1−xk+1)1A2=(xk−xk−1)(xk−xk+1)1A3=(xk+1−xk)(xk+1−xk−1)1
则插值函数为
l
k
−
1
(
x
)
=
(
x
−
x
k
)
(
x
−
x
k
+
1
)
(
x
k
−
1
−
x
k
)
(
x
k
−
x
k
+
1
)
l
k
(
x
)
=
(
x
−
x
k
−
1
)
(
x
x
k
+
1
)
(
x
k
−
x
k
−
1
)
(
x
k
−
x
k
+
1
)
l
k
+
1
(
x
)
=
(
x
−
x
k
−
1
)
(
x
−
x
k
)
(
x
k
+
1
−
x
k
−
1
)
(
x
k
+
1
−
x
k
)
(1.10)
l_{k-1}(x)=\frac{(x-x_k)(x-x_{k+1})}{(x_{k-1}-x_k)(x_k-x_{k+1})}\\ l_k(x)=\frac{(x-x_{k-1})(x_x{k+1})}{(x_k-x_{k-1})(x_k-x_{k+1})}\\ l_{k+1}(x)=\frac{(x-x_{k-1})(x-x_k)}{(x_{k+1}-x_{k-1})(x_{k+1}-x_k)}\tag{1.10}
lk−1(x)=(xk−1−xk)(xk−xk+1)(x−xk)(x−xk+1)lk(x)=(xk−xk−1)(xk−xk+1)(x−xk−1)(xxk+1)lk+1(x)=(xk+1−xk−1)(xk+1−xk)(x−xk−1)(x−xk)(1.10)
则二次插值函数写成
L
2
(
x
)
=
y
k
−
1
l
k
−
1
(
x
)
+
y
k
l
k
(
x
)
+
y
k
+
1
l
k
+
1
(
x
)
(1.11)
L_2(x)=y_{k-1}l_{k-1}(x)+y_kl_k(x)+y_{k+1}l_{k+1}(x)\tag{1.11}
L2(x)=yk−1lk−1(x)+yklk(x)+yk+1lk+1(x)(1.11)
2.2 拉格朗日插值多项式
在
(
1.1
)
(1.1)
(1.1)式中,对于
n
+
1
n+1
n+1个插值节点为
x
0
<
x
1
<
⋯
<
x
n
x_0<x_1<\cdots<x_n
x0<x1<⋯<xn,
n
n
n次插值多项式
L
n
(
x
)
L_n(x)
Ln(x)满足
L
n
(
x
j
)
=
y
j
,
j
=
0
,
1
,
⋯
,
n
L_n(x_j)=y_j,j=0,1,\cdots,n
Ln(xj)=yj,j=0,1,⋯,n
定义n次插值基函数
KaTeX parse error: Expected 'EOF', got '&' at position 51: …eq k\end{cases}&̲k,j=0,1,\cdots,…
写成
l
k
(
x
)
=
(
x
−
x
0
)
⋯
(
x
−
x
k
−
1
)
(
x
−
x
k
+
1
)
⋯
(
x
−
x
n
)
(
x
k
−
x
0
)
⋯
(
x
k
−
x
k
−
1
)
(
x
k
−
x
k
+
1
)
⋯
(
x
k
−
x
n
)
,
k
=
0
,
1
,
⋯
,
n
(1.13)
l_k(x)=\frac{(x-x_0)\cdots(x-x_{k-1})(x-x_{k+1})\cdots(x-x_n)}{(x_k-x_0)\cdots(x_k-x_{k-1})(x_k-x_{k+1})\cdots(x_k-x_n)},k=0,1,\cdots,n\tag{1.13}
lk(x)=(xk−x0)⋯(xk−xk−1)(xk−xk+1)⋯(xk−xn)(x−x0)⋯(x−xk−1)(x−xk+1)⋯(x−xn),k=0,1,⋯,n(1.13)
插值多项式
L
n
(
x
)
L_n(x)
Ln(x)可以写成
L
n
(
x
j
)
=
∑
k
=
0
n
y
k
l
k
(
x
j
)
=
y
j
L_n(x_j)=\sum_{k=0}^{n}y_kl_k(x_j)=y_j
Ln(xj)=k=0∑nyklk(xj)=yj
称为拉格朗日多项式
引入记号
ω
n
+
1
(
x
)
=
(
x
−
x
0
)
(
x
−
x
1
)
⋯
(
x
−
x
n
)
(1.14)
\omega_{n+1}(x)=(x-x_0)(x-x_1)\cdots(x-x_n)\tag{1.14}
ωn+1(x)=(x−x0)(x−x1)⋯(x−xn)(1.14)
插值基函数性质
∑
i
=
0
n
x
i
k
l
i
(
x
)
=
x
k
,
k
=
0
,
1
,
⋯
,
n
(1.15)
\sum_{i=0}^{n}x_i^kl_i(x)=x^k,k=0,1,\cdots,n\tag{1.15}
i=0∑nxikli(x)=xk,k=0,1,⋯,n(1.15)
当
k
=
0
k=0
k=0时,
∑
i
=
0
n
l
i
(
x
)
=
1
(1.16)
\sum_{i=0}^{n}l_i(x)=1\tag{1.16}
i=0∑nli(x)=1(1.16)