Transcript PPT
Newton’s Divided Difference Polynomial Method of Interpolation Industrial 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 ( x0 , y0 ), ( x1 , y1 ), pass a linear interpolant through the data f1 ( x) b0 b1 ( x x0 ) where b0 f ( x0 ) b1 5 f ( x1 ) f ( x0 ) x1 x0 http://numericalmethods.eng.usf.edu Example A curve needs to be fit through the given points to fabricate the cam. If the cam follows a straight line profile between x = 1.28 to x = 0.66, what is the value of y at x=1.1 ? Find using the Newton’s divided difference method for linear interpolation. 6 x (in.) y (in.) 2.20 0.00 1.28 0.88 0.66 1.14 0.00 1.20 –0.60 1.04 –1.04 0.60 –1.20 0.00 Cam Profile 4 3 5 2 1.4 1.2 1 6 0.8 y Point 1 2 3 4 5 6 7 Y 7 0.6 1 0.4 X 0.2 0 -2 -1 0 1 2 x http://numericalmethods.eng.usf.edu 3 Linear Interpolation 1.14 y( x) b0 b1 ( x x0 ) x0 1.28, y( x0 ) 0.88 x1 0.66, y( x1 ) 1.14 1.1 1.05 ys f ( range) f x desired b0 y( x0 ) 1 0.95 0.9 0.88 y (x 1 ) y (x 0 ) 1.14 0.88 b1 0.66 1.28 x1 x 0 0.88 0.85 5 x s 10 0 0 5 x s range x desired 0.41935 7 http://numericalmethods.eng.usf.edu 10 x s 10 1 Linear Interpolation (contd) 1.14 1.1 1.05 ys f ( range) f x desired 1 0.95 0.9 0.88 0.85 5 x s 10 0 0 x s range x desired 5 10 x s 10 1 y( x) b0 b1 ( x x0 ) 0.88 0.41935( x 1.28), 0.66 x 1.28 At x 1.10 y (1.10) 0.88 0.41935(1.10 1.28) 8 0.95548 in. http://numericalmethods.eng.usf.edu Quadratic Interpolation Given ( x0 , y0 ), ( x1 , y1 ), and ( x2 , y2 ), fit a quadratic interpolant through the data. f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 ) b0 f ( x0 ) f ( x1 ) f ( x0 ) b1 x1 x0 f ( x 2 ) f ( x1 ) f ( x1 ) f ( x0 ) x 2 x1 x1 x0 b2 x 2 x0 9 http://numericalmethods.eng.usf.edu Example A curve needs to be fit through the given points to fabricate the cam. If the cam follows a straight line profile between x = 1.28 to x = 0.66, what is the value of y at x=1.1 ? Find using the Newton’s divided difference method for quadratic interpolation. 10 x (in.) y (in.) 2.20 0.00 1.28 0.88 0.66 1.14 0.00 1.20 –0.60 1.04 –1.04 0.60 –1.20 0.00 Cam Profile 4 3 5 2 1.4 1.2 1 6 0.8 y Point 1 2 3 4 5 6 7 Y 7 0.6 1 0.4 X 0.2 0 -2 -1 0 1 2 x http://numericalmethods.eng.usf.edu 3 Quadratic Interpolation (contd) 1.14 y( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 ) x0 2.20, y( x0 ) 0.00 x1 1.28, y( x1 ) 0.88 1.2 1 0.8 ys f ( range) f x desired x2 0.66, y( x2 ) 1.14 0.6 0.4 0.2 0 0 0.6 0.66 11 0.8 1 1.2 1.4 1.6 x s range x desired 1.8 2 2.2 2.2 http://numericalmethods.eng.usf.edu Quadratic Interpolation (contd) b0 y( x0 ) 0.00 y( x1 ) y ( x0 ) 0.88 0.00 b1 1.28 2.20 x1 x0 0.95652 y ( x 2 ) y ( x1 ) y ( x1 ) y ( x0 ) 1.14 0.88 0.88 0.00 x 2 x1 x1 x0 b2 0.66 1.28 1.28 2.20 0.66 2.20 x2 x0 0.41935 0.95652 1.54 0.34881 12 http://numericalmethods.eng.usf.edu Quadratic Interpolation (contd) y ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 ) 0 0.95652( x 2.20) 0.34881( x 2.20)( x 1.28), 0.66 x 2.20 At x 1.10, y (1.10) 0 0.95652(1.10 2.20) 0.34881(1.10 2.20)(1.10 1.28) 0.98311 in. The absolute relative approximate error a obtained between the results from the first and second order polynomial is 0.98311 0.95548 100 0.98311 2.8100% a 13 http://numericalmethods.eng.usf.edu General Form f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 ) where b0 f [ x0 ] f ( x0 ) f ( x1 ) f ( x 0 ) b1 f [ x1 , x0 ] x1 x0 f ( x 2 ) f ( x1 ) f ( x1 ) f ( x0 ) f [ x 2 , x1 ] f [ x1 , x0 ] x 2 x1 x1 x0 b2 f [ x 2 , x1 , x0 ] x 2 x0 x 2 x0 Rewriting f 2 ( x) f [ x0 ] f [ x1 , x0 ]( x x0 ) f [ x2 , x1 , x0 ]( x x0 )( x x1 ) 14 http://numericalmethods.eng.usf.edu General Form Given (n 1) data points, x0 , y0 , x1 , y1 ,......, xn1 , y n1 , xn , y n as f n ( x) b0 b1 ( x x0 ) .... bn ( x x0 )( x x1 )...( x xn1 ) where b0 f [ x0 ] b1 f [ x1 , x0 ] b2 f [ x2 , x1 , x0 ] bn1 f [ xn1 , xn2 ,...., x0 ] bn f [ xn , xn1 ,...., x0 ] 15 http://numericalmethods.eng.usf.edu General form The third order polynomial, given ( x0 , y0 ), ( x1 , y1 ), ( x2 , y2 ), and ( x3 , y3 ), is 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 x0 f ( x0 ) b1 f [ x1 , x0 ] x1 b2 f [ x2 , x1 , x0 ] f ( x1 ) f [ x3 , x2 , x1 , x0 ] f [ x2 , x1 ] x2 b3 f [ x3 , x2 , x1 ] f ( x2 ) f [ x3 , x 2 ] x3 16 f ( x3 ) http://numericalmethods.eng.usf.edu Example A curve needs to be fit through the given points to fabricate the cam. If the cam follows a straight line profile between x = 1.28 to x = 0.66, what is the value of y at x=1.1 ? Find using the Newton’s divided difference method for a sixth order polynomial. 17 x (in.) y (in.) 2.20 0.00 1.28 0.88 0.66 1.14 0.00 1.20 –0.60 1.04 –1.04 0.60 –1.20 0.00 Cam Profile 4 3 5 2 1.4 1.2 1 6 0.8 y Point 1 2 3 4 5 6 7 Y 7 0.6 1 0.4 X 0.2 0 -2 -1 0 1 2 x http://numericalmethods.eng.usf.edu 3 Example The value of y profile is chosen as y ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 ) b3 ( x x0 )( x x1 )( x x 2 ) b4 ( x x0 )( x x1 )( x x 2 )( x x3 ) b5 ( x x0 )( x x1 )( x x 2 )( x x3 )( x x 4 ) b6 ( x x0 )( x x1 )( x x 2 )( x x3 )( x x 4 )( x x5 ) x0 2.20, y( x0 ) 0.00 x1 1.28, y( x1 ) 0.88 x2 0.66, y( x2 ) 1.14 x3 0.00, y( x3 ) 1.20 x4 0.60, y( x4 ) 1.04 x5 1.04, y( x5 ) 0.60 x6 1.20, y( x6 ) 0.00 18 http://numericalmethods.eng.usf.edu Example The values of the constants are found as: b0 0.00 b1 0.95652 b2 0.34881 b3 0.041914 b4 0.020135 b5 0.024834 b6 0.17103 19 http://numericalmethods.eng.usf.edu Example y ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 ) b3 ( x x0 )( x x1 )( x x 2 ) b4 ( x x0 )( x x1 )( x x 2 )( x x3 ) b5 ( x x0 )( x x1 )( x x 2 )( x x3 )( x x 4 ) b6 ( x x0 )( x x1 )( x x 2 )( x x3 )( x x 4 )( x x5 ) 0 0.95652( x 2.2) 0.34881( x 2.2)( x 1.28) 0.041914( x 2.2)( x 1.28)( x 0.66) 0.020135( x 2.2)( x 1.28)( x 0.66)( x 0) 0.024834( x 2.2)( x 1.28)( x 0.66)( x 0)( x 0.6) 0.17103( x 2.2)( x 1.28)( x 0.66)( x 0)( x 0.6)( x 1.04) y( x) 1.2 0.25112 x 0.27255x 2 0.56765 x 3 0.072013x 4 0.45241x 5 0.17103x 6 , 1.20 x 2.20 20 http://numericalmethods.eng.usf.edu Example y ( x) 0 0.95652( x 2.2) 0.34881( x 2.2)( x 1.28) 0.041914( x 2.2)( x 1.28)( x 0.66) 0.020135( x 2.2)( x 1.28)( x 0.66)( x 0) 0.024834( x 2.2)( x 1.28)( x 0.66)( x 0)( x 0.6) 0.17103( x 2.2)( x 1.28)( x 0.66)( x 0)( x 0.6)( x 1.04) 21 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