Download presentation
Presentation is loading. Please wait.
1
LAGRANGE INTERPOLATING POLYNOMIALS
Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS
2
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
3
Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS
π³ π π = (πβπ)(πβπ) (πβπ)(πβπ) Consider π³ π π = π³ π π = π³ π π = π π π(π π ) π³ π π = (πβπ)(πβπ) (πβπ)(πβπ) π³ π π = π³ π π = π³ π π = π³ π π = (πβπ)(πβπ) (πβπ)(πβπ) π³ π π = π³ π π = π³ π π = π· π =πππβπ³ π π + πππβπ³ π π + πππβ π³ π π π· π = π· π = π· π = The Lagrange interpolating polynomial is simply a reformulation of the Newton polynomial that avoids the computation of divided differences.
4
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.
5
Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS
Example π π π(π π ) Estimate f (4) using Lagrange interpolating polynomials of order 3. Given the data π³ π π = βπ βπ π³ π π = (πβπ)(πβπ)(πβπ) (πβπ)(πβπ)(πβπ) = (πβπ)(πβπ)(πβπ) βπ π³ π π = βπ π π³ π π = (πβπ)(πβπ)(πβπ) (πβπ)(πβπ)(πβπ) = (πβπ)(πβπ)(πβπ) π π³ π π = (πβπ)(πβπ)(πβπ) (πβπ)(πβπ)(πβπ) = (πβπ)(πβπ)(πβπ) βπ π³ π π = βπ βπ π³ π π == π ππ π³ π π = (πβπ)(πβπ)(πβπ) (πβπ)(πβπ)(πβπ) = (πβπ)(πβπ)(πβπ) ππ π π π =βπ π³ π π + π π³ π π + ππ π³ π π + πππ³ π π π π π =βπ π³ π π + π π³ π π + ππ π³ π π + πππ³ π π π π π =βπ π π +π βπ +ππ π π +ππ π π =ππ
6
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 π₯ =π( π π ) π³ π (π)+π( π π ) π³ π (π) =π( π π )+ π π π βπ( π π ) π π β π π πβ π π =π π π πβ π π π π β π π + π( π π ) (πβ π π ) ( π π β π π ) =π( π π )+ π π π βπ( π π ) π π β π π πβ π π =π π π +π π π πβ π π π π β π π βπ π π πβ π π π π β π π =π π π +π π π πβ π π π π β π π +π π π πβ π π π π β π π =π π π π+ πβ π π π π β π π +π π π πβ π π π π β π π π π π πβ π π π π β π π + π( π π ) (πβ π π ) ( π π β π π )
7
Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS
Example π π π(π π ) 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=[ ] y=[ ] [yy] = langrange(x,y,4) [d]=Divided_diff(x,y); [yi] = eval_poly(x,d,4)
8
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 πΉ π (π)βπ[ π π+π ,π π , β―,π π ] π=π π πβ π₯ π
9
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.
10
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.
11
Sec:18.2 LAGRANGE INTERPOLATING POLYNOMIALS
close all; clc; clear; xdata=[ ]; ydata=[ ]; 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)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.