Newtons Divided Difference Polynomial Textbook Notes

advertisement
4.3 Newton’s Divided Difference Interpolation
Polynomial interpolation involves finding a polynomial of order n that passes
through the n+1 points. One of the methods is called the Newton’s divided
difference polynomial method. Other methods include the direct method and the
Lagrangian interpolation method. We discuss the Newton’s divided difference
polynomial method in this section.
Newton’s Divided Difference Interpolating Polynomial Method
To illustrate this method, linear and quadratic interpolation is presented first.
Then, the general form of the Newton’s Divided Difference Polynomial method
is presented. To illustrate the general form, cubic interpolation is shown.
4.3.1 Linear Interpolation: Given ( x0 , y0 ), ( x1 , y1 ), fit a linear interpolant
through the data. Noting y 0  f ( x0 ) and y1  f ( x1 ) , assume the linear
interpolant, f1 ( x) is given by f1 ( x)  b0  b1 ( x  x0 )
Chapter 4
y
(x1, y1)
f1(x)
(x0, y0)
x
Figure 1. Linear Interpolation
Since at x  x0 ,
f1 ( x0 )  f ( x0 )  b0  b1 ( x0  x0 )  b0 ,
and at x  x1 ,
f1 ( x1 )  f ( x1 )  b0  b1 ( x1  x0 )
 f ( x0 )  b1 ( x1  x0 )
giving
b1 
f ( x1 )  f ( x0 )
x1  x0
So
b0  f ( x0 )
b1 
f ( x1 )  f ( x0 )
x1  x0
2
Newton’s Divided Difference Interpolation
giving the linear interpolant to be
f1 ( x)  b0  b1 ( x  x0 )
f 1 ( x)  f ( x0 ) 
f ( x1 )  f ( x0 )
( x  x0 )
x1  x0
Example 1:
Thermistors are used to measure temperature of bodies. Thermistors are
based on materials’ change in resistance with temperature. To measure
temperature, manufacturers provide you with a temperature vs. resistance
calibration curve. If you measure resistance, you can find the temperature. A
manufacturer of thermistors makes the following observations on a thermistor,
Table 1. Resistance as a function of temperature
R
T
[Ohm] [ C ]
1101.0 25.113
911.3
30.131
636.0
40.120
451.1
50.128
3
Chapter 4
1200
R [Ohms] 800
400
20
30
40
50
T [ oC ]
Figure 2. The resistance versus temperature.
Determine the temperature corresponding to 754.8 ohms using Newton’s Divided
Difference method and a first order polynomial.
Solution:
For the first order polynomial (also called linear interpolation), we choose
the temperature given by
T ( R)  b0  b1 ( R  R0 )
Since we want the temperature at R  754.8 , we choose two data points that are
closest to R  754.8 and that also bracket R  754.8 . Those two points are
R  911.3 and R  636.0 .
R0  911.3, T ( R0 )  30.131
R1  636.0, T ( R1 )  40.120
gives
b0  T ( R0 )
4
Newton’s Divided Difference Interpolation
 30.131
T (R 1 ) T (R 0 )
b1 
R1  R 0
40.120  30.131

636.0  911.3
 0.036284
Hence
T ( R)  b0  b1 ( R  R0 )
 30.131  0.036284( R  911.3), 636.0  R  911.3
At R  754.8
T (754.8)  30.131  0.036284(754.8  911.3)
 35.809C
If we expand
T ( R)  30.131  0.036284( R  911.3), 636.0  R  911.3
we get
T ( R)  63.197  0.036284 R, 636.0  R  911.3
and this is the same expression as obtained in the direct method.
4.3.2 Quadratic Interpolation: Given ( x0 , y0 ), ( x1 , y1 ), and ( x2 , y2 ), fit a
quadratic interpolant through the data. Noting y  f (x), y 0  f ( x0 ), y1  f ( x1 ),
and y2  f ( x2 ), assume the quadratic interpolant f 2 ( x) given by
f 2 ( x)  b0  b1 ( x  x0 )  b2 ( x  x0 )( x  x1 )
At x  x0
f ( x0 )  f 2 ( x0 )  b0  b1 ( x0  x0 )  b2 ( x0  x0 )( x0  x1 )
 b0
