Professional Documents
Culture Documents
18.1 - Newton's Divided-Difference Interpolating
18.1 - Newton's Divided-Difference Interpolating
18.1 - Newton's Divided-Difference Interpolating
NEWTON’S DIVIDED-
DIFFERENCE
INTERPOLATING
POLYNOMIALS
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
Applications
X Y X f(x)
Sometimes we need to estimate intermediate 2.1 99.0 x1 f(x1)
values between precise data points.
3.7 23.56 x2 f(x2)
(𝑥 ¿ ¿ 1 , 𝑓 ( 𝑥 1 ) )¿
𝑓 ( 𝑥1 ) − 𝑓 ( 𝑥 0 ) 𝑝1 ( 2 ) − 𝑙𝑛 ( 1 ) 𝑙𝑛 ( 6 ) − 𝑙𝑛 ( 1 )
=
𝑝 1 ( 𝑥 )=
𝑥1− 𝑥0
( 𝒙 − 𝑥0)+ 𝒇 ( 𝑥0) 2 −1 6 −1
𝑝1 ( 𝑥 ) − 𝑓 ( 𝑥 0 ) 𝑓 ( 𝑥1 ) − 𝑓 ( 𝑥 0 ) 𝑝1 ( 2 ) 1 . 791759
= =
1 5
𝑥 − 𝑥0 𝑥1− 𝑥0
= 0.3583519
The notation designates that this is a
first order interpolating polynomial.
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
Quadratic Interpolation 𝑓 (𝑥 )
(𝑥 ¿ ¿ 0 , 𝑓 ( 𝑥 0 ) )¿
(𝑥 ¿ ¿ 2 , 𝑓 ( 𝑥 2 ) )¿
(𝑥 ¿ ¿ 1 , 𝑓 ( 𝑥 1 ) )¿
𝒃 𝟎= 𝒇 ( 𝑥 0 )
𝑝 2 ( 𝑥0 ) = 𝑓 ( 𝑥 0 )
𝑓 ( 𝑥1 ) − 𝑓 ( 𝑥0 )
𝑝 2 ( 𝑥1 ) = 𝑓 ( 𝑥1 ) 𝒃 𝟏=
𝑥1 − 𝑥 0
𝑝 2 ( 𝑥2 ) = 𝑓 ( 𝑥 2 ) 𝑓 ( 𝑥 2 ) − 𝑓 ( 𝑥2 ) 𝑓 ( 𝑥1) − 𝑓 ( 𝑥0)
−
𝑥 2 − 𝑥1 𝑥1 − 𝑥 0
𝒃 𝟐=
𝑥2 − 𝑥0
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
𝑓 [ 𝑥 𝑛 , 𝑥𝑛 − 1 , ⋯ , 𝑥 1 ] − 𝑓 [ 𝑥 𝑛 −1 , ⋯ , 𝑥 1 , 𝑥0 ]
𝑓 [ 𝑥 𝑛 , 𝑥𝑛 − 1 , ⋯ , 𝑥 1 , 𝑥 0 ] =
𝑥 𝑛 − 𝑥0
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
Definition:
= second finite divided difference
𝑓 [ 𝑥 𝑛 , 𝑥𝑛 − 1 , ⋯ , 𝑥 1 ] − 𝑓 [ 𝑥 𝑛 −1 , ⋯ , 𝑥 1 , 𝑥0 ]
𝑓 [ 𝑥 𝑛 , 𝑥𝑛 − 1 , ⋯ , 𝑥 1 , 𝑥 0 ] =
𝑥 𝑛 − 𝑥0
nth finite divided difference
𝑝 2 ( 𝑥 )= 𝒃𝟎 + 𝒃𝟏 ( 𝒙 − 𝑥 0 ) + 𝒃𝟐 ( 𝒙 − 𝑥 0 ) ( 𝒙 − 𝑥 1 )
𝑝 2 ( 𝑥 )= 𝒇 [ 𝒙 𝟎 ]+ 𝒇 [ 𝒙 𝟏 , 𝒙 𝟎] ( 𝒙 − 𝑥 0 ) + 𝒇 [ 𝒙 𝟐 , 𝒙 𝟏 , 𝒙 𝟎] ( 𝒙 − 𝑥 0 ) ( 𝒙 − 𝑥 1 )
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
Example
Fit a second-order polynomial to the three points
1= 1=
2= 8=
4= 14=
𝒇 [ 𝒙𝟏 ] − 𝒇 [ 𝒙 𝟎 ] 𝟖 −𝟏
𝒇 [ 𝒙𝟏 , 𝒙 𝟎 ]= = =𝟕
𝒙𝟏 − 𝒙 𝟎 𝟐 −𝟏
𝒇 [ 𝒙𝟐 , 𝒙 𝟏 ] − 𝒇 [ 𝒙 𝟏 , 𝒙 𝟎 ] 𝟑− 𝟕 𝟒
𝒇 [ 𝒙𝟐 , 𝒙 𝟏 , 𝒙 𝟎 ]= = =−
𝒙𝟐− 𝒙𝟎 𝟒 −𝟏 𝟑
𝒇 [ 𝒙 𝟐 ] − 𝒇 [ 𝒙 𝟏 ] 𝟏𝟒 −𝟖
𝒇 [ 𝒙𝟐 , 𝒙 𝟏 ]= = =𝟑
𝒙𝟐 − 𝒙𝟏 𝟒 −𝟐
𝑝 2 ( 𝑥 )= 𝒇 [ 𝒙 𝟎 ]+ 𝒇 [ 𝒙 𝟏 , 𝒙 𝟎] ( 𝒙 − 𝑥 0 ) + 𝒇 [ 𝒙 𝟐 , 𝒙 𝟏 , 𝒙 𝟎] ( 𝒙 − 𝑥 0 ) ( 𝒙 − 𝑥 1 )
𝟒
𝑝 2 ( 𝑥 )=𝟏 +𝟕 ( 𝒙 − 1 ) − ( 𝒙 −1) ( 𝒙 −2)
𝟑
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
𝑓 [ 𝑥 𝑛 , 𝑥𝑛 − 1 , ⋯ , 𝑥 1 ] − 𝑓 [ 𝑥 𝑛 −1 , ⋯ , 𝑥 1 , 𝑥0 ]
𝑓 [ 𝑥 𝑛 , 𝑥𝑛 − 1 , ⋯ , 𝑥 1 , 𝑥 0 ] =
𝑥 𝑛 − 𝑥0
nth finite divided difference
notice how divided differences are recursive that is, higher-order differences are
computed by taking differences of lower-order differences.
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
Example
1 3 Calculate f (4) using Newton’s
Given the data 2 6 interpolating polynomials of
3 19 order 1 through 3.
5 99
Example
1 3 Calculate f (4) using Newton’s
Given the data 2 6 interpolating polynomials of
3 19 order 1 through 3.
5 99
Example
x f (x)
Complete the divided difference table for 1.0 0.7651977
the data given in the adjacent Table and 1.3 0.6200860
construct the interpolating polynomial that 1.6 0.4554022
1.9 0.2818186
uses all this data. 2.2 0.1103623
4 2.2 0.1103623
4 2.2 0.1103623
data=[1.0 0.7651977;
function [d]=Divided_diff(x,y) 1.3 0.6200860;
d=y; 1.6 0.4554022;
n=length(x); 1.9 0.2818186;
for j=2:n 2.2 0.1103623];
for k=n:-1:j
d(k)=(d(k)-d(k-1))/(x(k)-x(k-j+1)); x =data(:,1);
end y=data(:,2);
end [d]=Divided_diff(x,y);
d
4 2.2 0.1103623
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
Example
1 3 Write the Newton’s
Given the data 2 6 interpolating polynomials of
3 19 order 4.
5 99
7 291
Example
1 3 Write the Newton’s
Given the data 2 6 interpolating polynomials of
3 19 order 4.
5 99
7 291
𝒑 𝟑 (𝟏𝟎)=1 .000044924225105
True percent relative error = 0.0045%
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
Example
Problem 18.2 pp522 x=[0 pi/2 pi 3*pi/2 2*pi];
y=sin(x);
Fit a 4th-order Newton’s [d]=Divided_diff(x,y);
interpolating polynomial to xx=[0:0.1:2*pi];
approximate sin(x) using the [yy] = eval_poly(x,d,xx);
data at x = 0, pi/2, pi, 3*pi/2 and ezplot('sin(x)',[0,2*pi]); grid on; hold on
2*pi. Plot sin(x) and . plot(xx,yy); plot(x,y,'k*'); hold off
𝒚 =𝐬𝐢𝐧 ( 𝒙)
𝒑 𝟒( 𝒙)
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
𝑝 𝑛 ( 𝑥 ) = 𝒇 [ 𝒙 𝟎 ] + 𝒇 [ 𝒙 𝟏 , 𝒙 𝟎 ] ( 𝒙 − 𝑥 0 ) + ⋯ + 𝒇 [ 𝒙 𝒏 , ⋯ , 𝒙 𝟎 ] ( 𝒙 − 𝑥 0 ) ⋯ ( 𝒙 − 𝑥 𝑛 −1 )
𝑓 ( 𝑥 ) −𝑝 𝑛 ( 𝑥 ) = 𝑹𝒏 ( 𝒙 ) ( 𝑛+ 1 )
𝑓 (𝜉 )
𝑹 𝒏 ( 𝑥)=
(𝑛+1) !
( 𝒙 − 𝑥0 ) ⋯ ( 𝒙 − 𝑥𝑛)
The structure is similar to the Taylor series expansion in the sense that
terms are added sequentially to capture the higher-order behavior.
( 𝒏 +𝟏 )
Taylor series 𝒇 (𝝃 )
𝑹 𝒏 ,𝑻𝒂𝒚𝒍𝒐𝒓 = ( 𝒙 − 𝒙 𝒊 ) 𝒏+𝟏
(𝒏+𝟏) !
𝒇 ′ ( 𝒙𝒊) 𝒇 ( 𝒏) ( 𝒙 𝒊 )
𝒇 ( 𝒙 ) = 𝒇 ( 𝒙𝒊 ) + ( 𝒙 − 𝒙 𝒊 ) +… + ( 𝒙 − 𝒙 𝒊 )𝒏 + 𝑹𝒏 , 𝑻𝒂𝒚𝒍𝒐𝒓
𝟏! 𝒏!
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
𝑝 𝑛 ( 𝑥 ) = 𝒇 [ 𝒙 𝟎 ] + 𝒇 [ 𝒙 𝟏 , 𝒙 𝟎 ] ( 𝒙 − 𝑥 0 ) + ⋯ + 𝒇 [ 𝒙 𝒏 , ⋯ , 𝒙 𝟎 ] ( 𝒙 − 𝑥 0 ) ⋯ ( 𝒙 − 𝑥 𝑛 −1 )
𝑓 ( 𝑥 ) =𝑝 𝑛 ( 𝑥 ) + 𝑹 𝒏 ( 𝒙 )
( 𝑛 +1 )
𝑓 (𝜉 )
𝑹 𝒏 ( 𝒙 )=
(𝑛+ 1) !
( 𝒙 − 𝑥0 ) ⋯ ( 𝒙 − 𝑥𝑛 )
𝑹 𝒏 ( 𝒙 )= 𝒇 [ 𝒙 , 𝒙 𝒏 , ⋯ , 𝒙 𝟎 ] ( 𝒙 − 𝑥 0 ) ⋯ ( 𝒙 − 𝑥 𝑛 )
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
x=[8 9 11]; Because (*) contains the unknown f (10), it cannot be solved
y=log10(x); for the error. However, if an additional data point f () is
0.9031 available, (*) can be used to estimate the error, as in
[d]=Divided_diff(x,y); 0.0512
[yi] = eval_poly(x,d,10) -0.0025
err = yi-1 𝑹 𝟐( 𝟏𝟎)≈ 𝒇 [ 𝟏𝟐 , 𝟏𝟏 , 𝟗 ,𝟖 ] ( 𝟏𝟎 −𝟖 ) (𝟏𝟎 − 𝟗) ( 𝟏𝟎 − 𝟏𝟏 )
𝑹 𝟐 ( 𝟏𝟎 ) ≈ 𝟏 . 𝟒𝟗 𝒆 −𝟒 (𝟏𝟎 − 𝟖 ) (𝟏𝟎 − 𝟗) ( 𝟏𝟎 −𝟏𝟏 )
-2.985e-04
Sec:18.1 NEWTON’S DIVIDED-DIFFERENCE INTERPOLATING POLYNOMIALS
Notation
𝑹 𝒏 ( 𝒙 )= 𝒇 [ 𝒙 , 𝒙 𝒏 , ⋯ , 𝒙 𝟎 ] ( 𝒙 − 𝑥 0 ) ( 𝒙 − 𝑥 1) ⋯ ( 𝒙 − 𝑥 𝑛 − 1) ( 𝒙 − 𝑥 𝑛 )
𝒏 ( 𝒙 )= 𝒇 [ 𝒙 , 𝒙 𝒏 , ⋯ , 𝒙 𝟎 ] ∏ ( 𝒙 − 𝑥 𝑗 )
𝒋=𝟎