LAGRANGE INTERPOLATING POLYNOMIALS

Slides:



Advertisements
Similar presentations
Numerical Integration
Advertisements

Interpolation A standard idea in interpolation now is to find a polynomial pn(x) of degree n (or less) that assumes the given values; thus (1) We call.
Computational Methods in Physics PHYS 3437
ES 240: Scientific and Engineering Computation. InterpolationPolynomial  Definition –a function f(x) that can be written as a finite series of power functions.
KFUPM SE301: Numerical Methods Topic 5: Interpolation Lectures 20-22:
Curve-Fitting Interpolation
Curve-Fitting Polynomial Interpolation
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.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 181 Interpolation.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Interpolation Chapter 18.
Chapter 6 Numerical Interpolation
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 Least.
NUMERICAL DIFFERENTIATION The derivative of f (x) at x 0 is: An approximation to this is: for small values of h. Forward Difference Formula.
CpE- 310B Engineering Computation and Simulation Dr. Manal Al-Bzoor
1 Chapter 7 NUMERICAL INTEGRATION. 2 PRELIMINARIES We use numerical integration when the function f(x) may not be integrable in closed form or even in.
Interpolation. Interpolation is important concept in numerical analysis. Quite often functions may not be available explicitly but only the values of.
Chapter 8 Curve Fitting.
Chapter 14 Curve Fitting : Polynomial Interpolation Gab Byung Chae.
Numerical Methods For Slides Thanks to Lecture 6 Interpolation
By Adam Mallen.  What is it?  How is it different from regression?  When would you use it?  What can go wrong?  How do we find the interpolating.
CHAPTER 3 NUMERICAL METHODS
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.
1 INTERPOLASI. Direct Method of Interpolation 3 What is Interpolation ? Given (x 0,y 0 ), (x 1,y 1 ), …… (x n,y n ), find the value of ‘y’ at a value.
Principles of Extrapolation
By: Mark Coose Joetta Swift Micah Weiss. What Problems Can Interpolation Solve? Given a table of values, find a simple function that passes through the.
Copyright © Cengage Learning. All rights reserved Applications of Taylor Polynomials.
Interpolation - Introduction
1 Approximating functions, polynomial interpolation (Lagrange and Newton’s divided differences) formulas, error approximations.
Numerical Integration
CHAPTER 3 NUMERICAL METHODS
Air Force Admin College, Coimbatore
NUMERICAL DIFFERENTIATION Forward Difference Formula
High Accuracy Differentiation Formulas
Part 6 - Chapter 21.
Part 5 - Chapter
Polynomial Interpolation
Curve-Fitting Spline Interpolation
Numerical Analysis Lecture 25.
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 22.
INTERPOLATION Interpolation produces a function that matches the given data exactly. The function then can be utilized to approximate the data values.
Interpolation.
Chapter 18.
INTERPOLATION Prof. Samuel Okolie, Prof. Yinka Adekunle & Dr
Chapter 23.
Chapter 7 Numerical Differentiation and Integration
Today’s class Multiple Variable Linear Regression
Chapter 27.
MATH 2140 Numerical Methods
Chapter 26.
Interpolasi Pertemuan - 7 Mata Kuliah : Analisis Numerik
Numerical Analysis Lecture 23.
POLYNOMIAL INTERPOLATION
Numerical Analysis Lecture 26.
MATH 174: Numerical Analysis
Numerical Computation and Optimization
MATH 2140 Numerical Methods
INTERPOLASI.
Discrete Least Squares Approximation
Interpolation Practice-6 Additional chapters of mathematics
SKTN 2393 Numerical Methods for Nuclear Engineers
Numerical Computation and Optimization
Numerical Analysis Lecture 21.
Numerical Analysis Lecture 24.
Air Force Admin College, Coimbatore
Theory of Approximation: Interpolation
Elements of Numerical Integration
Presentation transcript:

LAGRANGE INTERPOLATING POLYNOMIALS Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS deg poly ? Consider the following polynomial L(1) = 𝐿 𝑥 = (𝑥−1)(𝑥−2)(𝑥−3)(𝑥−4)(𝑥−6)(𝑥−7)(𝑥−8)(𝑥−9) (5−1)(5−2)(5−3)(5−4)(5−6)(5−7)(5−8)(5−9) L(2) = L(9) = L(8) = L(5) = Define: 𝑝 𝑥 =100∗𝐿 𝑥 Difference ? Lagrange interpolating polynomial

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS 𝑳 𝟎 𝒙 = (𝒙−𝟐)(𝒙−𝟑) (𝟏−𝟐)(𝟏−𝟑) Consider 𝑳 𝟎 𝟏 = 𝑳 𝟎 𝟐 = 𝑳 𝟎 𝟑 = 1 200 2 500 3 900 𝒙 𝒊 𝒇(𝒙 𝒊 ) 𝑳 𝟏 𝒙 = (𝒙−𝟏)(𝒙−𝟑) (𝟐−𝟏)(𝟐−𝟑) 𝑳 𝟏 𝟏 = 𝑳 𝟏 𝟐 = 𝑳 𝟏 𝟑 = 𝑳 𝟐 𝒙 = (𝒙−𝟏)(𝒙−𝟐) (𝟑−𝟏)(𝟑−𝟐) 𝑳 𝟐 𝟏 = 𝑳 𝟐 𝟐 = 𝑳 𝟐 𝟑 = 𝑷 𝒙 =𝟐𝟎𝟎∗𝑳 𝟎 𝒙 + 𝟓𝟎𝟎∗𝑳 𝟏 𝒙 + 𝟗𝟎𝟎∗ 𝑳 𝟐 𝒙 𝑷 𝟏 = 𝑷 𝟐 = 𝑷 𝟑 = The Lagrange interpolating polynomial is simply a reformulation of the Newton polynomial that avoids the computation of divided differences.

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS The Lagrange interpolating polynomial is simply a reformulation of the Newton polynomial that avoids the computation of divided differences. 𝑥 0 𝑥 1 𝑥 𝑖−1 𝑥 𝑖 𝑥 𝑛 ⋯ 𝑓(𝑥 0 ) 𝑓(𝑥 1 ) 𝑓(𝑥 𝑖−1 ) 𝑓(𝑥 𝑖 ) 𝑓(𝑥 𝑛 ) Given the set of data 𝐿 𝑖 𝑥 = (𝑥− 𝑥 0 )(𝑥− 𝑥 1 )⋯(𝑥− 𝑥 𝑖−1 )(𝑥− 𝑥 𝑖+1 )⋯(𝑥− 𝑥 𝑛 ) ( 𝑥 𝑖 − 𝑥 0 )( 𝑥 𝑖 − 𝑥 1 )⋯( 𝑥 𝑖 − 𝑥 𝑖−1 )( 𝑥 𝑖 − 𝑥 𝑖+1 )⋯( 𝑥 𝑖 − 𝑥 𝑛 ) Realize that each term Li (x) will be 1 at x = xi and 0 at all other sample points 𝐿 𝑖 𝑥 = 𝑗=0 𝑗≠𝑖 𝑛 (𝑥− 𝑥 𝑗 ) ( 𝑥 𝑖 − 𝑥 𝑗 ) where designates the “product of 𝑝 𝑛 𝑥 = 𝑖=1 𝑛 𝑓( 𝑥 𝑖 )𝐿 𝑖 𝑥 𝑝 𝑛 𝑥 is the unique nth order polynomial that passes exactly through all n + 1 data points.

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS Example 𝒙 𝒊 𝒇(𝒙 𝒊 ) 1 -8 2 6 3 16 5 48 Estimate f (4) using Lagrange interpolating polynomials of order 3. Given the data 𝑳 𝟎 𝟒 = −𝟐 −𝟖 𝑳 𝟎 𝒙 = (𝒙−𝟐)(𝒙−𝟑)(𝒙−𝟓) (𝟏−𝟐)(𝟏−𝟑)(𝟏−𝟓) = (𝒙−𝟐)(𝒙−𝟑)(𝒙−𝟓) −𝟖 𝑳 𝟏 𝟒 = −𝟑 𝟑 𝑳 𝟏 𝒙 = (𝒙−𝟏)(𝒙−𝟑)(𝒙−𝟓) (𝟐−𝟏)(𝟐−𝟑)(𝟐−𝟓) = (𝒙−𝟏)(𝒙−𝟑)(𝒙−𝟓) 𝟑 𝑳 𝟐 𝒙 = (𝒙−𝟏)(𝒙−𝟐)(𝒙−𝟓) (𝟑−𝟏)(𝟑−𝟐)(𝟑−𝟓) = (𝒙−𝟏)(𝒙−𝟑)(𝒙−𝟓) −𝟒 𝑳 𝟐 𝟒 = −𝟔 −𝟒 𝑳 𝟑 𝟒 == 𝟔 𝟐𝟒 𝑳 𝟑 𝒙 = (𝒙−𝟏)(𝒙−𝟐)(𝒙−𝟑) (𝟓−𝟏)(𝟓−𝟐)(𝟓−𝟑) = (𝒙−𝟏)(𝒙−𝟐)(𝒙−𝟑) 𝟐𝟒 𝒑 𝟑 𝒙 =−𝟖 𝑳 𝟎 𝒙 + 𝟔 𝑳 𝟏 𝒙 + 𝟏𝟔 𝑳 𝟐 𝒙 + 𝟒𝟖𝑳 𝟑 𝒙 𝒑 𝟑 𝟒 =−𝟖 𝑳 𝟎 𝟒 + 𝟔 𝑳 𝟏 𝟒 + 𝟏𝟔 𝑳 𝟐 𝟒 + 𝟒𝟖𝑳 𝟑 𝟒 𝒑 𝟑 𝟒 =−𝟖 𝟏 𝟒 +𝟔 −𝟏 +𝟏𝟔 𝟑 𝟐 +𝟒𝟖 𝟏 𝟒 =𝟐𝟖

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS Derivation of the Lagrange Form Directly from Newton’s Interpolating Polynomial 𝒙 𝟎 𝒇(𝒙 𝟎 ) 𝒙 𝟏 𝒇(𝒙 𝟏 ) NEWTON’S INTERPOLATING POLYNOMIAL LANGRANGE INTERPOLATING POLYNOMIAL 𝒑 𝟏 𝒙 =𝒇[ 𝒙 𝟎 ]+𝒇[ 𝒙 𝟏 , 𝒙 𝟎 ] 𝒙− 𝒙 𝟎 𝑝 1 𝑥 =𝒇( 𝒙 𝟎 ) 𝑳 𝟎 (𝒙)+𝒇( 𝒙 𝟏 ) 𝑳 𝟏 (𝒙) =𝒇( 𝒙 𝟎 )+ 𝒇 𝒙 𝟏 −𝒇( 𝒙 𝟎 ) 𝒙 𝟏 − 𝒙 𝟎 𝒙− 𝒙 𝟎 =𝒇 𝒙 𝟎 𝒙− 𝒙 𝟏 𝒙 𝟎 − 𝒙 𝟏 + 𝒇( 𝒙 𝟏 ) (𝒙− 𝒙 𝟎 ) ( 𝒙 𝟏 − 𝒙 𝟎 ) =𝒇( 𝒙 𝟎 )+ 𝒇 𝒙 𝟏 −𝒇( 𝒙 𝟎 ) 𝒙 𝟏 − 𝒙 𝟎 𝒙− 𝒙 𝟎 =𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 𝒙− 𝒙 𝟎 𝒙 𝟏 − 𝒙 𝟎 −𝒇 𝒙 𝟎 𝒙− 𝒙 𝟎 𝒙 𝟏 − 𝒙 𝟎 =𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 𝒙− 𝒙 𝟎 𝒙 𝟏 − 𝒙 𝟎 +𝒇 𝒙 𝟎 𝒙− 𝒙 𝟎 𝒙 𝟎 − 𝒙 𝟏 =𝒇 𝒙 𝟎 𝟏+ 𝒙− 𝒙 𝟎 𝒙 𝟎 − 𝒙 𝟏 +𝒇 𝒙 𝟏 𝒙− 𝒙 𝟎 𝒙 𝟏 − 𝒙 𝟎 𝒇 𝒙 𝟎 𝒙− 𝒙 𝟏 𝒙 𝟎 − 𝒙 𝟏 + 𝒇( 𝒙 𝟏 ) (𝒙− 𝒙 𝟎 ) ( 𝒙 𝟏 − 𝒙 𝟎 )

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS Example 𝒙 𝒊 𝒇(𝒙 𝒊 ) 1 -8 2 6 3 16 5 48 Estimate f (4) using Lagrange interpolating polynomials of order 3. Given the data function [yy] = langrange(x,y,xx) n = length(x); sum = 0; for i=1:n product = y(i); for j=1:n if (i~= j) ; product = product*(xx-x(j))/(x(i)-x(j)); end sum = sum + product; yy = sum; x=[1 2 3 5] y=[-8 6 16 48] [yy] = langrange(x,y,4) [d]=Divided_diff(x,y); [yi] = eval_poly(x,d,4)

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS Errors of Lagrange Interpolating Polynomials 𝑓 𝑥 − 𝑝 𝑛 𝑥 = 𝑹 𝒏 (𝒙) 𝑓 𝑥 − 𝑖=1 𝑛 𝑓( 𝑥 𝑖 )𝐿 𝑖 𝑥 = 𝑓 𝑛+1 𝜉 (𝑛+1)! 𝒋=𝟎 𝒏 𝒙− 𝑥 𝑗 𝑹 𝒏 (𝒙)=𝒇[ 𝒙,𝒙 𝒏 , ⋯,𝒙 𝟎 ] 𝒋=𝟎 𝒏 𝒙− 𝑥 𝑗 if an additional point is available at x = xn+1, an error estimate can be obtained 𝑹 𝒏 (𝒙)≈𝒇[ 𝒙 𝒏+𝟏 ,𝒙 𝒏 , ⋯,𝒙 𝟎 ] 𝒋=𝟎 𝒏 𝒙− 𝑥 𝑗

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS In summary, for cases where the order of the polynomial is unknown, the Newton method has advantages because of the insight it provides into the behavior of the different order formulas. In addition, the error estimate can usually be integrated easily into the Newton computation because the estimate employs a finite difference. Thus, for exploratory computations, Newton’s method is often preferable. When only one interpolation is to be performed, the Lagrange and Newton formulations require comparable computational effort. However, the Lagrange version is somewhat easier to program. Because it does not require computation and storage of divided differences, the Lagrange form is often used when the order of the polynomial is known a priori.

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS The interpolating polynomial with high degree oscillates wildly Figure shows a ruddy duck in flight. To approximate the top profile of the duck, we have chosen points along the curve through which we want the approximating curve to pass. The table lists the coordinates of 21 data. Notice that more points are used when the curve is changing rapidly than when it is changing more slowly.

Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS close all; clc; clear; xdata=[0.9 1.3 1.9 2.1 2.6 3.0 3.9 4.4 4.7 5.0 6.0 7.0 ... 8.0 9.2 10.5 11.3 11.6 12.0 12.6 13.0 13.3]; ydata=[1.30 1.50 1.85 2.10 2.60 2.70 2.40 2.15 2.05 2.10 2.25 2.30 ... 2.25 1.95 1.40 0.90 0.70 0.60 0.50 0.40 0.25]; x=xdata(1:2:21); y=ydata(1:2:21); xq = 0.9:0.01:13.3; [yq] = langrange(x,y,xq); plot(xq,yq,'-r','linewidth',1.5)