b0  f ( x0 )
At x  x1
f ( x1 )  f 2 ( x1 )  b0  b1 ( x1  x0 )  b2 ( x1  x0 )( x1  x1 )
f ( x1 )  f ( x0 )  b1 ( x1  x0 )
giving
f ( x1 )  f ( x0 )
b1 
x1  x0
At x  x2
5
Chapter 4
f ( x2 )  f 2 ( x2 )  b0  b1 ( x2  x0 )  b2 ( x2  x0 )( x2  x1 )
f ( x 2 )  f ( x0 ) 
f ( x1 )  f ( x0 )
( x2  x0 )  b2 ( x2  x0 )( x2  x1 )
x1  x0
giving
f ( x 2 )  f ( x1 ) f ( x1 )  f ( x0 )

x 2  x1
x1  x0
b2 
x 2  x0
Hence the quadratic interpolant is given by
f 2 ( x)  b0  b1 ( x  x0 )  b2 ( x  x0 )( x  x1 )
f ( x 2 )  f ( x1 ) f ( x1 )  f ( x0 )

f ( x1 )  f ( x0 )
x 2  x1
x1  x0
f 2 ( x)  f ( x0 ) 
( x  x0 ) 
( x  x0 )( x  x1 )
x1  x0
x 2  x0
y
(x1, y1)
(x2, y2)
f2 (x)
x
(x0, y0)
Figure 3. Quadratic interpolation
6
Newton’s Divided Difference Interpolation
Example 2:
Thermistors are used to measure temperature of bodies. Thermistors are
based on materials’ change in resistance with temperature. To measure
temperature, manufacturers provide you with a temperature vs. resistance
calibration curve. If you measure resistance, you can find the temperature. A
manufacturer of thermistors makes the following observations on a thermistor,
Table 2. Resistance as a function of temperature
R
T
[Ohm] [ C ]
1101.0 25.113
911.3
30.131
636.0
40.120
451.1
50.128
Determine the temperature corresponding to 754.8 ohms using Newton’s
Divided Difference method and a second order polynomial. Find the absolute
relative approximate error for the second order polynomial approximation.
Solution:
For second order polynomial interpolation (also called quadratic
interpolation), we choose the temperature given by
T ( R)  b0  b1 ( R  R0 )  b2 ( R  R0 )( R  R1 )
Since we want to find the temperature at R  754.8, we need to choose three
data points that are closest to R  754.8, and also bracket R  754.8 . These
three points are R0  911.3, R1  636.0, and R2  451.1 .
R0  911.3, T ( R0 )  30.131
R1  636.0, T ( R1 )  40.120
R2  451.1, T ( R2 )  50.128
then
7
Chapter 4
b0  T ( R0 )
 30.131
T ( R1 )  T ( R0 )
b1 
R1  R0
40.120  30.131

636.0  911.3
 0.036284
T ( R2 )  T ( R1 ) T ( R1 )  T ( R0 )

R2  R1
R1  R0
b2 
R 2  R0
50.128  40.120 40.120  30.131

636.0  911.3
 451.1  636.0
451.1  911.3
 0.054127  0.036284

 460.2
 3.8771  10 5
then
T ( R)  b0  b1 ( R  R0 )  b2 ( R  R0 )( R  R1 )
 30.131  0.036284( R  911.3)  3.8771  10 5 ( R  911.3)( R  636.0),
451.1  R  911.3
At R  754.8,
T (754.8)  30.131  0.036284(754.8  911.3)  3.8771  10 5 (754.8  911.3)(754.8  636.0)
 35.089C
The absolute relative approximate error a obtained between the results from the
first and second order polynomial is
a 
35.089  35.809
 100
35.089
 2.0544%
