Académique Documents
Professionnel Documents
Culture Documents
l in ( x )
i 1, 2, 3, ..., n
(3.1.1)
l in (x) is a polynomial with degree no greater than n 1 . Its value at any data
point x k within the data set is either 1 or 0
l in ( x k )
xk x j
1,
x xj
j 1, j i i
for i k
(3.1.2)
l in ( x k )
xk x j
0,
x xj
j 1, j i i
for i k
(3.1.3)
which is equivalent to
1, i k
0, i k
l in ( x k ) ik
(3.1.4)
p n 1 ( x ) y i l in ( x )
(3.1.5)
i 1
i 1
i 1
p n1 ( x k ) y i l in ( x k ) y i ik y k ,
k 1, 2, , n
(3.1.6)
2
For the simplest case where n 2 , there are only two data points and p1 ( x) is a
linear function which passes through the two data points. Thus, p1 ( x) is just a straight
line with its two end points being the two data points. From (3.1.6), we have
p1 ( x ) y1
x x2
x x1
y y1
y2
y1 2
( x x1 )
x1 x 2
x 2 x1
x 2 x1
(3.1.7)
( x x 2 )( x x 3 )
( x x1 )( x x 3 )
( x x1 )( x x 2 )
y2
y3
( x1 x 2 )( x1 x 3 )
( x 2 x1 )( x 2 x 3 )
( x 3 x1 )( x 3 x 2 )
(3.1.8)
p n ( x ) p n1 ( x ) c n ( x x i )
i 1
(3.2.1)
3
p (x
) p n1 ( x n1 ) y n1 p n1 ( x n1 )
c n n n1
( x n1 x i )
(3.2.2)
( x n1 x i )
i 1
i 1
1
0
0
2
5
2
3
7
-1
4
8
-2
5
10
20
Step1: for i 1
p 0 ( x ) c 0 y1 0
4
Applying p 3 ( x 4 ) y 4 , we get c3 0.0548 . So
p 3 ( x ) p 2 ( x ) 0.0548 x ( x 5)( x 7)
If we expand the recursive form, the r.h.s of Equation (3.2.1), we obtain the more
familiar form of a polynomial
p n 1 ( x) c 0 c1 ( x x1 ) c 2 ( x x1 )( x x 2 ) c n ( x x1 )( x x 2 ) ( x x n )
(3.2.3)
which is called the Newtons interpolation polynomial. Its constants can be determined
from the data set: ( xi , y i , i 1, 2, , n )
p 0 ( x 1 ) y1 c 0
p1 ( x 2 ) y 2 c 0 c1 ( x 2 x1 )
(3.2.4)
p 2 ( x 3 ) y 3 c 0 c1 ( x 3 x1 ) c 2 ( x 3 x1 )( x 3 x 2 )
which gives
c 0 y1
y c
y y1
c1 2 0 2
x 2 x1 x 2 x 1
y c c ( x x1 )
c2 3 0 1 3
( x 3 x1 )( x 3 x 2 )
(3.2.5)
We should note that forcing the polynomial through data with no regard for rates
of change in the data (i.e., derivatives) results in a C 0 continuous interpolating
polynomial. Alternatively, each data condition p ( xi ) y i is called a C 0 constraint.
Lets use the following notation for these constants
5
c 0 [ x 1 ] y y1
c1 [ x 1 , x 2 ] y
[ x 2 ] y [ x1 ] y
x 2 x1
c i 1 [ x1 , x 2 x i ] y ,
i 1, 2,
(3.2.6)
[ x 2 , x 3 x i ] y [ x1 , x 2 x i 1 ] y
x i x1
(3.2.7)
so that it is called the divided difference. For the proof of this formula, please refer to
Gautschi (1997), but for example:
x1 , x 2 y y 2 y1 , x1 , x 2 , x 3 y x 2 , x 3 y x1 , x 2 y , etc. Using this recursion
x 2 x1
x 3 x1
property, a table of divided differences can be generated as follows
x1
x2
x3
x4
y1
y 2 [ x1 x 2 ] y
y 3 [ x 2 x 3 ] y [ x1 x 2 x 3 ] y
y 4 [ x 3 x 4 ] y [ x 2 x 3 x 4 ] y [ x1 x 2 x 3 x 4 ] y
(3.2.8)
This table can be viewed as part of an n (n 1) matrix for a data set that has n
points. The first column is the x values of the data set and the second column is the y or
function values of the data set. For the rest of the ( n 1) ( n 1) lower triangle, the rule
for the construction of its elements, say, element(i, j), is as follows
(1) It takes the form of a division ( j 3, i j 1 )
element ( i , j )
element ( i , j 1) element ( i 1, j 1)
element ( i , 1) element ( i j 2, 1)
(3.2.9)
where
Element(i, j-1) is the element in the matrix immediately left of element(i, j);
Element(i-1, j-1) is the element above and immediately left;
Element(i, 1) is the x on the same row;
Element(i-j+2, 1). To find it, going from element(i, j) diagonally upward and leftward,
when reaching the second column, it is the element to the left.
(2) The denominator is easier to see in this form:
6
[ xk xl xq ] y
Example 3.2.2. Using the table of divided differences, construct the Newton interpolating
polynomial for the data set in Example 3.2.1.
0
10
20
20
0 .4
50
1 2
1 . 5
75
2 1
1
87
20 2
11
10 8
1 .5 0 .4
0.271
70
1 1 .5
0.167
85
11 1
4
10 7
0.167 0.271
0.055
80
4 0.167
0.767
10 5
0.767 0.055
0.071
10 0
where the number of decimal digits is reduced so that the table fits the page here. The
bracketed terms <> are the coefficients of the Newton polynomial. Then
p 4 ( x) 0 0.4 x 0.2714 x( x 5) 0.0548 x( x 5)( x 7) 0.0712 x( x 5)( x 7)( x 8)
0 x (0.4 ( x 5)( 0.2714 ( x 7)(0.0548 ( x 8)0.0712)))
The second line above is called a nested form that can save computation operations and
produces a more accurate solution numerically. Note in passing how similar this table is
to Romberg quadrature (or Richardsons extrapolation), only in here the formula for
calculating the rightmost terms is a simple ratio of differences.
A MATLAB code newton_example.m is written to incorporate the divided
difference scheme and calculate the Newton interpolation polynomial using the nested
form. The algorithm is as follows
(1) Input and plot data set points;
(2) Declare c(n, n + 1) as the matrix for the table; Note: c = element in Equation
(3.2.9);
(3) c(i, 1) x; c(i, 2) y;
(4) Calculate the rest of the table due to Equation (3.2.9);
(5) Calculate the polynomial using c(i, i +1) as the coefficients of the polynomial.
Figure 3.2.1 shows the resulting polynomial for the above example.
7
Newton Interpolating Polynomial
20
data points
Newton Polynomial
15
10
5
0
-5
-10
-2
10
12
Through the above example, we can see the advantages of the divided difference
table over the algebraic approach we have in Example 3.2.1. First, it has less
computational operations. We do not need to write the polynomial and then use the C0
condition to calculate the constants. Second, it is much easier to incorporate it in a
computer code.
It is important to realize that both the Lagrange and Newton polynomials are C0
continuous and each would generate the same result. One effect of C0 continuity can be
seen in the large dip that occurs between the first two data points in the figure. Should it
really be there?
(3.3.1)
This clearly is not what the Newton interpolation is meant for, but we can employ it as
follows: approximate y by using the divided difference between two points, then letting
one approach the other in the limit. For example, if y(xi) is used, consider adding another
point xm. Letting these two points converge to one point, we obtain
[ xi x m ] y
y m yi
y ( xi ), as x m xi
x m xi
y1
y1
y2
y2
y1
[ x1 x 2 ] y [ x1 x1 x 2 ] y
y 2
[ x1 x 2 x 2 ] y [ x1 x1 x 2 x 2 ] y
The tables for the four cases are best determined by hand. Then substitution of the
diagonal values for the ci s and for the x i s into Equation 3.3.1 yield the polynomials.
The results are:
9
Case 1 :
0
y ( x ) 1 0 x 1x 2 2 x 2 ( x 1) 2 x 3 3 x 2 1
Case 2 :
0 0
0
y ( x ) 0 1x 1x 2 1x 2 ( x 1) x 3 2 x 2 x
Case 3 :
0
y ( x ) 0 0 x 1x 2 2 x 2 ( x 1) 2 x 3 3 x 2
Case 4 :
0 0
0
y ( x) 0 0 x 0 x 2 1x 2 ( x 1) x 3 x 2
10
0.8
0.4
0.6
0.8
0.4
0.2
0
case 1
-0.2
0.5
x
-0.4
case 2
0
0.5
x
0.5
x
0.8
0.6
0.8
0.4
0.6
0.2
0
0.4
0.2
data points
Hermite Polynomial
0.6
case 3
-0.2
0
0
0.2
0.5
x
-0.4
case 4
0
x3
x2
N 2 ( x) 2 2
x
L
L
x
x
N 3 ( x) 2( ) 3 3( ) 2
L
L
3
2
x
x
N 3 ( x) 2
L
L
(3.3.2)
(3.3.3)
(3.3.4)
(3.3.5)
(3.3.6)
where the subscripts associate quantities with positions (or nodes) 1 and 2 on the beam
and Wi , i , i 1, 2, are the deflection and slope, respectively, at each node.
11
x/L
Figure 3.3.2 Static bending modes N1 and N3 in a beam.
Can you physically explain why N1 + N3 = 1 for all x in Figure 3.3.2? And why N2 +
N4 1?
References
Gautschi, Walter, Numerical Analysis, Birkhauser, Boston, 1997.