数值计算方法32 (插值多项式中的误差)

Ax = b ? a11 a12 L a1n ? ? ? ? a21 a22 L a2n ? i?1 A= ? M bi ?∑lij xj M M ? 第二章 M插值与逼近 ? ? j=1 an1 an2 L ann ? xi = ? lii §2.2 插值多项式中的误差

i = 2,3,L, n

§3.2 插值多项式中的误差

Ln ( x ) = ∑ y j l j ( x )
j =0 n

Ln ( xi ) = f ( xi )
?x ∈ [a, b]

i = 0,1, L, n Ln ( x) = f ( x) 不会完全成立

Rn ( x) = f ( x) ? Pn ( x)

Rn ( x) = K ( x)ω n +1 ( x)

ω n +1 ( x) = ( x ? x0 )( x ? x1 ) L ( x ? xn )

K (x)为待定函数

Rn ( x) = f ( x) ? Pn ( x) = K ( x)ω n +1 ( x)

f ( x) ? Pn ( x) ? K ( x)ω n +1 ( x) = 0 若引入辅助函数? (t ) = f (t ) ? Pn (t ) ? K ( x)ω n +1 (t ) 则有 ? (x ) = f ( x ) ? Pn ( x ) ? K ( x )ω n + 1 ( x ) = 0

i = 0,1, L, n

? ( x) = 0 , ? ( xi ) = 0 , i = 0,1,2,L , n

? ( n +1) (ξ ) = 0

? (t ) = f (t ) ? Pn (t ) ? K ( x)ω n +1 (t )

( ? ( n+1) (t ) = f ( n +1) (t ) ? Pn( n +1) (t ) ? K ( x)ω nn +1) (t ) +1 ( + ? ( n +1) (ξ ) = f ( n +1) (ξ ) ? Pn( n +1) (ξ ) ? K ( x)ω nn 11) (ξ ) +

= f ( n +1) (ξ ) ? K ( x) ? (n + 1)! = 0
5

f ( n +1) (ξ ) K ( x) = (n + 1)!

f ( n +1) (ξ ) Rn ( x) = K ( x)ω n +1 ( x) = ω n +1 ( x) (n + 1)!

n次插值多项式 , 插值节点为{ xi } in= 0 ? [ a , b ], 则?x ∈ [ a , b ], 有

f ( n +1) (ξ ) Rn (x ) = ω n +1 ( x) (n + 1)!
n

Lagrange型余项

i =0

M n + 1 = max| f ( n + 1 ) ( x )|
a ≤ x ≤b

N n + 1 = ω n + 1 ( x )|= ∏ ( x ? xi )| | |
i =0

n

f ( n + 1 ) (ξ ) ω n + 1 ( x) | Rn ( x )| = (n ( n + 1)!
1 ≤ M n+1 Nn+1 ( n + 1)!

7

f ′( x ) =

1 2 x
169 ≤ x ≤ 225

3 1 ?2 f ′′( x ) = ? x 4

5 3 ?2 f ′′′( x ) = x 8

M 2 = max | f ′′( x )| = f ′′(169 )| ≤ 1.14 × 10 ?4 |

M 3 = max | f ′′′( x )|= f ′′′(144 )|≤ 1.51 × 10 ?6 |
144 ≤ x ≤ 225

N 2 = ω 2 ( x )| = (175 ? 169 )(175 ? 225)| = 300 | |
N 3 = ω 3 ( x )| = (175 ? 144 )(175 ? 169 )(175 ? 225 )|= 9300 | |

1 1 ≤ M 2 N 2 ≤ × 1.14 × 10 ? 4 × 300 ≤ 1.71 × 10 ?2 | R1 ( x )| 2! 2
1 1 | R2 ( x )| ≤ M 3 N 3 ≤ × 1.51 × 10 ? 6 × 9300 ≤ 2.35 × 10 ?3 3! 6

1 例2. 设函数 f ( x ) = 1 + x 2 , x ∈ [ ?5 ,5] 10 将[ ?5 ,5]n等份取n + 1个节点xi = ?5 + ih , h = , i = 0 ,1,L , n n

1 yi = f ( xi ) = 1 + xi2

? ? n ( x ? xi ) ? ? 1 ? Ln ( x ) = ∑ ? 1 + x 2 ∏ ( x j ? xi ) ? j =0 i =0 j ? ? i≠ j ? ?
n

n = 2 ,4 ,6 ,8 ,10
10

%lagrangen.m function y=lagrangen(x0,y0,x) n=length(x0);m=length(x); for i=1:m z=x(i);s=0; for k=1:n Lagrange插值多项式 L=1; 求插值的Matlab程序. for j=1:n if j~=k L=L*(z-x0(j))/(x0(k)-x0(j)); end end s=s+L*y0(k); end y(i)=s; end y;华长生制作 11

%Chazhibijiao.m x=-5:0.1:5;z=0*x;y=1./(1+x.^2); plot(x,z,'k',x,y,'r') axis([-5 5 -1.5 2]);pause,hold on for n=2:2:10 x0=linspace(-5,5,n+1); y0=1./(1+x0.^2); x=-5:0.1:5; y1=lagrangen(x0,y0,x); plot(x,y1), pause end y2=1./(1+x0.^2);y=interp1(x0,y2,x); plot (x,y,'k'),hold off gtext('n=2'),gtext('n=4'),gtext('n=6') gtext('n=8'),gtext('n=10') gtext('f(x)=1/(1+x^2)')

2

f(x )= 1/(1+ x 2 ) n= 10

1.5

1

n= 2 n= 4

0.5

0 n= 6 -0.5 n= 8 -1

-1.5 -5

-4

-3

-2

-1 0 1 Runge现象

2

3

4

5

13

14