8
Newton’s Divided Difference Interpolation
If we expand,
T ( R)  30.131  0.036284( R  911.3)  3.8771  10 5 ( R  911.3)( R  636.0),
451.1  R  911.3
we get
T R   85.668  0.09627 R  3.8771  10 5 R 2 , 451.1  R  911.3
This is the same expression obtained by the direct method.
General Form of Newton’s Divided Difference Polynomial
In the two previous cases, we found how linear and quadratic interpolation
is derived by Newton’s Divided Difference polynomial method. Let us revisit
the quadratic polynomial interpolant formula
f 2 ( x)  b0  b1 ( x  x0 )  b2 ( x  x0 )( x  x1 )
where
b0  f ( x0 )
f ( x1 )  f ( x0 )
x1  x0
f ( x 2 )  f ( x1 ) f ( x1 )  f ( x0 )

x 2  x1
x1  x0
b2 
x 2  x0
b1 
Note that b0 , b1 , and b2 are finite divided differences. b0 , b1 , and b2 are
first, second, and third finite divided differences, respectively. Denoting first
divided difference by
f [ x0 ]  f ( x0 )
the second divided difference by
f ( x1 )  f ( x0 )
f [ x1 , x0 ] 
x1  x0
and the third divided difference by
9
Chapter 4
f [ x2 , x1 ]  f [ x1 , x0 ]
x 2  x0
f ( x 2 )  f ( x1 ) f ( x1 )  f ( x0 )

x 2  x1
x1  x0

x 2  x0
f [ x2 , x1 , x0 ] 
where f [ x0 ], f [ x1 , x0 ], and f [ x2 , x1 , x0 ] are called bracketed functions of their
variables enclosed in square brackets.
Rewriting
f 2 ( x)  f [ x0 ]  f [ x1 , x0 ]( x  x0 )  f [ x2 , x1 , x0 ]( x  x0 )( x  x1 )
This leads us to writing the general form of the Newton’s divided difference
polynomial for (n  1) data points, x0 , y0 , x1 , y1 ,......, xn1 , y n1 , xn , y n  as
f n ( x)  b0  b1 ( x  x0 )  ....  bn ( x  x0 )( x  x1 )...( x  xn1 )
where
b0  f [ x0 ]
b1  f [ x1 , x0 ]
b2  f [ x2 , x1 , x0 ]

bn1  f [ xn1 , xn2 ,...., x0 ]
bn  f [ xn , xn1 ,...., x0 ]
where the definition of the m th divided difference is
bm  f [ xm ,........, x0 ]

f [ xm ,........, x1 ]  f [ xm1 ,........, x0 ]
x m  x0
From the above definition, it can be seen that the divided differences are
calculated recursively.
For an example of a third order polynomial, given
( x0 , y0 ), ( x1 , y1 ), ( x2 , y2 ), and ( x3 , y3 ),
10
Newton’s Divided Difference Interpolation
f 3 ( x)  f [ x0 ]  f [ x1 , x0 ]( x  x0 )  f [ x2 , x1 , x0 ]( x  x0 )( x  x1 )
 f [ x3 , x 2 , x1 , x0 ]( x  x0 )( x  x1 )( x  x 2 )
b0
b1
x0
f (x0)
b2
f [x1,x0]
x1
b3
f [x2,x1,x0]
f (x1)
f [x3,x2,x1,x0]
f [x2,x1]
x2
f [x3,x2,x1]
f (x2)
f [x3,x2]
x3
f (x3)
Example 3:
Thermistors are used to measure temperature of bodies. Thermistors are
based on materials’ change in resistance with temperature. To measure
temperature, manufacturers provide you with a temperature vs. resistance
calibration curve. If you measure resistance, you can find the temperature. A
manufacturer of thermistors makes the following observations on a thermistor
Table 3. Resistance as a function of temperature
R
T
[Ohm] [ C ]
1101.0 25.113
911.3
30.131
636.0
40.120
451.1
50.128
11
Chapter 4
a) Determine the temperature corresponding to 754.8 ohms using Newton’s
Divided Difference method and a third order polynomial. Find the
absolute relative approximate error for the third order polynomial
approximation.
b) The actual calibration curve used by industry is given by
1
 b0  b1 (ln R  ln R0 )  b2 (ln R  ln R0 )(ln R  ln R1 )  b3 (ln R  ln R0 )(ln R  ln R1 )(ln R  ln R2 )
