You are on page 1of 11

05.05.

1





Chapter 05.04
Lagrangian Interpolation





After reading this chapter, you should be able to:
1. derive Lagrangian method of interpolation,
2. solve problems using Lagrangian method of interpolation, and
3. use Lagrangian interpolants to find derivatives and integrals of discrete functions.

What is interpolation?
Many times, data is given only at discrete points such as ( ), ,
0 0
y x ( )
1 1
, y x , ......, ( )
1 1
,
n n
y x ,
( )
n n
y x , . So, how then does one find the value of y at any other value of x ? Well, a
continuous function ( ) x f may be used to represent the 1 + n data values with ( ) x f passing
through the 1 + n points (Figure 1). Then one can find the value of y at any other value of
x . This is called interpolation.
Of course, if x falls outside the range of x for which the data is given, it is no longer
interpolation but instead is called extrapolation.
So what kind of function ( ) x f should one choose? A polynomial is a common
choice for an interpolating function because polynomials are easy to
(A) evaluate,
(B) differentiate, and
(C) integrate,
relative to other choices such as a trigonometric and exponential series.
Polynomial interpolation involves finding a polynomial of order n that passes
through the 1 + n data points. One of the methods used to find this polynomial is called the
Lagrangian method of interpolation. Other methods include Newtons divided difference
polynomial method and the direct method. We discuss the Lagrangian method in this
chapter.
05.05.2 Chapter 05.05


Figure 1 Interpolation of discrete data.


The Lagrangian interpolating polynomial is given by

