Newton's Divided Difference Polynomial Power Point

Download Report

Transcript Newton's Divided Difference Polynomial Power Point

Newton’s Divided Difference
Polynomial Method of
Interpolation
Computer Engineering Majors
Authors: Autar Kaw, Jai Paul
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
http://numericalmethods.eng.usf.edu
1
Newton’s Divided
Difference Method of
Interpolation
http://numericalmethods.eng.usf.edu
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the
value of ‘y’ at a value of ‘x’ that is not given.
3
http://numericalmethods.eng.usf.edu
Interpolants
Polynomials are the most common
choice of interpolants because they
are easy to:
Evaluate
Differentiate, and
Integrate.
4
http://numericalmethods.eng.usf.edu
Newton’s Divided Difference
Method
Linear interpolation: Given ( x , y ), ( x , y
linear interpolant through the data
0
0
1
1
),
pass a
f 1 ( x )  b 0  b1 ( x  x 0 )
where
b0  f ( x 0 )
b1 
5
f ( x1 )  f ( x 0 )
x1  x 0
http://numericalmethods.eng.usf.edu
Example
A robot arm with a rapid laser scanner is doing a quick quality check
on holes drilled in a rectangular plate. The hole centers in the plate that
describe the path the arm needs to take are given below.
If the laser is traversing from x = 2 to x = 4.25 in a linear path, find
the value of y at x = 4 using the Newton’s Divided Difference method for
linear interpolation.
6
x (m)
y (m)
2
4.25
5.25
7.81
9.2
10.6
7.2
7.1
6.0
5.0
3.5
5.0
Figure 2 Location of holes on the
rectangular plate.
http://numericalmethods.eng.usf.edu
Linear Interpolation
7.2
y ( x )  b 0  b1 ( x  x 0 )
7.18
x 0  2 . 00 , y ( x 0 )  7 . 2
7.16
y s
f ( range )
x 1  4 . 25 , y ( x 1 )  7 . 1

f x desired
7.14

7.12
b 0  y ( x 0 )  7 .2
b1 
y (x 1 )  y (x 0 )
x1 x 0
7.2
7.1

7 .1  7 .2
4 . 25  2 . 00
7.1
7.08
5
x s  10
0
0
5
10
x s  range  x desired
  0 . 044444
7
http://numericalmethods.eng.usf.edu
x s  10
1
Linear Interpolation (contd)
y ( x )  b 0  b1 ( x  x 0 )
 7 . 2  0 . 044444 ( x  2 . 00 ),
2 . 00  x  4 . 25
At x  4
7.2
x  4 . 00   7 . 2  0 . 044444  4 . 00  2 . 00 
 7 . 1111 in .
7.2
7.18
7.16
y s
f ( range )

f x desired
7.14

7.12
7.1
7.1
7.08
5
x s  10
0
8
0
5
x s  range  x desired
10
x s  10
1
http://numericalmethods.eng.usf.edu
Quadratic Interpolation
Given ( x 0 , y 0 ), ( x 1 , y 1 ), and ( x 2 , y 2 ), fit a quadratic interpolant through the data.
f 2 ( x )  b 0  b1 ( x  x 0 )  b 2 ( x  x 0 )( x  x 1 )
b0  f ( x 0 )
b1 
f ( x1 )  f ( x 0 )
x1  x 0
f ( x 2 )  f ( x1 )
b2 
9
x 2  x1

f ( x1 )  f ( x 0 )
x1  x 0
x2  x0
http://numericalmethods.eng.usf.edu
Example
A robot arm with a rapid laser scanner is doing a quick quality check
on holes drilled in a rectangular plate. The hole centers in the plate that
describe the path the arm needs to take are given below.
If the laser is traversing from x = 2 to x = 4.25 in a linear path, find
the value of y at x = 4 using the Newton’s Divided Difference method for
quadratic interpolation.
10
x (m)
y (m)
2
4.25
5.25
7.81
9.2
10.6
7.2
7.1
6.0
5.0
3.5
5.0
Figure 2 Location of holes on the
rectangular plate.
http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
y ( x )  b 0  b1 ( x  x 0 )  b 2 ( x  x 0 )( x  x 1 )
x 0  2 . 00 , y ( x 0 )  7 . 2
8
7.56258
x 1  4 . 25 , y ( x 1 )  7 . 1
x 2  5 . 25 , y ( x 2 )  6 . 0
7.5
y s
f ( range )

f x desired
7

6.5
6
6
2
2
11
2.5
3
3.5
4
x s  range  x desired
4.5
5
5.5
5.25
http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
b0  y ( x 0 )
 7 .2
b1 
y ( x1 )  y ( x 0 )
x1  x 0

7 .1  7 .2
4 . 25  2 . 00
  0 . 044444
y ( x 2 )  y ( x1 )
b2 

x 2  x1

y ( x1 )  y ( x 0 )
x2  x0
x1  x 0
6 .0  7 .1


7 .1  7 .2
5 . 25  4 . 25 4 . 25  2 . 00
5 . 25  2 . 00
 1 . 1  0 . 044444
3 . 25
  0 . 32479
12
http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
y ( x )  b 0  b1 ( x  x 0 )  b 2 ( x  x 0 )( x  x 1 )
 7 . 2  0 . 044444 ( x  2 . 00 )  0 . 32479 ( x  2 . 00 )( x  4 . 25 ),
2 . 00  x  5 . 25
At x  4 ,
y ( 4 . 00 )  7 . 2  0 . 044444 ( 4 . 00  2 . 00 )  0 . 32479 ( 4 . 00  2 . 00 )( 4 . 00  4 . 25 )
 7 . 2735 in .
The absolute relative approximate error  a obtained between the
results from the first and second order polynomial is
a 
7 . 2735  7 . 1111
 100
