0% found this document useful (0 votes)
14 views

Lagrange Interpolation

Uploaded by

muhammad.786685
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Lagrange Interpolation

Uploaded by

muhammad.786685
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Interpolation and Polynomial Approximation

Applications
In chapter 1 we found polynomial approximation of a function using Taylor’s
formula about a point x 0 . What if we have a data set of two or more points? Like
population of a country taken every 10 years as:

Year 1960 1970 1980 1990 2000 2010

Population 179,323 203,302 226,542 249,633 281,422 308,746


(in thousands)

To find estimated population in 1975 or in 2008, called interpolation, we can use


Lagrange polynomial.

Geometric Meaning

Algorithm
Lagrange Interpolating Polynomials
A polynomial of degree one passing through points (x 0 , y 0) and (x 1 , y 1 ) is same as
approximating a function f with y 0=f (x 0 ) and y 1=f (x 1).
Lagrange polynomial for it is
P1 ( x ) =L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 ) with
x−x 1 x −x 0
L0 ( x ) = and L1 ( x )= .
x 0−x 1 x 1−x 0

Similarly for three points ( x 0 , y 0 ) ,(x 1 , y 1) and (x 2 , y 2 ), we have to calculate three


coefficient polynomials L0 ( x ) , L1 ( x ) , L2 ( x) and Lagrange polynomial for it is
P2 ( x ) =L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 ) + L2 ( x ) f ( x 2 ) with

(x−x 1 )( x−x 2)
L0 ( x ) =
(x−x 0 )(x−x 2) and
(x ¿ ¿ 0−x 1 )( x ¿ ¿ 0−x 2), L1 ( x )= ¿¿
(x ¿ ¿ 1−x 0 )( x ¿ ¿ 1−x 2)¿ ¿
(x−x 0)(x−x 1 )
L2 ( x ) =
(x ¿ ¿2−x 0)(x ¿ ¿ 2−x 1 )¿ ¿

Next, can you guess Lagrange polynomial for four points?

Yes…
For ( x 0 , y 0 ) , ( x 1 , y1 ) ,(x 2 , y 2) and (x 3 , y 3 ), Lagrange polynomial will be
P3 ( x )=L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 ) + L2 ( x ) f ( x 2 ) + L3 ( x ) f ( x 3 ) with

( x−x 1)( x−x 2 )(x−x 3)


L0 ( x ) =
( x−x 0)(x−x 2 )(x−x 3) ,
(x ¿ ¿ 0−x 1 )( x ¿ ¿ 0−x 2)( x ¿ ¿ 0−x 3), L1 ( x )= ¿¿¿
( x ¿ ¿ 1−x 0 )(x ¿ ¿ 1−x 2)(x ¿ ¿ 1−x 3 )¿ ¿ ¿

(x−x 0 )( x−x 1)( x −x3 )


L2 ( x ) =
(x−x 0)( x−x1 )(x−x 2) .
(x ¿ ¿2−x 1)(x ¿ ¿ 2−x 1 )( x ¿ ¿ 2−x 3) , L3 ( x )= ¿¿¿
(x ¿ ¿ 3−x 0 )( x ¿ ¿ 3−x 1 )(x ¿ ¿3−x 2)¿ ¿ ¿

Example 1
Determine the linear Lagrange interpolating polynomial that passes through the points

(2 , 4 ) and (5 , 1) .

Solution. Lagrange polynomial for ( x 0 , y 0 )=( 2 , 4 ) and ( x 1 , y 1 ) =( 5 ,1 ) is


P1 ( x ) =L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 )

with
x−x 1 x−5 x −x 0 x−2
L0 ( x ) = = and L1 ( x )= = .
x 0−x 1 −3 x 1−x 0 3
Hence,
−1 1
P1 ( x ) = ( x −5 ) 4+ ( x −2 ) 1=−x+ 6 .
3 3

*You can see that it is the same linear equation, you have derived in calculus from
the point slope form of the equation using two points. The advantage is that the
Lagrange polynomial is not only for polynomials of degree one but can be
extended to polynomials of degree n using n+1 points of any given data.

Example 2
1
Use x 0=2 , x1 =2.75 and x 2=4 to find Lagrange polynomial for f ( x )= . Use this
x
polynomial to approximate f ( 3 ).
Solution: First determine coefficient polynomials L0 ( x ) , L1 ( x ) ,∧¿ L2 (x) as
(x−x 1)(x−x 2 )
L0 ( x ) =
(x−2.75)(x−4) 2
(x ¿ ¿ 0−x 1 )( x ¿ ¿ 0−x 2)= = ( x−2.75 ) ( x−4 ) ,¿ ¿
(2−2.75)(2−4) 3
( x−x 0)( x−x 2 )
L1 ( x ) =
(x −2)(x −4) −16
(x ¿ ¿1−x 0)(x ¿ ¿ 1−x 2 )= = ( x−2 ) ( x−4 ) ,¿ ¿
(2.75−2)(2.75−4) 15
( x−x 0)(x−x 1 )
¿ L2 ( x ) =
( x−2)(x−2.75) 2
(x ¿ ¿2−x 0)(x ¿ ¿ 2−x 1 )= = ( x −2 )( x−2.75 ) . ¿ ¿
( 4−2)(4−2.75) 5

