Interpolation Chapter 18 • Estimation of intermediate values between precise data points. The most common method is: f ( x ) a 0 a1 x a 2 x a n x 2 n • Although there is one and only one nth-order polynomial that fits n+1 points, there are a variety of mathematical formats in which this polynomial can be expressed: – The Newton polynomial – The Lagrange polynomial Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Figure 18.1 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 2 Figure 18.2 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3 Newton’s Divided-Difference Interpolating Polynomials Linear Interpolation/ • Is the simplest form of interpolation, connecting two data points with a straight line. f1 ( x ) f ( x 0 ) x x0 f1 ( x ) f ( x 0 ) f ( x1 ) f ( x 0 ) x1 x 0 f ( x1 ) f ( x 0 ) x1 x 0 Slope and a finite divided difference approximation to 1st derivative ( x x 0 ) Linear-interpolation formula • f1(x) designates that this is a first-order interpolating polynomial. Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 6 Quadratic Interpolation/ • If three data points are available, the estimate is improved by introducing some curvature into the line connecting the points. f 2 ( x ) b0 b1 ( x x 0 ) b 2 ( x x 0 )( x x1 ) • A simple procedure can be used to determine the values of the coefficients. x x0 b0 f ( x 0 ) x x1 b1 f ( x1 ) f ( x 0 ) x1 x 0 f ( x 2 ) f ( x1 ) x x2 b2 x 2 x1 f ( x1 ) f ( x 0 ) x1 x 0 x2 x0 7 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8 by Lale Yurttas, Texas A&M University Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9 General Form of Newton’s Interpolating Polynomials/ f n ( x ) f ( x 0 ) ( x x 0 ) f [ x1 , x 0 ] ( x x 0 )( x x1 ) f [ x 2 , x1 , x 0 ] ( x x 0 )( x x1 ) ( x x n 1 ) f [ x n , x n 1 , , x 0 ] b0 f ( x 0 ) b1 f [ x1 , x 0 ] b 2 f [ x 2 , x1 , x 0 ] b n f [ x n , x n 1 , , x 1 , x 0 ] f [ xi , x j ] f ( xi ) f ( x j ) f [ xi , x j , xk ] Bracketed function evaluations are finite divided differences xi x j f [ xi , x j ] f [ x j , xk ] xi xk f [ x n , x n 1 , , x1 , x 0 ] f [ x n , x n 1 , , x1 ] f [ x n 1 , x n 2 , , x 0 ] Chapter x 18x n 0 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 10 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 11 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 12 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 13 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 14 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 15 Errors of Newton’s Interpolating Polynomials/ • Structure of interpolating polynomials is similar to the Taylor series expansion in the sense that finite divided differences are added sequentially to capture the higher order derivatives. • For an nth-order interpolating polynomial, an analogous relationship for the error is: Rn f ( n 1) ( ) ( n 1)! ( x x 0 )( x x1 ) ( x x n ) Is somewhere containing the unknown and he data • For non differentiable functions, if an additional point f(xn+1) is available, an alternative formula can be used that does not require prior knowledge of the function: R n f [ x n 1 , x n , x n 1 , , x 0 ]( x x 0 )( x x1 ) ( x x n ) Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 16 Lagrange Interpolating Polynomials • The Lagrange interpolating polynomial is simply a reformulation of the Newton’s polynomial that avoids the computation of divided differences: n fn ( x) L ( x) f ( x ) i i i0 n Li ( x ) j0 ji x xj xi x j Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 17 f1 ( x ) x x1 x 0 x1 f ( x0 ) x x0 x1 x 0 f ( x1 ) x x 0 x x 2 x x1 x x 2 f2 (x) f ( x0 ) x 0 x1 x 0 x 2 x1 x 0 x1 x 2 x x 0 x x1 f ( x2 ) x 2 x 0 x 2 x 1 f ( x1 ) •As with Newton’s method, the Lagrange version has an estimated error of: n R n f [ x , x n , x n 1 , , x 0 ] ( x x i ) i0 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 18 Figure 18.10 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 19 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 20 f1 ( x ) f ( x 0 ) x x0 f1 ( x ) f ( x 0 ) f ( x1 ) f ( x 0 ) x1 x 0 f ( x1 ) f ( x 0 ) x1 x 0 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. ( x x0 ) 21 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 22 Coefficients of an Interpolating Polynomial • Although both the Newton and Lagrange polynomials are well suited for determining intermediate values between points, they do not provide a polynomial in conventional form: f ( x ) a 0 a1 x a 2 x a x x 2 n • Since n+1 data points are required to determine n+1 coefficients, simultaneous linear systems of equations can be used to calculate “a”s. Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 23 f ( x 0 ) a 0 a1 x 0 a 2 x a n x 2 0 f ( x1 ) a 0 a 1 x1 a 2 x a n x 2 1 n 0 n 1 f ( x n ) a 0 a1 x n a 2 x a n x 2 n n n Where “x”s are the knowns and “a”s are the unknowns. Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 24 Figure 18.13 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 25 Spline Interpolation • There are cases where polynomials can lead to erroneous results because of round off error and overshoot. • Alternative approach is to apply lower-order polynomials to subsets of data points. Such connecting polynomials are called spline functions. Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 26 Figure 18.14 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 27 Figure 18.15 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 28 Figure 18.16 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 29 Figure 18.17 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 30 Quadratic Splines Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 31 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 32 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 33 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 34 Cubic Splines Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 35 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 36 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 37 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 38 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 39 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 40 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 41 Chapter 18 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 42