=
=
n
i
i i n
x f x L x f
0
) ( ) ( ) (
where n in ) (x f
n
stands for the
th
n order polynomial that approximates the function
) (x f y = given at 1 + n data points as ( ) ( ) ( ) ( )
n n n n
y x y x y x y x , , , ,......, , , ,
1 1 1 1 0 0
, and

[
=
=

=
n
i j
j j i
j
i
x x
x x
x L
0
) (
) (x L
i
is a weighting function that includes a product of 1 n terms with terms of i j =
omitted. The application of Lagrangian interpolation will be clarified using an example.

Example 1
The upward velocity of a rocket is given as a function of time in Table 1.

Table 1 Velocity as a function of time.
t (s) ) (t v (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

( )
0 0
, y x
( )
1 1
, y x
( )
2 2
, y x
( )
3 3
, y x
( ) x f
x
y
Lagrangian Interpolation 05.05.3







Determine the value of the velocity at 16 = t seconds using a first order Lagrange
polynomial.

Solution
For first order polynomial interpolation (also called linear interpolation), the velocity is given
by

=
=
1
0
) ( ) ( ) (
i
i i
t v t L t v
) ( ) ( ) ( ) (
1 1 0 0
t v t L t v t L + =


Figure 2 Graph of velocity vs. time data for the rocket example.

05.05.4 Chapter 05.05

Figure 3 Linear interpolation.

Since we want to find the velocity at 16 = t , and we are using a first order polynomial, we
need to choose the two data points that are closest to 16 = t that also bracket 16 = t to
evaluate it. The two points are 15
0
= t and 20
1
= t .
Then
( ) 78 . 362 , 15
0 0
= = t v t
( ) 35 . 517 , 20
1 1
= = t v t
gives

[
=
=

=
1
0
0 0
0
) (
j
j j
j
t t
t t
t L

1 0
1
t t
t t

=

[
=
=

=
1
1
0 1
1
) (
j
j j
j
t t
t t
t L

0 1
0
t t
t t

=
Hence
) ( ) ( ) (
1
0 1
0
0
1 0
1
t v
t t
t t
t v
t t
t t
t v

=
20 15 ), 35 . 517 (
15 20
15
) 78 . 362 (
20 15
20
s s

= t
t t

) 35 . 517 (
15 20
15 16
) 78 . 362 (
20 15
20 16
) 16 (

= v
( )
0 0
, y x
( )
1 1
, y x
( ) x f
1
x
y

Lagrangian Interpolation 05.05.5

) 35 . 517 ( 2 . 0 ) 78 . 362 ( 8 . 0 + =
m/s 69 . 393 =
You can see that 8 . 0 ) (
0
= t L and 2 . 0 ) (
1
= t L are like weightages given to the velocities at
15 = t and 20 = t to calculate the velocity at 16 = t .

Quadratic Interpolation


Figure 4 Quadratic interpolation.

Example 2
The upward velocity of a rocket is given as a function of time in Table 2.

Table 2 Velocity as a function of time.
t (s) ) (t v (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

a) Determine the value of the velocity at 16 = t seconds with second order polynomial
interpolation using Lagrangian polynomial interpolation.
b) Find the absolute relative approximate error for the second order polynomial
approximation.
( )
0 0
, y x
( )
1 1
, y x
( )
2 2
, y x
( ) x f
2
y
x
05.05.6 Chapter 05.05


Solution
a) For second order polynomial interpolation (also called quadratic interpolation), the
velocity is given by

=
=
2
0
) ( ) ( ) (
i
i i
t v t L t v
) ( ) ( ) ( ) ( ) ( ) (
2 2 1 1 0 0
t v t L t v t L t v t L + + =
Since we want to find the velocity at 16 = t , and we are using a second order polynomial, we
need to choose the three data points that are closest to 16 = t that also bracket 16 = t to
evaluate it. The three points are 20 and , 15 , 10
2 1 0
= = = t t t .
Then
( ) 04 . 227 , 10
0 0
= = t v t
( ) 78 . 362 , 15
1 1
= = t v t
( ) 35 . 517 , 20
2 2
= = t v t
gives

[
=
=

=
2
0
0 0
0
) (
j
j j
j
t t
t t
t L

|
|
.
|

\
|

|
|
.
|

\
|

=
2 0
2
1 0
1
t t
t t
t t
t t


[
=
=

=
2
1
0 1
1
) (
j
j j
j
t t
t t
t L

|
|
.
|

\
|

|
|
.
|

\
|

=
2 1
2
0 1
0
t t
t t
t t
t t


[
=
=

=
2
2
0 2
2
) (
j
j j
j
t t
t t
t L

|
|
.
|

\
|

|
|
.
|

\
|

=
1 2
1
0 2
0
t t
t t
t t
t t

Hence
2 0 2
1 2
1
0 2
0
1
2 1
2
0 1
0
0
2 0
2
1 0
1
), ( ) ( ) ( ) ( t t t t v
t t
t t
t t
t t
t v
t t
t t
t t
t t
t v
t t
t t
t t
t t
t v s s
|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

=

) 35 . 517 (
) 15 20 )( 10 20 (
) 15 16 )( 10 16 (
) 78 . 362 (
) 20 15 )( 10 15 (
) 20 16 )( 10 16 (
) 04 . 227 (
) 20 10 )( 15 10 (
) 20 16 )( 15 16 (
) 16 (


+


+


= v

) 35 . 517 )( 12 . 0 ( ) 78 . 362 )( 96 . 0 ( ) 04 . 227 )( 08 . 0 ( + + =
m/s 19 . 392 =
Lagrangian Interpolation 05.05.7

b) The absolute relative approximate error
a
e for the second order polynomial is calculated
by considering the result of the first order polynomial (Example 1) as the previous
approximation.
100
19 . 392
69 . 393 19 . 392

= e
a

% 38410 . 0 =

Example 3
The upward velocity of a rocket is given as a function of time in Table 3.

Table 3 Velocity as a function of time
t (s) ) (t v (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

a) Determine the value of the velocity at 16 = t seconds using third order Lagrangian
polynomial interpolation.
b) Find the absolute relative approximate error for the third order polynomial approximation.
c) Using the third order polynomial interpolant for velocity, find the distance covered by the
rocket from s 11 = t to s 16 = t .
d) Using the third order polynomial interpolant for velocity, find the acceleration of the
rocket at s 16 = t .

Solution
a) For third order polynomial interpolation (also called cubic interpolation), the velocity is
given by

=
=
3
0
) ( ) ( ) (
i
i i
t v t L t v
) ( ) ( ) ( ) ( ) ( ) ( ) ( ) (
3 3 2 2 1 1 0 0
t v t L t v t L t v t L t v t L + + + =

05.05.8 Chapter 05.05

Figure 5 Cubic interpolation.

Since we want to find the velocity at 16 = t , and we are using a third order polynomial, we
need to choose the four data points closest to 16 = t that also bracket 16 = t to evaluate it.
The four points are 20 , 15 , 10
2 1 0
= = = t t t and 5 . 22
3
= t .
Then
( ) 04 . 227 , 10
0 0
= = t v t
( ) 78 . 362 , 15
1 1
= = t v t
( ) 35 . 517 , 20
2 2
= = t v t
( ) 97 . 602 , 5 . 22
3 3
= = t v t
gives

[
=
=

=
3
0
0 0
0
) (
j
j j
j
t t
t t
t L

|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
3 0
3
2 0
2
1 0
1
t t
t t
t t
t t
t t
t t


[
=
=

=
3
1
0 1
1
) (
j
j j
j
t t
t t
t L

|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
3 1
3
2 1
2
0 1
0
t t
t t
t t
t t
t t
t t


[
=
=

=
3
2
0 2
2
) (
j
j j
j
t t
t t
t L

|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
3 2
3
1 2
1
0 2
0
t t
t t
t t
t t
t t
t t

( )
0 0
, y x
( )
1 1
, y x
( )
2 2
, y x
( )
3 3
, y x
( ) x f
3
x
y
Lagrangian Interpolation 05.05.9


[
=
=

=
3
3
0 3
3
) (
j
j j
j
t t
t t
t L

|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
2 3
2
1 3
1
0 3
0
t t
t t
t t
t t
t t
t t

Hence

3 0 3
2 3
2
1 3
1
0 3
0
2
3 2
3
1 2
1
0 2
0
1
3 1
3
2 1
2
0 1
0
0
3 0
3
2 0
2
1 0
1
), ( ) (
) ( ) ( ) (
t t t t v
t t
t t
t t
t t
t t
t t
t v
t t
t t
t t
t t
t t
t t
t v
t t
t t
t t
t t
t t
t t
t v
t t
t t
t t
t t
t t
t t
t v
s s
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=


) 97 . 602 (
) 20 5 . 22 )( 15 5 . 22 )( 10 5 . 22 (
) 20 16 )( 15 16 )( 10 16 (

) 35 . 517 (
) 5 . 22 20 )( 15 20 )( 10 20 (
) 5 . 22 16 )( 15 16 )( 10 16 (

) 78 . 362 (
) 5 . 22 15 )( 20 15 )( 10 15 (
) 5 . 22 16 )( 20 16 )( 10 16 (
) 04 . 227 (
) 5 . 22 10 )( 20 10 )( 15 10 (
) 5 . 22 16 )( 20 16 )( 15 16 (
) 16 (


+


+


+


= v

) 97 . 602 )( 1024 . 0 ( ) 35 . 517 )( 312 . 0 ( ) 78 . 362 )( 832 . 0 ( ) 04 . 227 )( 0416 . 0 ( + + + =
m/s 06 . 392 =
b) The absolute percentage relative approximate error,
a
e for the value obtained for ) 16 ( v
can be obtained by comparing the result with that obtained using the second order
polynomial (Example 2)
100
06 . 392
19 . 392 06 . 392

= e
a

% 033269 . 0 =
c) The distance covered by the rocket between s 11 = t to s 16 = t can be calculated from the
interpolating polynomial as

5 . 22 10 ), 97 . 602 (
) 20 5 . 22 )( 15 5 . 22 )( 10 5 . 22 (
) 20 )( 15 )( 10 (

) 35 . 517 (
) 5 . 22 20 )( 15 20 )( 10 20 (
) 5 . 22 )( 15 )( 10 (

) 78 . 362 (
) 5 . 22 15 )( 20 15 )( 10 15 (
) 5 . 22 )( 20 )( 10 (
) 04 . 227 (
) 5 . 22 10 )( 20 10 )( 15 10 (
) 5 . 22 )( 20 )( 15 (
) (
s s


+


+


+


=
t
t t t
t t t
t t t t t t
t v


) 97 . 602 (
) 5 . 2 )( 5 . 7 )( 5 . 12 (
) 20 )( 150 25 (
) 35 . 517 (
) 5 . 2 )( 5 )( 10 (
) 5 . 22 )( 150 25 (
) 78 . 362 (
) 5 . 7 )( 5 )( 5 (
) 5 . 22 )( 200 30 (
) 04 . 227 (
) 5 . 12 )( 10 )( 5 (
) 5 . 22 )( 300 35 (
2 2
2 2
+
+

+
+

+
+

+
=
t t t t t t
t t t t t t

05.05.10 Chapter 05.05


) 5727 . 2 )( 3000 650 45 ( ) 1388 . 4 )( 3375 5 . 712 5 . 47 (
) 9348 . 1 )( 4500 875 5 . 52 ( ) 36326 . 0 )( 6750 5 . 1087 5 . 57 (
2 3 2 3
2 3 2 3
+ + + +
+ + + =
t t t t t t
t t t t t t
, 00544 . 0 13195 . 0 265 . 21 245 . 4
3 2
t t t + + + = 5 . 22 10 s s t
Note that the polynomial is valid between 10 = t and 5 . 22 = t and hence includes the limits
of 11 = t and 16 = t .
So

}
=
16
11
) ( ) 11 ( ) 16 ( dt t v s s

}
+ + + =
16
11
3 2
) 00544 . 0 13195 . 0 265 . 21 245 . 4 ( dt t t t

16
11
4 3 2
4
00544 . 0
3
13195 . 0
2
265 . 21 245 . 4
(

+ + + =
t t t
t
m 1605 =
d) The acceleration at 16 = t is given by
( ) ( )
16
16
=
=
t
t v
dt
d
a
Given that

3 2
00544 . 0 13195 . 0 265 . 21 245 . 4 ) ( t t t t v + + + = , 5 . 22 10 s s t
( ) ( ) t v
dt
d
t a =
( )
3 2
00544 . 0 13195 . 0 265 . 21 245 . 4 t t t
dt
d
+ + + =

2
01632 . 0 26390 . 0 265 . 21 t t + + = , 5 . 22 10 s s t

2
) 16 ( 01632 . 0 ) 16 ( 26390 . 0 265 . 21 ) 16 ( + + = a

2
m/s 665 . 29 =
Note: There is no need to get the simplified third order polynomial expression to conduct the
differentiation. An expression of the form
|
|
.
|

\
|

|
|
.
|

\
|

|
|
.
|

\
|

=
3 0
3
2 0
2
1 0
1
0
) (
t t
t t
t t
t t
t t
t t
t L
gives the derivative without expansion as

( ) ) (
0
t L
dt
d
|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

=
1 0
1
3 0
3
3 0
3
2 0
2
2 0
2
1 0
1
t t
t t
t t
t t
t t
t t
t t
t t
t t
t t
t t
t t







Lagrangian Interpolation 05.05.11

INTERPOLATION
Topic Lagrange Interpolation
Summary Textbook notes on the Lagrangian method of interpolation
Major General Engineering
Authors Autar Kaw, Michael Keteltas
Last Revised December 23, 2009
Web Site http://numericalmethods.eng.usf.edu

You might also like