4. Hermite插值
理论和应用中提出的某些插值问题,要求插值函数
p
(
x
)
{p(x)}
p(x) 具有一定的光滑度,即在插值节点处满足一定的导数条件,这类插值问题称为Hermite插值问题。题目大多以三次Hermite插值为主。三次Hermite插值需要四个条件,二次Hermite插值需要三个条件,分类如下:
4.1 待定系数法求Hermite插值
Hermite插值我们一定会知道给定点的函数值,和某些点的导数值。由多项式插值得到的插值函数是唯一的,我们可以先用已知点构造拉格朗日或牛顿插值,得到一部分插值多项式,再根据导数值往插值多项式加入待定系数项,并代入导数值求解。这种方法比后两种快很多。
[!example]-
已知
x ∣ ∣ 0 ∣ 1 ∣ 2 ∣ = = = = = = = = f ( x ) ∣ ∣ 5 ∣ 3 ∣ 9 ∣ − − − − − − − − f ′ ( x ) ∣ ∣ − 4 ∣ 0 ∣ ∣ \begin{array}{cccccc} x&||& 0 &|& 1 &|& 2 &| \\=&=&=&=&=&=&=&=\\ f(x)&||& 5 &|& 3 &|& 9 &| \\ -&-&-&-&-&-&-&- \\ f'(x) &||& -4 &|&0 &|& &| \\ \end{array} x=f(x)−f′(x)∣∣=∣∣−∣∣0=5−−4∣=∣−∣1=3−0∣=∣−∣2=9−∣=∣−∣
用已知的五个条件求四次Hermite插值多项式。
解:先用三个点的函数值求拉格朗日插值多项式
L ( x ) = 5 ( x − 1 ) ( x − 2 ) ( 0 − 1 ) ( 0 − 2 ) + 3 ( x − 0 ) ( x − 2 ) ( 1 − 0 ) ( 1 − 2 ) + 9 ( x − 0 ) ( x − 1 ) ( 2 − 0 ) ( 2 − 1 ) = 4 x 2 − 6 x + 5 \begin{align*} L(x)=&5 \frac{(x-1)(x-2)}{(0-1)(0-2)}+3 \frac{(x-0)(x-2)}{(1-0)(1-2)}+9 \frac{(x-0)(x-1)}{(2-0)(2-1)} \\ \\ =&4x^2-6x+5 \end{align*} L(x)==5(0−1)(0−2)(x−1)(x−2)+3(1−0)(1−2)(x−0)(x−2)+9(2−0)(2−1)(x−0)(x−1)4x2−6x+5
令
H ( x ) = L ( x ) + ( a x + b ) ( x − 0 ) ( x − 1 ) ( x − 2 ) H ′ ( x ) = 8 x − 6 + 4 a x 3 + ( 3 b − 9 a ) x 2 + ( 4 a − 6 b ) x + 2 b H ′ ( 0 ) = − 6 + 2 b = − 4 H ′ ( 1 ) = 2 + 4 a + 3 b − 9 a + 4 a − 6 b + 2 b = 2 − a − b = 0 \begin{align*} H(x)=&L(x)+(ax+b)(x-0)(x-1)(x-2)\\ \\ H'(x)=&8x-6+4ax^3+(3b-9a)x^2+(4a-6b)x+2b \\ \\ H'(0)=&-6+2b=-4 \\ \\ H'(1)=&2+4a+3b-9a+4a-6b+2b=2-a-b=0 \end{align*} H(x)=H′(x)=H′(0)=H′(1)=L(x)+(ax+b)(x−0)(x−1)(x−2)8x−6+4ax3+(3b−9a)x2+(4a−6b)x+2b−6+2b=−42+4a+3b−9a+4a−6b+2b=2−a−b=0
∴ a = 1 , b = 1 \therefore a=1 \,\,,\,\, b=1 ∴a=1,b=1
H ( x ) = x 4 − 2 x 3 + 3 x 2 − 4 x + 5 H(x)=x^4-2x^3+3x^2-4x+5 H(x)=x4−2x3+3x2−4x+5
4.2 两点三次Hermite插值
确定三次插值多项式
H
3
(
x
)
{H_3(x)}
H3(x) 使满足:
H
3
(
x
0
)
=
f
(
x
0
)
=
y
0
,
H
3
(
x
1
)
=
f
(
x
1
)
=
y
1
H
3
′
(
x
0
)
=
f
′
(
x
0
)
=
y
0
′
,
H
3
′
(
x
1
)
=
f
′
(
x
1
)
=
y
1
′
\begin{align*} H_3(x_0)=f(x_0)=y_0 \,\,,\,\, H_3(x_1)=f(x_1)=y_1 \\ \\ H_3'(x_0)=f'(x_0)=y_0' \,\,,\,\, H_3'(x_1)=f'(x_1)=y_1' \end{align*}
H3(x0)=f(x0)=y0,H3(x1)=f(x1)=y1H3′(x0)=f′(x0)=y0′,H3′(x1)=f′(x1)=y1′
方法:基函数法,基函数为三次多项式。
步骤:
- 设
H
3
(
x
)
{H_3(x)}
H3(x) 和
H
3
′
(
x
)
{H_3'(x)}
H3′(x) 的表达式
H 3 ( X ) = ϕ 0 ( x ) y 0 + ϕ 1 ( x ) y 1 + ψ 0 ( x ) y 1 ′ + ψ 1 ( x ) y 1 ′ (1) H_3(X)= \phi_0(x)y_0+\phi_1(x)y_1+\psi_0(x)y_1'+\psi_1(x)y_1' \tag{1} H3(X)=ϕ0(x)y0+ϕ1(x)y1+ψ0(x)y1′+ψ1(x)y1′(1)
H 3 ′ ( X ) = ϕ 0 ′ ( x ) y 0 + ϕ 1 ′ ( x ) y 1 + ψ 0 ′ ( x ) y 1 ′ + ψ 1 ′ ( x ) y 1 ′ (2) H_3'(X)= \phi_0'(x)y_0+\phi_1'(x)y_1+\psi_0'(x)y_1'+\psi_1'(x)y_1' \tag{2} H3′(X)=ϕ0′(x)y0+ϕ1′(x)y1+ψ0′(x)y1′+ψ1′(x)y1′(2) - 根据表达式列表
将 x 0 代入 ( 1 ) 将 x 1 代入 ( 1 ) 将 x 0 代入 ( 2 ) 将 x 1 代入 ( 2 ) ϕ 0 ( x 0 ) = 1 ϕ 0 ( x 1 ) = 0 ϕ 0 ′ ( x 0 ) = 0 ϕ 0 ′ ( x 1 ) = 0 ϕ 1 ( x 0 ) = 0 ϕ 1 ( x 1 ) = 1 ϕ 1 ′ ( x 0 ) = 0 ϕ 1 ′ ( x 1 ) = 0 ψ 0 ( x 0 ) = 0 ψ 0 ( x 1 ) = 0 ψ 0 ′ ( x 0 ) = 1 ψ 0 ′ ( x 1 ) = 0 ψ 1 ( x 0 ) = 0 ψ 1 ( x 1 ) = 0 ψ 1 ′ ( x 0 ) = 0 ψ 1 ′ ( x 1 ) = 1 \begin{array}{cccccc} 将 x_0 代入(1) & 将 x_1 代入(1) & 将 x_0 代入(2) & 将 x_1 代入(2) \\ \\ \phi_0(x_0)=1 & \phi_0(x_1)=0 & \phi_0'(x_0)=0 & \phi_0'(x_1)=0 \\ \\ \phi_1(x_0)=0 & \phi_1(x_1)=1 & \phi_1'(x_0)=0 & \phi_1'(x_1)=0 \\ \\ \psi_0(x_0)=0 & \psi_0(x_1)=0 & \psi_0'(x_0)=1 & \psi_0'(x_1)=0 \\ \\ \psi_1(x_0)=0 & \psi_1(x_1)=0 & \psi_1'(x_0)=0 & \psi_1'(x_1)=1 \\ \\ \end{array} 将x0代入(1)ϕ0(x0)=1ϕ1(x0)=0ψ0(x0)=0ψ1(x0)=0将x1代入(1)ϕ0(x1)=0ϕ1(x1)=1ψ0(x1)=0ψ1(x1)=0将x0代入(2)ϕ0′(x0)=0ϕ1′(x0)=0ψ0′(x0)=1ψ1′(x0)=0将x1代入(2)ϕ0′(x1)=0ϕ1′(x1)=0ψ0′(x1)=0ψ1′(x1)=1 - 求基函数
对 ϕ 0 {\phi_0} ϕ0 来说,有一个二重零点 x 1 {x_1} x1 ,再设一个零点,有
ϕ 0 ( x ) = ( x − x 1 ) 2 ( a x + b ) , ( 代入 ϕ 0 ( x 0 ) = 1 , ϕ 0 ′ ( x 0 ) = 0 求 a , b ) \phi_0(x)=(x-x_1)^2(ax+b) \,\,,\,\, (代入\, \phi_0(x_0)=1,\phi_0'(x_0)=0\,求\,a,b) ϕ0(x)=(x−x1)2(ax+b),(代入ϕ0(x0)=1,ϕ0′(x0)=0求a,b)
对 ϕ 1 {\phi_1} ϕ1 来说,有一个二重零点 x 0 {x_0} x0 ,再设一个零点,有
ϕ 1 ( x ) = ( x − x 0 ) 2 ( a x + b ) , ( 代入 ϕ 1 ( x 1 ) = 1 , ϕ 1 ′ ( x 1 ) = 0 求 a , b ) \phi_1(x)=(x-x_0)^2(ax+b) \,\,,\,\, (代入\, \phi_1(x_1)=1,\phi_1 '(x_1)=0\,求\,a,b) ϕ1(x)=(x−x0)2(ax+b),(代入ϕ1(x1)=1,ϕ1′(x1)=0求a,b)
对 ψ 0 {\psi_0} ψ0 来说,有一个一重零点 x 0 {x_0} x0 ,有一个二重零点 x 1 {x_1} x1 有
ψ 0 ( x ) = c ( x − x 0 ) ( x − x 1 ) 2 , ( 代入 ψ 0 ′ ( x 0 ) = 1 求出 c ) \psi_0(x)=c(x-x_0)(x-x_1)^2 \,\,,\,\, (代入 \, \psi_0'(x_0)=1\,求出\,c) ψ0(x)=c(x−x0)(x−x1)2,(代入ψ0′(x0)=1求出c)
对 ψ 1 {\psi_1} ψ1 来说,有一个一重零点 x 1 {x_1} x1 ,有一个二重零点 x 0 {x_0} x0 有
ψ 1 ( x ) = c ( x − x 1 ) ( x − x 0 ) 2 , ( 代入 ψ 1 ′ ( x 1 ) = 1 求出 c ) \psi_1(x)=c(x-x_1)(x-x_0)^2 \,\,,\,\, (代入 \, \psi_1'(x_1)=1\,求出\,c) ψ1(x)=c(x−x1)(x−x0)2,(代入ψ1′(x1)=1求出c)
还需要知道基函数的导数形式以方便求解,若
ϕ ( x ) = ( x − x i ) 2 ( a x + b ) = 1 \phi(x)=(x-x_i)^2(ax+b)=1 ϕ(x)=(x−xi)2(ax+b)=1
ϕ ′ ( x ) = 2 ( x − x i ) ( a x + b ) + a ( x − x i ) 2 = 0 \begin{align*} \phi'(x)=& 2(x-x_i)(ax+b)+a(x-x_i)^2=0 \end{align*} ϕ′(x)=2(x−xi)(ax+b)+a(x−xi)2=0
解得
a = − 2 ( x − x i ) 3 b = ( 3 x − x i ) ( x − x i ) 3 \begin{align*} a= &-\frac{2}{(x-x_i)^3} \\ \\ b = & \frac{(3x-x_i)}{(x-x_i)^3} \end{align*} a=b=−(x−xi)32(x−xi)3(3x−xi)
若
ψ i ( x ) = c ( x − x i ) ( x − x j ) 2 \psi_i(x)=c(x-x_i)(x-x_j)^2 ψi(x)=c(x−xi)(x−xj)2
ψ i ′ ( x ) = c ( x − x j ) 2 + 2 c ( x − x j ) ( x − x i ) = 1 \psi_i'(x)=c(x-x_j)^2+2c(x-x_j)(x-x_i)=1 ψi′(x)=c(x−xj)2+2c(x−xj)(x−xi)=1
解得
c = 1 ( x − x j ) 2 + 2 ( x − x i ) ( x − x j ) ∣ x = x i = 1 ( x i − x j ) 2 c= \frac{1}{(x-x_j)^2+2(x-x_i)(x-x_j)}\Bigg|_{x=x_i}=\frac1{(x_i-x_j)^2} c=(x−xj)2+2(x−xi)(x−xj)1 x=xi=(xi−xj)21
将基函数代入式(1)得到插值多项式。
[!example]-
设 f ( x ) = x 4 + 2 x 3 + 5 {f(x)=x^4+2x^3+5} f(x)=x4+2x3+5 。对节点 x 0 = − 3 {x_0=-3} x0=−3 , x 1 = − 1 {x_1=-1} x1=−1 ,求在区间 [ − 3 , − 1 ] {[-3,-1]} [−3,−1] 上的三次Hermite插值多项式及其余项。
解:由题可得
y 0 = 32 , y 1 = 4 , y 0 ′ = − 54 , y 1 ′ = 2 y_0=32 \,\,,\,\, y_1=4 \,\,,\,\, y_0'=-54 \,\,,\,\, y_1'=2 y0=32,y1=4,y0′=−54,y1′=2
所以插值函数
H 3 ( x ) = 32 ϕ 0 ( x ) + 4 ϕ 1 ( x ) − 54 ψ 0 ( x ) + 2 ψ 1 ( x ) H_3(x)=32\phi_0(x)+4\phi_1(x)-54\psi_0(x)+2\psi_1(x) H3(x)=32ϕ0(x)+4ϕ1(x)−54ψ0(x)+2ψ1(x)
接下来求基函数
a = − 2 / ( − 3 + 1 ) 3 = 1 / 4 b = ( − 3 ⋅ 3 + 1 ) / ( − 3 + 1 ) 3 = 1 } → ϕ 0 ( x ) = ( x + 1 ) 2 ( 1 4 x + 1 ) \begin{rcases} a=-2/(-3+1)^3=1/4 \\ \\ b=(-3\cdot3+1)/(-3+1)^3=1 \end{rcases}\to\phi_0(x)=(x+1)^2( \frac{1}{4}x+1) a=−2/(−3+1)3=1/4b=(−3⋅3+1)/(−3+1)3=1⎭ ⎬ ⎫→ϕ0(x)=(x+1)2(41x+1)
a = − 2 / ( − 1 + 3 ) 3 = − 1 / 4 b = ( 3 ⋅ ( − 1 ) + 3 ) / ( − 1 + 3 ) 3 = 0 } → ϕ 1 ( x ) = − 1 4 x ( x + 3 ) 2 \begin{rcases} a=-2/(-1+3)^3=-1/4 \\ \\ b=(3 \cdot (-1)+3)/(-1+3)^3=0 \end{rcases}\to\phi_1(x)=-\frac{1}{4}x(x+3)^2 a=−2/(−1+3)3=−1/4b=(3⋅(−1)+3)/(−1+3)3=0⎭ ⎬ ⎫→ϕ1(x)=−41x(x+3)2
c = 1 ( − 3 + 1 ) 2 = 1 4 → ψ 0 ( x ) = 1 4 ( x + 3 ) ( x + 1 ) 2 c=\frac 1{(-3+1)^2}=\frac 1 4\to\psi_0(x)= \frac{1}{4}(x+3)(x+1)^2 c=(−3+1)21=41→ψ0(x)=41(x+3)(x+1)2
c = 1 ( − 1 + 3 ) 2 = 1 4 → ψ 1 ( x ) = 1 4 ( x + 1 ) ( x + 3 ) 2 c=\frac 1{(-1+3)^2}=\frac 1 4\to\psi_1(x)= \frac{1}{4}(x+1)(x+3)^2 c=(−1+3)21=41→ψ1(x)=41(x+1)(x+3)2
代入插值多项式得
H 3 ( x ) = − 6 x 3 − 22 x 2 − 24 x − 4 H_3(x)=-6x^3-22x^2-24x-4 H3(x)=−6x3−22x2−24x−4
由插值余项定理
∣ R 3 ( x ) ∣ = ∣ f ( x ) − H 3 ( x ) ∣ = ∣ f ( 4 ) ( ξ ) 4 ! ( x + 3 ) 2 ( x + 1 ) 2 ∣ = ∣ 4 ! 4 ! ( x + 3 ) 2 ( x + 1 ) 2 ∣ \begin{align*} |R_3(x)|=&|f(x)-H_3(x)|=| \frac{f^{(4)}(\xi)}{4!}(x+3)^2(x+1)^2 | \\ \\ =&| \frac{4!}{4!}(x+3)^2(x+1)^2 | \end{align*} ∣R3(x)∣==∣f(x)−H3(x)∣=∣4!f(4)(ξ)(x+3)2(x+1)2∣∣4!4!(x+3)2(x+1)2∣
说明:
- 余项仿照拉格朗日余项, x 0 {x_0} x0 点用了两次,所以平方, x 1 {x_1} x1 点同理
- 类型 1 {1} 1 中系数 c {c} c 是相同的
4.3 三点三次Hermite插值
确定三次插值多项式
H
3
(
x
)
{H_3(x)}
H3(x) 使满足:
H
3
(
x
0
)
=
f
(
x
0
)
=
y
0
,
H
3
(
x
1
)
=
f
(
x
1
)
=
y
1
,
H
3
(
x
2
)
=
f
(
x
2
)
=
y
2
H
3
′
(
x
0
)
=
f
′
(
x
0
)
=
y
0
′
\begin{align*} H_3(x_0)=f(x_0)=y_0 \,\,,\,\, H_3(x_1)=&f(x_1)=y_1\,\,,\,\, H_3(x_2)=f(x_2)=y_2 \\ \\ H_3'(x_0)=&f'(x_0)=y_0' \end{align*}
H3(x0)=f(x0)=y0,H3(x1)=H3′(x0)=f(x1)=y1,H3(x2)=f(x2)=y2f′(x0)=y0′
方法:基函数法,基函数为三次多项式。
步骤:
- 设
H
3
(
x
)
{H_3(x)}
H3(x) 和
H
3
′
(
x
)
{H_3'(x)}
H3′(x) 的表达式
H 3 ( X ) = ϕ 0 ( x ) y 0 + ϕ 1 ( x ) y 1 + ϕ 2 ( x ) y 2 + ψ 0 ( x ) y 0 ′ (1) H_3(X)= \phi_0(x)y_0+\phi_1(x)y_1+\phi_2(x)y_2+\psi_0(x)y_0' \tag{1} H3(X)=ϕ0(x)y0+ϕ1(x)y1+ϕ2(x)y2+ψ0(x)y0′(1)
H 3 ′ ( X ) = ϕ 0 ′ ( x ) y 0 + ϕ 1 ′ ( x ) y 1 + ϕ 2 ′ ( x ) y 2 + ψ 0 ′ ( x ) y 0 ′ (2) H_3'(X)= \phi_0'(x)y_0+\phi_1'(x)y_1+\phi_2'(x)y_2+\psi_0'(x)y_0' \tag{2} H3′(X)=ϕ0′(x)y0+ϕ1′(x)y1+ϕ2′(x)y2+ψ0′(x)y0′(2) - 根据表达式列表
将 x 0 代入 ( 1 ) 将 x 1 代入 ( 1 ) 将 x 2 代入 ( 1 ) 将 x 0 代入 ( 2 ) ϕ 0 ( x 0 ) = 1 ϕ 0 ( x 1 ) = 0 ϕ 0 ( x 2 ) = 0 ϕ 0 ′ ( x 0 ) = 0 ϕ 1 ( x 0 ) = 0 ϕ 1 ( x 1 ) = 1 ϕ 1 ( x 2 ) = 0 ϕ 1 ′ ( x 0 ) = 0 ϕ 2 ( x 0 ) = 0 ϕ 2 ( x 1 ) = 0 ϕ 2 ( x 2 ) = 1 ϕ 2 ′ ( x 0 ) = 0 ψ 0 ( x 0 ) = 0 ψ 0 ( x 1 ) = 0 ψ 0 ( x 2 ) = 0 ψ 0 ′ ( x 0 ) = 1 \begin{array}{cccccc} 将 x_0 代入(1) & 将 x_1 代入(1) & 将 x_2 代入(1) & 将 x_0 代入(2) \\ \\ \phi_0(x_0)=1 & \phi_0(x_1)=0 & \phi_0(x_2)=0 & \phi_0'(x_0)=0 \\ \\ \phi_1(x_0)=0 & \phi_1(x_1)=1 & \phi_1(x_2)=0 & \phi_1'(x_0)=0 \\ \\ \phi_2(x_0)=0 & \phi_2(x_1)=0 & \phi_2(x_2)=1 & \phi_2'(x_0)=0 \\ \\ \psi_0(x_0)=0 & \psi_0(x_1)=0 & \psi_0(x_2)=0 & \psi_0'(x_0)=1 \\ \\ \end{array} 将x0代入(1)ϕ0(x0)=1ϕ1(x0)=0ϕ2(x0)=0ψ0(x0)=0将x1代入(1)ϕ0(x1)=0ϕ1(x1)=1ϕ2(x1)=0ψ0(x1)=0将x2代入(1)ϕ0(x2)=0ϕ1(x2)=0ϕ2(x2)=1ψ0(x2)=0将x0代入(2)ϕ0′(x0)=0ϕ1′(x0)=0ϕ2′(x0)=0ψ0′(x0)=1 - 求基函数
对 ϕ 0 {\phi_0} ϕ0 来说,有两个一重零点 x 1 , x 2 {x_1} \,\,,\,\, x_2 x1,x2 ,再设一个零点,有
ϕ 0 ( x ) = ( x − x 1 ) ( x − x 2 ) ( a x + b ) , ( 代入 ϕ 0 ( x 0 ) = 1 , ϕ 0 ′ ( x 0 ) = 0 求 a , b ) \phi_0(x)=(x-x_1)(x-x_2)(ax+b) \,\,,\,\, (代入\, \phi_0(x_0)=1,\phi_0'(x_0)=0\,求\,a,b) ϕ0(x)=(x−x1)(x−x2)(ax+b),(代入ϕ0(x0)=1,ϕ0′(x0)=0求a,b)
对 ϕ 1 {\phi_1} ϕ1 来说,有两个一重零点 x 0 , x 2 {x_0} \,\,,\,\, x_2 x0,x2 ,再设一个零点,有
ϕ 1 ( x ) = ( x − x 0 ) ( x − x 2 ) ( a x + b ) , ( 代入 ϕ 1 ( x 1 ) = 1 , ϕ 1 ′ ( x 1 ) = 0 求 a , b ) \phi_1(x)=(x-x_0)(x-x_2)(ax+b) \,\,,\,\, (代入\, \phi_1(x_1)=1,\phi_1'(x_1)=0\,求\,a,b) ϕ1(x)=(x−x0)(x−x2)(ax+b),(代入ϕ1(x1)=1,ϕ1′(x1)=0求a,b)
对 ϕ 2 {\phi_2} ϕ2 来说,有两个一重零点 x 0 , x 1 {x_0} \,\,,\,\, x_1 x0,x1 ,再设一个零点,有
ϕ 2 ( x ) = ( x − x 0 ) ( x − x 1 ) ( a x + b ) , ( 代入 ϕ 2 ( x 2 ) = 1 , ϕ 2 ′ ( x 2 ) = 0 求 a , b ) \phi_2(x)=(x-x_0)(x-x_1)(ax+b) \,\,,\,\, (代入\, \phi_2(x_2)=1,\phi_2'(x_2)=0\,求\,a,b) ϕ2(x)=(x−x0)(x−x1)(ax+b),(代入ϕ2(x2)=1,ϕ2′(x2)=0求a,b)
对 ψ 0 {\psi_0} ψ0 来说,有三个一重零点 x 0 , x 1 , x 2 {x_0} \,\,,\,\, x_1\,\,,\,\, x_2 x0,x1,x2 ,有
ψ 0 = c ( x − x 0 ) ( x − x 1 ) ( x − x 2 ) , ( 代入 ψ 0 ′ ( x 0 ) = 1 求出 c ) \psi_0=c(x-x_0)(x-x_1)(x-x_2)\,\,,\,\, (代入 \, \psi_0'(x_0)=1\,求出\,c) ψ0=c(x−x0)(x−x1)(x−x2),(代入ψ0′(x0)=1求出c)
还需要知道基函数的导数形式以方便求解,若
ϕ ( x ) = ( x − x i ) ( x − x j ) ( a x + b ) = 1 \phi(x)=(x-x_i)(x-x_j)(ax+b)=1 ϕ(x)=(x−xi)(x−xj)(ax+b)=1
ϕ ′ ( x ) = ( x − x i ) ( a x + b ) + ( x − x j ) ( a x + b ) + a ( x − x i ) ( x − x j ) = 0 \phi'(x)=(x - x_i)(ax+b) + (x - x_j)( ax+b) + a(x - x_i)(x - x_j)=0 ϕ′(x)=(x−xi)(ax+b)+(x−xj)(ax+b)+a(x−xi)(x−xj)=0
解得
a = 2 x − x i − x j ( x − x i ) 2 ( x − x j ) 2 b = 3 x 2 − 2 x ( x i + x j ) + x i x j ( x − x i ) 2 ( x − x j ) 2 \begin{align*} a= &\frac{2x-x_i-x_j}{(x-x_i)^2(x-x_j)^2} \\ \\ b = & \frac{3x^2-2x(x_i+x_j)+x_ix_j}{(x-x_i)^2(x-x_j)^2} \end{align*} a=b=(x−xi)2(x−xj)22x−xi−xj(x−xi)2(x−xj)23x2−2x(xi+xj)+xixj
若
ψ ( x ) = c ( x − x i ) ( x − x j ) ( x − x k ) \psi(x)=c(x-x_i)(x-x_j)(x-x_k) ψ(x)=c(x−xi)(x−xj)(x−xk)
ψ ′ ( x ) = [ c ( x − x i ) ( x − x j ) + c ( x − x i ) ( x − x k ) + c ( x − x j ) ( x − x k ) ] ∣ x = x i = c ( x i − x j ) ( x i − x k ) = 1 \begin{align*} \psi'(x)=&[c(x - x_i)(x - x_j) + c(x - x_i)(x - x_k) + c(x - x_j)(x - x_k)]\big|_{x=x_i} \\ \\ =&c(x_i-x_j)(x_i-x_k)=1 \end{align*} ψ′(x)==[c(x−xi)(x−xj)+c(x−xi)(x−xk)+c(x−xj)(x−xk)] x=xic(xi−xj)(xi−xk)=1
c = 1 ( x i − x j ) ( x i − x k ) c= \frac{1}{(x_i-x_j)(x_i-x_k)} c=(xi−xj)(xi−xk)1
[!example]-
已知
f ( 1 ) = 5 , f ( 2 ) = 21 , f ( 3 ) = 53 , f ′ ( 1 ) = 10 f(1)=5 \,\,,\,\, f(2)=21 \,\,,\,\, f(3)=53 \,\,,\,\, f'(1)=10 f(1)=5,f(2)=21,f(3)=53,f′(1)=10
求三次Hermite插值多项式
解:设插值函数
H 3 ( x ) = 5 ⋅ ϕ 0 ( x ) + 21 ⋅ ϕ 1 ( x ) + 53 ⋅ ϕ 2 ( x ) + 10 ⋅ ψ 0 ( x ) H_3(x)=5 \cdot \phi_0(x)+21 \cdot \phi_1(x) +53 \cdot \phi_2(x)+10 \cdot \psi_0(x) H3(x)=5⋅ϕ0(x)+21⋅ϕ1(x)+53⋅ϕ2(x)+10⋅ψ0(x)
求基函数
a = − 3 / 4 b = − 1 / 4 } → ϕ 0 ( x ) = ( x − 2 ) ( x − 3 ) ( − 3 4 x − 1 4 ) \begin{rcases} a=-3/4 \\ \\ b=-1/4 \end{rcases}\to\phi_0(x)=(x-2)(x-3)(- \frac{3}{4}x- \frac{1}{4}) a=−3/4b=−1/4⎭ ⎬ ⎫→ϕ0(x)=(x−2)(x−3)(−43x−41)
a = 0 b = 12 } → ϕ 1 ( x ) = 12 ( x − 1 ) ( x − 3 ) \begin{rcases} a=0 \\ \\ b=12 \end{rcases}\to\phi_1(x)=12(x-1)(x-3) a=0b=12⎭ ⎬ ⎫→ϕ1(x)=12(x−1)(x−3)
a = 3 / 4 b = 65 / 4 } → ϕ 2 ( x ) = ( x − 2 ) ( x − 3 ) ( 3 4 x + 65 4 ) \begin{rcases} a=3/4 \\ \\ b=65/4 \end{rcases}\to\phi_2(x)=(x-2)(x-3)(\frac{3}{4}x+\frac{65}{4}) a=3/4b=65/4⎭ ⎬ ⎫→ϕ2(x)=(x−2)(x−3)(43x+465)
c = 1 ( 1 − 2 ) ( 1 − 3 ) = 1 2 → ψ 0 ( x ) = 1 2 ( x − 1 ) ( x − 2 ) ( x − 3 ) c= \frac{1}{(1-2)(1-3)}=\frac{1}{2}\to\psi_0(x)= \frac{1}{2}(x-1)(x-2)(x-3) c=(1−2)(1−3)1=21→ψ0(x)=21(x−1)(x−2)(x−3)
所以
H 3 ( x ) = 41 x 3 + 902 x 2 − 5037 x + 5886 H_3(x)=41x^3 + 902x^2 - 5037x + 5886 H3(x)=41x3+902x2−5037x+5886
4.4 n+1个点2n+1次Hermite插值多项式
就是所有节点的函数值和导数值都用上了
H
2
n
+
1
(
x
)
=
∑
k
=
0
n
(
1
−
2
l
k
′
(
x
k
)
(
x
−
x
k
)
)
l
k
2
(
x
)
f
k
+
∑
k
=
0
n
(
x
−
x
k
)
l
k
2
(
x
)
f
k
′
H_{2n+1}(x)= \sum_{k=0}^{ n}(1-2l_k'(x_k)(x-x_k))l_k^2(x)f_k+ \sum_{k=0}^{ n}(x-x_k)l_k^2(x)f_k'
H2n+1(x)=k=0∑n(1−2lk′(xk)(x−xk))lk2(x)fk+k=0∑n(x−xk)lk2(x)fk′
余项公式
R
2
n
+
1
(
x
)
=
f
(
x
)
−
H
2
n
+
1
(
x
)
=
f
(
2
n
+
2
)
(
ξ
)
(
2
n
+
2
)
!
(
∏
(
x
)
)
2
,
∏
(
x
)
=
∏
j
=
0
n
(
x
−
x
j
)
R_{2n+1}(x)=f(x)-H_{2n+1}(x)= \frac{f^{(2n+2)}(\xi)}{(2n+2)!}(\prod_{}^{ }(x))^2 \,\,,\,\, \prod_{}^{ }(x)= \prod_{j=0}^{ n}(x-x_j)
R2n+1(x)=f(x)−H2n+1(x)=(2n+2)!f(2n+2)(ξ)(∏(x))2,∏(x)=j=0∏n(x−xj)
如果给定定义域,则右边积分可以得到一个
2
n
+
1
{2n+1}
2n+1 次的数值积分公式。
积分中值定理可得出积分误差
R
[
f
]
=
f
(
2
n
+
2
)
(
η
)
(
2
n
+
2
)
!
∫
a
b
(
∏
(
x
)
)
2
d
x
R[f]= \frac{f^{(2n+2)}(\eta)}{(2n+2)!} \int_{ a }^{b} (\prod_{}^{ }(x))^2 \mathrm dx
R[f]=(2n+2)!f(2n+2)(η)∫ab(∏(x))2dx