Académique Documents
Professionnel Documents
Culture Documents
04
Lagrangian Interpolation
What is interpolation?
Many times, data is given only at discrete points such as x0 , y0 , x1 , y1 , ......, xn 1 , yn 1 ,
xn , yn . So, how then does one find the value of y at any other value of x ? Well, a
continuous function f x may be used to represent the n 1 data values with f x passing
through the n 1 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 f x 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 n 1 data points. One of the methods used to find this polynomial is called the
Lagrangian method of interpolation. Other methods include Newton’s divided difference
polynomial method and the direct method. We discuss the Lagrangian method in this
chapter.
05.05.1
05.05.2 Chapter 05.05
x3 , y3
x1, y1
f x
x2 , y2
x0 , y0
x
Figure 1 Interpolation of discrete data.
where n in f n (x) stands for the n th order polynomial that approximates the function
y f (x) given at n 1 data points as x 0 , y 0 , x1 , y1 ,......, x n 1 , y n 1 , x n , y n , and
n x xj
Li ( x)
j 0 xi x j
j i
Example 1
The upward velocity of a rocket is given as a function of time in Table 1.
Figure 2 Graph of velocity vs. time data for the rocket example.
Determine the value of the velocity at t 16 seconds using a first order Lagrange
polynomial.
Solution
For first order polynomial interpolation (also called linear interpolation), the velocity is given
by
1
v(t ) Li (t )v(t i )
i 0
L0 (t )v(t 0 ) L1 (t )v(t1 )
05.05.4 Chapter 05.05
x1 , y1
f1 x
x0 , y0
x
Since we want to find the velocity at t 16 , and we are using a first order polynomial, we
need to choose the two data points that are closest to t 16 that also bracket t 16 to
evaluate it. The two points are t 0 15 and t1 20 .
Then
t 0 15, vt 0 362.78
t1 20, vt1 517.35
gives
1 t t
L0 (t )
j
j 0 t 0 t j
j 0
t t1
t 0 t1
1 t t
L1 (t )
j
j 0 1 t tj
j 1
t t0
t1 t 0
Hence
t t1 t t0
v(t ) v(t 0 ) v(t1 )
t 0 t1 t1 t 0
t 20 t 15
(362.78) (517.35), 15 t 20
15 20 20 15
16 20 16 15
v(16) (362.78) (517.35)
15 20 20 15
Lagrangian Interpolation 05.05.5
0.8(362.78) 0.2(517.35)
393.69 m/s
You can see that L0 (t ) 0.8 and L1 (t ) 0.2 are like weightages given to the velocities at
t 15 and t 20 to calculate the velocity at t 16 .
Quadratic Interpolation
x1 , y1
x2 , y 2
f 2 x
x0 , y 0
x
Example 2
The upward velocity of a rocket is given as a function of time in Table 2.
a) Determine the value of the velocity at t 16 seconds with second order polynomial
interpolation using Lagrangian polynomial interpolation.
b) Find the absolute relative approximate error for the second order polynomial
approximation.
05.05.6 Chapter 05.05
Solution
a) For second order polynomial interpolation (also called quadratic interpolation), the
velocity is given by
2
v(t ) Li (t )v(t i )
i 0
t t1 t t 2
t 0 t1 t 0 t 2
2 t t
L1 (t )
j
j 0 t1 t j
j 1
t t 0 t t 2
t t
1 0 1 2 t t
2 t t
L2 (t )
j
j 0 t 2 t j
j2
t t0 t t1
t2 t0 t 2 t1
Hence
t t1 t t 2 t t 0 t t 2 t t 0 t t1
v(t ) v(t 0 ) v(t1 ) v(t 2 ), t 0 t t 2
t 0 t1 t 0 t 2 t1 t 0 t1 t 2 t 2 t 0 t 2 t1
(16 15)(16 20) (16 10)(16 20)
v(16) (227.04) (362.78)
(10 15)(10 20) (15 10)(15 20)
(16 10)(16 15)
(517.35)
(20 10)(20 15)
(0.08)(227.04) (0.96)(362.78) (0.12)(517.35)
392.19 m/s
Lagrangian Interpolation 05.05.7
b) The absolute relative approximate error a for the second order polynomial is calculated
by considering the result of the first order polynomial (Example 1) as the previous
approximation.
392.19 393.69
a 100
392.19
0.38410%
Example 3
The upward velocity of a rocket is given as a function of time in Table 3.
a) Determine the value of the velocity at t 16 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 t 11 s to t 16 s .
d) Using the third order polynomial interpolant for velocity, find the acceleration of the
rocket at t 16 s .
Solution
a) For third order polynomial interpolation (also called cubic interpolation), the velocity is
given by
3
v(t ) Li (t )v(t i )
i 0
x3 , y3
x1, y1
f 3 x
x2 , y2
x0 , y0
x
Figure 5 Cubic interpolation.
Since we want to find the velocity at t 16 , and we are using a third order polynomial, we
need to choose the four data points closest to t 16 that also bracket t 16 to evaluate it.
The four points are t 0 10, t1 15, t 2 20 and t 3 22.5 .
Then
t 0 10, vt 0 227.04
t1 15, vt1 362.78
t 2 20, vt 2 517.35
t 3 22.5, vt 3 602.97
gives
3 t t
L0 (t )
j
j 0 t 0 t j
j 0
t t1 t t 2 t t 3
t
0 1 t 0 t 2
t t
0 3 t
3 t t
L1 (t )
j
j 0 t1 t j
j 1
t t 0 t t 2 t t 3
t1 t 0 t1 t 2 t1 t 3
3 t t
L2 (t )
j
j 0 t 2 t j
j2
t t 0 t t1 t t 3
t t t t
2 0 2 1 2 3 t t
Lagrangian Interpolation 05.05.9
3 t tj
L3 (t )
j 0 t3 t j
j 3
t t0 t t1 t t 2
t3 t0 t 3 t1 t 3 t 2
Hence
t t1 t t 2 t t 3 t t 0 t t 2 t t3
v (t ) v(t 0 ) v(t1 )
t 0 t1 t 0 t 2 t 0 t 3 t1 t 0 t1 t 2 t1 t3
t t 0 t t1 t t3 t t 0 t t1 t t 2
v(t 2 ) v(t3 ), t 0 t t3
t t t
2 0 2 1 2 3 t t t t t t
3 0 3 1 3 2 t t t
(16 15)(16 20)(16 22.5) (16 10)(16 20)(16 22.5)
v(16) (227.04) (362.78)
(10 15)(10 20)(10 22.5) (15 10)(15 20)(15 22.5)
(16 10)(16 15)(16 22.5)
(517.35)
(20 10)(20 15)(20 22.5)
(16 10)(16 15)(16 20)
(602.97)
(22.5 10)(22.5 15)(22.5 20)
(0.0416)(227.04) (0.832)(362.78) (0.312)(517.35) (0.1024)(602.97)
392.06 m/s
b) The absolute percentage relative approximate error, a for the value obtained for v(16)
can be obtained by comparing the result with that obtained using the second order
polynomial (Example 2)
392.06 392.19
a 100
392.06
0.033269%
c) The distance covered by the rocket between t 11 s to t 16 s can be calculated from the
interpolating polynomial as
(t 15)(t 20)(t 22.5) (t 10)(t 20)(t 22.5)
v(t ) (227.04) (362.78)
(10 15)(10 20)(10 22.5) (15 10)(15 20)(15 22.5)
(t 10)(t 15)(t 22.5)
(517.35)
(20 10)(20 15)(20 22.5)
(t 10)(t 15)(t 20)
(602.97), 10 t 22.5
(22.5 10)(22.5 15)(22.5 20)
(t 2 35t 300)(t 22.5) (t 2 30t 200)(t 22.5)
(227.04) (362.78)
(5)(10)(12.5) (5)(5)(7.5)
(t 2 25t 150)(t 22.5) (t 2 25t 150)(t 20)
(517.35) (602.97)
(10)(5)(2.5) (12.5)(7.5)(2.5)
05.05.10 Chapter 05.05
d
L0 (t ) t t1 t t2 t t2 t t3 t t3 t t1
dt t0 t1 t0 t2 t0 t2 t0 t3 t0 t3 t0 t1
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