0% found this document useful (0 votes)
24 views18 pages

Lagrange Polynomial Interpolation Presentation-V3

Lag

Uploaded by

Yak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views18 pages

Lagrange Polynomial Interpolation Presentation-V3

Lag

Uploaded by

Yak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Lagrange Interpolation Polynomial

Sep 28, 2015


Lagrange Polynomial Interpolation

The Lagrange interpolating polynomial is simply a


reformulation of the Newton polynomial
that avoids the computation of divided
differences.

Lagrange advantage is that works for unequaled


spaced data on the independent variable
Lagrange Polynomial Interpolation

A Lagrange polynomial can be stated concisely as

Lagrange weighting functions


Lagrange
polynomial
n n x  xj
f n ( x)   Li ( x) f ( xi ) Li ( x)  
i 0 j 0 xi  x j
j i

“the sum of” “the product of”

Data points are indexed as: i=0,1,2,3,...,n


Lagrange Polynomial Interpolation

n x  xj
Li ( x)  
n
f n ( x)   Li ( x) f ( xi )
i 0 j 0 xi  x j
j i

For example:
linear n=1
n 1
1
f1 ( x)   Li ( x) f ( xi )  Lo ( x) f ( x0 )  L1 ( x) f ( x1 )
i 0

1 x  xj x  x1
L0 ( x)    note: j starts in 1 as j  i
j 1 xi  x j x0  x1
j i
Lagrange Polynomial Interpolation
For example:
n 1 linear n=1
1
f1 ( x)   Li ( x) f ( xi )  Lo ( x) f ( x0 )  L1 ( x) f ( x1 )
i 0

1 x  xj x  x1
L0 ( x)    note: j starts in 1 as j  i
j 1 xi  x j x0  x1
j i

1 x  xj x  x0
L1 ( x)    note: j starts in 0 and doesn’t
j  0 xi  x j x1  x0 run up to 1 as j must be j  i
j i

x  x1 x  x0
f1 ( x)  f ( x0 )  f ( x1 )
x0  x1 x1  x0
Lagrange Polynomial Interpolation

n x  xj
Li ( x)  
n
f n ( x)   Li ( x) f ( xi )
i 0 j 0 xi  x j
j i

For example:
n2 cuadratic n=2

( x  x1 )( x  x2 ) ( x  x0 )( x  x2 )
f1 ( x)  f ( x0 )  f ( x1 )
( x0  x1 )( x0  x2 ) ( x1  x0 )( x1  x2 )
( x  x0 )( x  x1 )
 f ( x2 )
( x2  x0 )( x2  x1 )
Lagrange Polynomial Interpolation

For example: n x  xj
n2 Li ( x)   cuadratic n=2
j 0 xi  x j
j i

2 x  xj x  x1 x  x2
L0 ( x)  
j 1

xi  x j x0  x1 x0  x2
j  (i 0 )

2 x  xj x  x0 x  x2
L1 ( x)  
j 0 xi  x j

x1  x0 x1  x2
j  ( i 1)

2 x  xj x  x0 x  x1
L2 ( x)  
j 0 xi  x j

x2  x0 x2  x1
j (i 2)

( x  x1 )( x  x2 ) ( x  x0 )( x  x2 ) ( x  x0 )( x  x1 )
f 2 ( x)  f ( x0 )  f ( x1 )  f ( x2 )
( x0  x1 )( x0  x2 ) ( x1  x0 )( x1  x2 ) ( x2  x0 )( x2  x1 )
Quiz
• Develop a Lagrange interpolating polynomial of order n=3
 In the formula, each term Li (x) will be equal to 1 for x=xi , and
zero for all other data points.
 Thus, each product Li (x) fi(x) takes on the value of f(xi) at the
data point xi.
For example, consider:

( x  x1 )( x  x2 ) ( x  x0 )( x  x2 ) ( x  x0 )( x  x1 )
f 2 ( x)  f ( x0 )  f ( x1 )  f ( x2 )
( x0  x1 )( x0  x2 ) ( x1  x0 )( x1  x2 ) ( x2  x0 )( x2  x1 )

For x=xo:
1 0 0
( x0  x1 )( x0  x2 ) ( x  x )( x  x ) ( x  x )( x  x )
f 2 ( x)  f ( x0 )  0 0 0 2 f ( x1 )  0 0 0 1 f ( x2 )
( x0  x1 )( x0  x2 ) ( x1  x0 )( x1  x2 ) ( x2  x0 )( x2  x1 )

f 2 ( x)  f ( x0 )
which is an expected results at x=xo, the
value of the function must be f(x0)
 In the formula, as x approaches xo the weight term Lo(x)
approaches 1 and L1(x) and L2(x) approach zero, i.e., more weight
is put to the pair [xo, f(x0)] and less to the other pairs in the
formula

For xxo:

1 0 0
( x0  x1 )( x0  x2 ) ( x  x )( x  x ) ( x  x )( x  x )
f 2 ( x)  f ( x0 )  0 0 0 2 f ( x1 )  0 0 0 1 f ( x2 )
( x0  x1 )( x0  x2 ) ( x1  x0 )( x1  x2 ) ( x2  x0 )( x2  x1 )
 In the formula, each term Li (x) will be equal to 1 for x=xi , and
zero for all other data points.
 Thus, each product Li (x) fi(x) takes on the value of f(xi) at the
data point xi.
In summary:

Newton’s interpolation method is preferable for exploratory computations


(n is not known a priori).
 Newton method has advantages because of the insight for the
behavior between different orders (consider Taylor series).
 Error estimate in Newton method can easily be implemented as it
employs a finite difference.

Lagrange method is preferable when only one interpolation is performed


(order n is known a priori)
It is easier for computational implementation.
Example: Linear Interpolation
• Determine the linear Lagrange interpolating polynomial that passes
through the points (2, 4) and (5, 1).

f1(x)
• The linear Lagrange
interpolating polynomial
that passes through the
points (2, 4) and (5, 1).

f1(x)
Example: Develop a 2nd degree Polynomial
• Use the numbers (called nodes) • We first determine the coefficient polynomials
x0 = 2, x1 = 2.75 and x2 = 4 to L0(x), L1(x), and L2(x):
find the second Lagrange
interpolating polynomial for
1
𝑓 𝑥 =
𝑥

• Use this polynomial to


approximate
1
𝑓 3 =
3
Therefore, we obtain

f2(x)

f2(x)
Note the good
fitting of
Lagrange
polynomial in
the range of
the nodes
x=[2,2.75,4]

f2(x)

You might also like