7 . 2735
 2 . 2327 %
13
http://numericalmethods.eng.usf.edu
General Form
f 2 ( x )  b 0  b1 ( x  x 0 )  b 2 ( x  x 0 )( x  x 1 )
where
b0  f [ x 0 ]  f ( x 0 )
b1  f [ x 1 , x 0 ] 
f ( x1 )  f ( x 0 )
x1  x 0
f ( x 2 )  f ( x1 )
b 2  f [ x 2 , x1 , x 0 ] 
f [ x 2 , x1 ]  f [ x1 , x 0 ]
x2  x0

x 2  x1

f ( x1 )  f ( x 0 )
x1  x 0
x2  x0
Rewriting
f 2 ( x )  f [ x 0 ]  f [ x 1 , x 0 ]( x  x 0 )  f [ x 2 , x1 , x 0 ]( x  x 0 )( x  x 1 )
14
http://numericalmethods.eng.usf.edu
General Form
Given ( n  1) data points,  x 0 , y 0 ,  x1 , y 1 ,......,  x n 1 , y n 1 ,  x n , y n  as
f n ( x )  b 0  b1 ( x  x 0 )  ....  b n ( x  x 0 )( x  x1 )...( x  x n 1 )
where
b0  f [ x 0 ]
b1  f [ x 1 , x 0 ]
b 2  f [ x 2 , x1 , x 0 ]

b n 1  f [ x n 1 , x n  2 ,...., x 0 ]
b n  f [ x n , x n 1 ,...., x 0 ]
15
http://numericalmethods.eng.usf.edu
General form
The third order polynomial, given ( x 0 , y 0 ), ( x 1 , y 1 ), ( x 2 , y 2 ), and ( x 3 , y 3 ), is
f 3 ( x )  f [ x 0 ]  f [ x 1 , x 0 ]( x  x 0 )  f [ x 2 , x 1 , x 0 ]( x  x 0 )( x  x 1 )
 f [ x 3 , x 2 , x 1 , x 0 ]( x  x 0 )( x  x 1 )( x  x 2 )
b0
x0
b1
f ( x0 )
b2
f [ x1 , x 0 ]
x1
f ( x1 )
f [ x 2 , x1 , x 0 ]
f [ x 2 , x1 ]
x2
f (x2 )
b3
f [ x 3 , x 2 , x1 , x 0 ]
f [ x 3 , x 2 , x1 ]
f [ x3 , x2 ]
x3
16
f ( x3 )
http://numericalmethods.eng.usf.edu
Example
A robot arm with a rapid laser scanner is doing a quick quality check
on holes drilled in a rectangular plate. The hole centers in the plate that
describe the path the arm needs to take are given below.
If the laser is traversing from x = 2 to x = 4.25 in a linear path, find
the value of y at x = 4 using the Newton’s Divided Difference method for
a fifth order polynomial.
17
x (m)
y (m)
2
4.25
5.25
7.81
9.2
10.6
7.2
7.1
6.0
5.0
3.5
5.0
Figure 2 Location of holes on the
rectangular plate.
http://numericalmethods.eng.usf.edu
Example
The value of y profile is chosen as
y ( x )  b 0  b1 ( x  x 0 )  b 2 ( x  x 0 )( x  x 1 )  b 3 ( x  x 0 )( x  x 1 )( x  x 2 )
 b 4 ( x  x 0 )( x  x 1 )( x  x 2 )( x  x 3 )  b 5 ( x  x 0 )( x  x 1 )( x  x 2 )( x  x 3 )( x  x 4 )
Using the six points,
x 0  2 . 00 ,
y ( x 0 )  7 .2
x 1  4 . 25 ,
y ( x1 )  7 .1
x 2  5 . 25 ,
y ( x 2 )  6 .0
x 3  7 . 81 ,
y ( x 3 )  5 .0
x 4  9 . 20 ,
y ( x 4 )  3 .5
x 5  10 . 60 ,
y ( x 5 )  5 .0
The values of the constants are found to be
18
b 0  7 .2
b 1   0 . 044444
b 2   0 . 32479
b 3  0 . 090198
b 4   0 . 023009
b 5  0 . 0072923
http://numericalmethods.eng.usf.edu
Example
Hence
y ( x )  b 0  b1 ( x  x 0 )  b 2 ( x  x 0 )( x  x 1 )  b 3 ( x  x 0 )( x  x 1 )( x  x 2 )
 b 4 ( x  x 0 )( x  x 1 )( x  x 2 )( x  x 3 )  b 5 ( x  x 0 )( x  x 1 )( x  x 2 )( x  x 3 )( x  x 4 )
 7 . 2  0 . 04444 ( x  2 )  0 . 32479 ( x  2 )( x  4 . 25 )
 0 . 090198 ( x  2 )( x  4 . 25 )( x  5 . 25 )
 0 . 023009 ( x  2 )( x  4 . 25 )( x  5 . 25 )( x  7 . 81 )
 0 . 0072923 ( x  2 )( x  4 . 25 )( x  5 . 25 )( x  7 . 81 )( x  9 . 2 )
y ( x )   30 . 898  41 . 344 x  15 . 855 x  2 . 7862 x  0 . 23091 x  0 . 0072923 x ,
2
19
3
4
5
2  x  10 . 6
http://numericalmethods.eng.usf.edu
Example
y ( x )   30 . 898  41 . 344 x  15 . 855 x  2 . 7862 x  0 . 23091 x  0 . 0072922 x ,
2
3
4
5
2  x  10 . 6
20
http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit
http://numericalmethods.eng.usf.edu/topics/newton_div
ided_difference_method.html
THE END
http://numericalmethods.eng.usf.edu