Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Interpolation Chapter 18.

Slides:



Advertisements
Similar presentations
Splines and Piecewise Interpolation
Advertisements

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression Chapter.
Numerical Methods.  Polynomial interpolation involves finding a polynomial of order n that passes through the n+1 points.  Several methods to obtain.
High Accuracy Differentiation Formulas
Chapter 18 Interpolation The Islamic University of Gaza
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression.
EARS1160 – Numerical Methods notes by G. Houseman
ES 240: Scientific and Engineering Computation. InterpolationPolynomial  Definition –a function f(x) that can be written as a finite series of power functions.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 61.
KFUPM SE301: Numerical Methods Topic 5: Interpolation Lectures 20-22:
Curve-Fitting Interpolation
CURVE FITTING ENGR 351 Numerical Methods for Engineers
Curve-Fitting Polynomial Interpolation
Interpolation Used to estimate values between data points difference from regression - goes through data points no error in data points.
Polynomial Interpolation
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Martin Mendez UASLP Chapter 61 Unit II.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 22 CURVE FITTING Chapter 18 Function Interpolation and Approximation.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 181 Interpolation Chapter 18 Estimation of intermediate.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 23 CURVE FITTING Chapter 18 Function Interpolation and Approximation.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 CURVE.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 181 Interpolation.
CSE Interpolation Roger Crawfis.
Chapter 6 Numerical Interpolation
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 21 CURVE FITTING Chapter 18 Function Interpolation and Approximation.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 Least.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Numerical Differentiation and Integration Part 6 Calculus.
CpE- 310B Engineering Computation and Simulation Dr. Manal Al-Bzoor
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression Chapter.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 2 Roots of Equations Why? But.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Applied Numerical Methods With MATLAB ® for Engineers.
Part 4 Chapter 17 Polynomial Interpolation PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill.
Today’s class Spline Interpolation Quadratic Spline Cubic Spline Fourier Approximation Numerical Methods Lecture 21 Prof. Jinbo Bi CSE, UConn 1.
Polynomial Interpolation You will frequently have occasions to estimate intermediate values between precise data points. The function you use to interpolate.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Chapter 8 Curve Fitting.
Chapter 14 Curve Fitting : Polynomial Interpolation Gab Byung Chae.
Chapter 4 Interpolation and Approximation. 4.1 Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Roots of Equations ~ Open Methods Chapter 6 Credit:
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 71.
Interpolation produces a function that matches the given data exactly. The function then can be utilized to approximate the data values at intermediate.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 7.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 22.
CHAPTER 3 NUMERICAL METHODS
Lecture 22 Numerical Analysis. Chapter 5 Interpolation.
Computers in Civil Engineering 53:081 Spring 2003 Lecture #15 Spline Interpolation.
KFUPM SE301: Numerical Methods Topic 5: Interpolation Lectures 20-22:
EE3561_Unit 5(c)AL-DHAIFALLAH14361 EE 3561 : Computational Methods Unit 5 : Interpolation Dr. Mujahed AlDhaifallah (Term 351) Read Chapter 18, Sections.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 27.
Principles of Extrapolation
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Truncation Errors and the Taylor Series Chapter 4.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Interpolation - Introduction
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 21 Numerical Differentiation.
1 Approximating functions, polynomial interpolation (Lagrange and Newton’s divided differences) formulas, error approximations.
Computational Methods CMSC/AMSC/MAPL 460 Polynomial Interpolation Ramani Duraiswami, Dept. of Computer Science.
Polynomial Interpolation
Curve-Fitting Spline Interpolation
Interpolation Estimation of intermediate values between precise data points. The most common method is: Although there is one and only one nth-order.
Chapter 18.
Chapter 18.
INTERPOLATION Prof. Samuel Okolie, Prof. Yinka Adekunle & Dr
Interpolasi Pertemuan - 7 Mata Kuliah : Analisis Numerik
POLYNOMIAL INTERPOLATION
Splines There are cases where polynomial interpolation is bad
SKTN 2393 Numerical Methods for Nuclear Engineers
Presentation transcript:

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Interpolation Chapter 18

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 2 Interpolation : Estimation of a function value at an intermediate point that lie between precise data points. There is one and only one n th -order polynomial that perfectly fits n+1 data points: There are several methods to find the fitting polynomial: the Newton polynomial and the Lagrange polynomial

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3 Newton’s Divided-Difference Interpolating Polynomials Linear Interpolation Connecting two data points with a straight line f 1 (x) designates a first-order interpolating polynomial. Linear-interpolation formula Slope

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 If three (3) data points are available, the estimate is improved by introducing some curvature into the line connecting the points. A second-order polynomial (parabola) can be used for this purpose A simple procedure can be used to determine the values of the coefficients Could you figure out how to derive this using the above equation? Represents a second order polynomial Quadratic Interpolation

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