T
1
substituting y  , and
T
x  ln R, gives
the calibration curve is given by
y( x)  b0  b1 ( x  x0 )  b2 ( x  x0 )( x  x1 )  b3 ( x  x0 )( x  x1 )( x  x2 )
Table 4. Manipulation for the given data
R
T
x
[Ohm]
[ C ]
ln R
y
1
T
1101.0 25.113 7.0040 0.039820
911.3
30.131 6.8149 0.033188
636.0
40.120 6.4552 0.024925
451.1
50.128 6.1117 0.019949
Find the calibration curve and find the temperature corresponding to 754.8
ohms. What is the difference between the results from part (a)? Is the difference
larger using results from part (a) or part (b), if the actual measured value at 754.8
ohms is 35.285 C ?
12
Newton’s Divided Difference Interpolation
Solution:
a)
For the third order polynomial (also called cubic interpolation), we choose
the temperature given by
T ( R)  b0  b1 ( R  R0 )  b2 ( R  R0 )( R  R1 )  b3 ( R  R0 )( R  R1 )( R  R2 )
Since we wish to find the temperature at R  754.8, we need to choose four data
points that are closest to R  754.8, and bracket R  754.8 . These four data
points are R0  1101.0, R1  911.3, R2  636.0, and R3  451.1
R0  1101.0,
R1  911.3,
T ( R0 )  25.113
T ( R1 )  30.131
R2  636.0, T ( R2 )  40.120
R3  451.1,
T ( R3 )  50.128
then
b0  T [ R0 ]
 T ( R0 )
 25.113
b1  T [ R1 , R0 ]
T ( R1 )  T ( R0 )

R1  R0
30.131  25.113

911.3  1101.0
 0.026452
b2  T [ R2 , R1 , R0 ]
T [ R2 , R1 ]  T [ R1 , R0 ]

R2  R0
T ( R2 )  T ( R1 )
T [ R2 , R1 ] 
R2  R1
40.120  30.131

636.0  911.3
 0.036284
13
Chapter 4
T [ R1 , R0 ]  0.026452
T [ R2 , R1 ]  T [ R1 , R0 ]
R2  R0
 0.036284  0.026452

636.0  1101.0
b2 
 2.1144 * 10 5
T [ R3 , R2 , R1 ]  T [ R2 , R1 , R0 ]
R3  R0
T [ R3 , R2 ]  T [ R2 , R1 ]
T [ R3 , R2 , R1 ] 
R3  R1
T ( R3 )  T ( R2 )
T [ R3 , R2 ] 
R3  R2
50.128  40.120

451.1  636.0
b3 
 0.054127
T ( R2 )  T ( R1 )
T [ R2 , R1 ] 
R2  R1
40.120  30.131

636.0  911.3
 0.036284
T [ R3 , R2 ]  T [ R2 , R1 ]
T [ R3 , R2 , R1 ] 
R3  R1
 0.054127  0.036284

451.1  911.3
 3.8772  10 5
T [ R2 , R1 , R0 ]  2.1144  10 5
b3  T [ R3 , R2 , R1 , R0 ]

T [ R3 , R2 , R1 ]  T [ R2 , R1 , R0 ]
R3  R0
14
Newton’s Divided Difference Interpolation
3.8772  10 5  2.1144  10 5
451.1  1101.0
 2.7124  10 8

Hence
T ( R)  b0  b1 ( R  R0 )  b2 ( R  R0 )( R  R1 )  b3 ( R  R0 )( R  R1 )( R  R2 )
 25.113  0.026452( R  1101.0)  2.1144  10 5 ( R  1101.0)( R  911.3)
 2.17124  10 8 ( R  1101.0)( R  911.3)( R  636.0)