Therefore, polynomial for it is


P2 ( x ) =L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 ) + L2 ( x ) f ( x 2 )

2 1 16 1 2 1
¿ ( x−2.75 )( x−4 ) − ( x−2 ) ( x−4 ) + ( x−2 ) ( x −2.75 )
3 2 15 2.75 5 4
1 2 35 49
⟹ P2 (x)= x − x+
22 88 44
1
So, P2 (3)=0.32955 while f ( 3 )= =0.33333 .
3

Advantage over Taylor Polynomials


For the Taylor polynomials all the information used in the approximation is
concentrated at the single number x 0, so these polynomials will generally give
inaccurate approximations as we move away from x 0. This limits Taylor
polynomial approximation to the situation in which approximations are needed
only at numbers close to x 0. For ordinary computational purposes it is more
efficient to use methods that include information at various points. The primary use
of Taylor polynomials in numerical analysis is not for approximation purposes, but
for the derivation of numerical techniques and error estimation.

Problem 1
The following data of the velocity of a body is given as a function of time.
Time (s) 10 15 18 22 24
Velocity (m/s) 22 24 37 25 123
A quadratic Lagrange interpolating polynomial is formed using three data points,
t 15 , 18, & 22. Use this information to evaluate that at what times (in seconds) is the
velocity of the body 26 m/s during the time interval of t=15 to t=22 seconds.
Problem 2
The following table shows the population of US from 1960 to 2010
Year 1960 1970 1980 1990 2000 2010
Population 179,323 203,302 226,542 249,633 281,422 308,746
(in
thousands)
a. Use Lagrange Interpolation to approximate the population in the years 1950,
1975, 2014, and 2020.
b. The population in 1950 was approximately 150,697,360, and in 2014 the
population was estimated to be 317,298,000. How accurate do you think
your 1975 and 2020 figures are?
Problem 3
Let P3 (x ) be the Lagrange interpolating polynomial for the data
( 0 , 0 ) , ( 0.5 , y ) , ( 1 , 3 ) ,∧( 2 , 2 ) .
a. Find y if the coefficient of x 3 in P3 (x ) is 6.
b. Find P3 (x ).

Practice
Exercise 3.1
Q. For x 0=0 , x 1=0. 6, x 2=0.9 and f ( x )= √ 1+ x , construct
Lagrange interpolation polynomial of degree 1 & 2 to approximate f ( 0.45 ) and find error.

Solution: (i) Lagrange polynomial of degree 1


For x 0=0 , x 1=0. 6 , f ( x 0 ) =1 , f ( x1 ) =√ 1.6

x−x 1 x−0.6 −5
L0 ( x ) = = = ( x−0.6 )
x 0−x 1 −0.6 3
x−x 0 x−0 5
and L1 ( x )= = = x.
x1 −x0 0.6 3
5 5
Hence, P1 ( x ) =L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 ) ¿− 3 ( x−0.6 ) 1+ 3 x √1.6

⟹ P ( 0.45 )=1.19868 ,

while f ( 0.45 )=1.20416

So, Absolute Error =0.00548


(ii) Lagrange polynomial of degree 2
For x 0=0 , x 1=0. 6 , x 2=0. 9 , f ( x 0 ) =1 , f ( x1 ) =√ 1.6 , f ( x 2) =√ 1.9

( x−x 1)( x−x 2 )


L0 ( x ) =
(x−0.6)(x−0.9)
(x ¿ ¿ 0−x 1 )( x ¿ ¿ 0−x 2)= ,¿ ¿
(−0.6)(−0.9)
(x−x 0 )(x−x 2)
L1 ( x ) =
x (x−0.9)
(x ¿ ¿1−x 0)(x ¿ ¿ 1−x 2 )= ,¿ ¿
(0.6)(−0.3)
(x−x 0 )( x−x 1)
¿ L2 ( x ) =
x ( x−0.6)
(x ¿ ¿2−x 0)(x ¿ ¿ 2−x 1 )= .¿¿
(0.9)(0.3)
Therefore, P2 ( x ) =L0 ( x ) f ( x 0 ) + L1 ( x ) f ( x 1 ) + L2 ( x ) f ( x 2 )
(x−0.6)(x −0.9) x (x−0.9) x( x−0.6)
¿ 1− √ 1.6+ √ 1.9
0.54 0.18 0.27
⟹ P ( 0.45 )=1.20342

So, Absolute Error = 0.00074

You might also like