General Form of Newton’s Interpolating Polynomials Bracketed function evaluations are finite divided differences

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 7 xixi f(x i ) x0x0 f(x 0 ) x1x1 f(x 1 ) x2x2 f(x 2 ) x3x3 f(x 3 ) x4x4 f(x 4 ) xixi f(x i ) x 0 =0 2 x 1 =2 14 x 2 =3 74 x 3 =4 242 x 4 =5 602 f 1 (x) = 2 + 6*(x-0) (based on x 0 and x 1 ) f 2 (x) = 2 + 6*(x-0)+18(x-0)(x-2) (based on x 0, x 1 and x 2 ) f 3 (x) = 2 + 6*(x-0)+18(x-0)(x-2)+9(x-0)(x-2)(x-3) (based on x 0, x 1, x 2, and x 3 ) f 4 (x) = 2 + 6x +18x(x-2) +9x(x-2)(x-3) +1x(x-2)(x-3)(x-4) (based on x 0, x 1, x 2, x 3, and x 4 ) = x 4 – x EXAMPLEDIVIDED DIFFERENCE TABLE f[x i,x j ] f[x i,x j,x k ] f[x,x,x,x] 9 14 f[x...x] 1 f[x i,x j ] f[x 1,x 0 ] f[x 2,x 1 ] f[x 3,x 2 ] f[x 4,x 3 ] f[x i,x j,x k ] f[x 2,x 1,x 0 ] f[x 3,x 2,x 1 ] f[x 4,x 3,x 2 ] f[x,x,x,x] f[x 3,x 2,x 1,x 0 ] f[x 4,x 3,x 2,x 1 ]

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8 Given: x 0 =1 f(x 0 )=ln(1) = 0 x 1 =e f(x 1 )=ln(2.72) = 1 x 2 =e 2 f(x 2 )=ln(7.39) = 2 Estimate ln(2) = ? using interpolation Find f(x) first xixi f(x i ) x 0 =1 0 x 1 = x 2 = f[x i,x j ] f[x i,x j x k ] f(x) = 0.58(x-1) (x-1)(x-2.72) Then calculate f(2)=0.58(2-1)-0.057(2-1)(2-2.72) = [ TRUE ln(2) = ]

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9 Given: x 0 =1 f(x 0 )=ln(1)=0 x 1 =4 f(x 1 )=ln(4)=1.386 x 2 =6 f(x 2 )=ln(6)=1.791 Estimate ln(2) = ? using interpolation Find f(x) first xixi f(x i ) x 0 =1 0 x 1 = x 2 = f[x i,x j ] f[x i,x j x k ] f(x) = 0.462(x-1) (x-1)(x-4) Then calculate f(2)=0.462*(2-1) *(2-1)(2-4) = [ TRUE ln(2) = ] Yet Another Example:

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 10 Structure of interpolating polynomials is similar to the Taylor series expansion, i.e. finite divided differences are added sequentially to capture the higher order derivatives. For an n th -order interpolating polynomial, an analogous relationship for the error is: If an additional point (x n+1, f(x n+1 )) is available, then This result is based on the assumption that the series is strongly convergent. i.e. (n+1) th -order prediction is closer to the true value than the n th -order prediction. Error Estimation in Newton’s Interpolating Polynomials

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 11 Previous Example: x 0 =1 f(x 0 )=ln(1) = 0 x 1 =e f(x 1 )=ln(2.72) = 1 x 2 =e 2 f(x 2 )=ln(7.39) = 2 f(x) = 0.58(x-1) (x-1)(x-2.72) f(2) = Example (for computing error): In the previous Example, add a fourth point x 3 =4 f(x 3 ) = And estimate the approximate error in computing ln(2) 2 nd order polynomial estimation: f(2) = True error = ln(2) – f(2) = = R 2 = f 3 (x) - f 2 (x) = f[ x 3, x 2, x 1, x 0 ] (x- x 0 )(x- x 1 )(x- x 2 ) or R 2 = 0.011*(x-1)(x-2.72)(x-7.39) If we plug-in x=2 in the above expression, we get: R 2 = 0.011*(2-1)(2-2.72)(2-7.39)= which is half of the true error (same order of magnitude).

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 12 Previous Example: x 0 =1 f(x 0 )=0 x 1 =4 f(x 1 )=1.386 x 2 =6 f(x 2 )=1.791 f(x) = 0.462(x-1) (x-1)(x-4) f(2) = Example (for computing error): In the previous Example, add a fourth point x 3 =5 f(x 3 ) = And estimate the error in computing ln(2)= f(2) 2 nd order polynomial estimation: f(2) = True error = ln(2) – f(2) = = R 2 = f 3 (x)-f 2 (x) = f[ x 3, x 2, x 1, x 0 ] (x- x 0 )(x- x 1 )(x- x 2 ) or R 2 = 0.008*(x- 1)(x- 4)(x- 6) If we plug-in x=2 in the above expression, we get: R 2 = 0.008*(2- 1)(2- 4)(2- 6) = which is half of the true error (same order of magnitude).

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Lagrange Interpolating Polynomials The Lagrange interpolating polynomial is simply a reformulation of the Newton’s polynomial that avoids the computation of divided differences: Above formula can be easily verified by plugging in x 0, x 1 …in the equation one at a time and checking if the equality is satisfied.

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 14 A visual depiction of the rationale behind the Lagrange polynomial. The figure shows a second order case: Each of the three terms passes through one of the data points and zero at the other two. The summation of the three terms must, therefore, be unique second order polynomial f 2 (x) that passes exactly through three points.

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 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: Since n+1 data points are required to determine n+1 coefficients, simultaneous linear systems of equations can be used to calculate “a”s. Where “x”s are the knowns and “a”s are the unknowns. Time complexity for Newton’s: O(n 2 ) vs. Gaussian Elim. O(n 3 ) Another reason: this approach results in a highly unstable (ill-conditioned) system of equations. Therefore, Newton or Lagrange interpolation is preferred.

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 16 Inverse Interpolation Given (x 0, f(x 0 )), (x 1, f(x 1 )), (x 2, f(x 2 )), …, (x n, f(x n )) and a function value f(x k ), how do you determine (x k ) ? 1.Using one of the interpolation methods (Newton or Lagrange), obtain the function f(x) : 2.Plug in the value of f(x k ) in the above equation and find one of the real roots of the resultant equation using a root finding method:

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 17 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. EXAMPLE: spline fits for a set of 4 points: (a) linear (b) quadratic (c) cubic splines linear spline   is superior to higher-order interpolating polynomials (parts a, b, and c)

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Quadratic Spline example

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Quadratic Splines - Equations Given (n+1) points, there are 3(n) coefficients to find and hence, need to determine 3n equations to solve: 1.Each polynomial must pass through the endpoints of the interval that they are associated with. And these conditions result in 2n equations: 1.The first derivatives at the interior knots must be equal ((n-1) equations): 2.So far, we are one equation short. Since the last equation will be derived using only 2 points, it must be a line equation with only b n and c n to be determined (a n = 0)