At R  754.8,
T (754.8)  25.113  0.026452(754.8  1101.0)  2.1144 *10 5 (754.8  1101.0)(754.8  91
 2.17124  10 8 (754.8  1101.0)(754.8  911.3)(754.8  626.0)
 35.242C
The absolute percentage relative approximate error, a for the value obtained for
T(754.8) between second and third order polynomial is
a 
35.242  35.089
 100
35.242
 0.43458%
b)
Finding the cubic interpolant using Newton’s Divided Difference for
y( x)  b0  b1 ( x  x0 )  b2 ( x  x0 )( x  x1 )  b3 ( x  x0 )( x  x1 )( x  x2 )
x
ln R
y
1
T
7.0040 0.039820
6.8149 0.033188
6.4552 0.024925
6.1117 0.019949
15
Chapter 4
We get,
xo  7.0040, yxo   0.039820
x1  6.8149, yx1   0.033188
x2  6.4552, yx2   0.024925
x3  6.1117, yx3   0.019949
then
b0  y[ x0 ]
 y ( x0 )
 0.039820
b1  y[ x1 , x0 ]
y( x1 )  y( x0 )

x1  x0
0.033188  0.039820

6.8149  7.0040
 0.035071
b2  y[ x2 , x1 , x0 ]
y[ x2 , x1 ]  y[ x1 , x0 ]
x 2  x0
y( x2 )  y( x1 )
y[ x2 , x1 ] 
x2  x1
0.024925  0.033188

6.4552  6.8149

 0.022972
y[ x1 , x0 ]  0.035071
b2 
y[ x2 , x1 ]  y[ x1 , x0 ]
x 2  x0
16
Newton’s Divided Difference Interpolation

0.022972  0.035071
6.4552  7.0040
 0.022046
y[ x3 , x2 , x1 ]  y[ x2 , x1 , x0 ]
x3  x 0
y[ x3 , x2 ]  y[ x2 , x1 ]
y[ x3 , x2 , x1 ] 
x3  x1
y ( x3 )  y ( x 2 )
y[ x3 , x2 ] 
x3  x 2
0.019949  0.024925

6.1117  6.4552
b3 
 0.014486
y( x2 )  y( x1 )
y[ x2 , x1 ] 
x2  x1
0.024925  0.033188

6.4552  6.8149
 0.022972
y[ x3 , x2 ]  y[ x2 , x1 ]
y[ x3 , x2 , x1 ] 
x3  x1
0.014486  0.022972

6.1117  6.8149
 0.012068
y[ x2 , x1 , x0 ]  0.022046
b3  y[ x3 , x2 , x1 , x0 ]
y[ x3 , x2 , x1 ]  y[ x2 , x1 , x0 ]
x3  x 0
0.012068  0.022046

6.1117  7.0040
 0.011182

Hence
17
Chapter 4
y( x)  b0  b1 ( x  x0 )  b2 ( x  x0 )( x  x1 )  b3 ( x  x0 )( x  x1 )( x  x2 )
 0.039820  0.035071( x  7.0040)  0.022972( x  7.0040)( x  6.8149)
 0.011182( x  7.0040)( x  6.8149)( x  6.4552), 6.1117  x  7.0040
Since we’re looking for the temperature at R=754.8, we will be using
x  ln 754.8
 6.6265
At x  6.6265,
y (6.6265)  0.039820  0.035071(6.6265  7.0040)  0.022972(6.6265  7.0040)(6.6265  6.8149)
 0.011182(6.6265  7.0040)(6.6265  6.8149)(6.6265  6.4552)
 0.028350
Finally, since y 
1
,
T
1
y
T

1
0.028350
 35.274C
Since the actual measured value at 754.8 ohms is 35.285 C , the absolute relative
true error between the value used for part (a) is
t 
35.285  35.242
 100
35.285
 0.12186%
and for part (b) is
t 
35.285  35.274
 100
35.285
 0.03117%
18
Newton’s Divided Difference Interpolation
Therefore, the calibration curve of
1
 b0  b1 (ln R  ln R0 )  b2 (ln R  ln R0 )(ln R  ln R1 )  b3 (ln R  ln R0 )(ln R  ln R1 )(ln R  ln R2 )
T
obtained more accurate results than a cubic polynomial interpolant given by
Newton’s Divided Difference method, that is,
T ( R)  b0  b1 ( R  R0 )  b2 ( R  R0 )( R  R1 )  b3 ( R  R0 )( R  R1 )( R  R2 ) .
19
Download