Transcript Lagrangian Method Power Point Interpolation
Lagrangian Interpolation
Major: All Engineering Majors Authors: Autar Kaw, Jai Paul http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM Undergraduates http://numericalmethods.eng.usf.edu
1
Lagrange Method of Interpolation
http://numericalmethods.eng.usf.edu
3
What is Interpolation ?
Given (x 0 ,y 0 ), (x 1 ,y 1 ), …… (x n ,y n ), find the value of ‘y’ at a value of ‘x’ that is not given.
http://numericalmethods.eng.usf.edu
4
Interpolants Polynomials are the most common choice of interpolants because they are easy to: Evaluate Differentiate, and Integrate
.
http://numericalmethods.eng.usf.edu
5
Lagrangian Interpolation
Lagrangian interpolating polynomial is given by
f n
(
x
)
i n
0
L i
(
x
)
f
(
x i
) where ‘
n
’ in
f n
(
x
) stands for the
n th
order polynomial that approximates the function
y
given at (
n
1 ) data points as
x
0 ,
y
0
x
1 ,
y
1 ,......,
x n
1 ,
y n
1
x n
,
y n
, and
f
(
x
)
L i
(
x
)
j j n
i
0
x x i
x j x j L i
(
x
) is a weighting function that includes a product of (
n
1 ) terms with terms of omitted.
j
i
http://numericalmethods.eng.usf.edu
6
Example
The upward velocity of a rocket is given as a function of time in Table 1. Find the velocity at t=16 seconds using the Lagrangian method for linear interpolation.
Table Velocity as a function of time
t
(s)
v
(
t
) (m/s) 0 10 15 20 22.5
30 0 227.04
362.78
517.35
602.97
901.67
Figure. Velocity vs. time data for the rocket example http://numericalmethods.eng.usf.edu
7
Linear Interpolation
517.35
550
v
(
t
)
i
1 0
L i
(
t
)
v
(
t i
)
L
0 (
t
)
v
(
t
0 )
L
1 (
t
)
v
(
t
1 ) 500 y s f range ) desired 450
t
0
t
1 15 , 0 362 .
78 20 , 1 517 .
35 400 362.78
350 10 x s 0 10 12 14 16 18 x s range x desired 20 22 24 x s 1 10 http://numericalmethods.eng.usf.edu
8
Linear Interpolation (contd)
L
0 (
t
)
j j
1 0 0
t t
0
t j
t j
t t
0
t
1
t
1
L
1 (
t
)
j j
1 0 1
t t
1
t j
t j
t t
1
t
0
t
0
v
(
t
)
t t
0
t
1
t
1
v
(
t
0 )
t t
1
t
0
t
0
v
(
t
1 )
t
15 20 20 ( 362 .
78 )
t
15 20 15 ( 517 .
35 )
v
( 16 ) 16 15 20 20 ( 362 .
78 ) 16 15 20 15 ( 517 .
35 ) 0 .
8 ( 362 .
78 ) 0 .
2 ( 517 .
35 ) 393 .
7 m/s. http://numericalmethods.eng.usf.edu
9
Quadratic Interpolation
For the second order polynomial interpolatio n (also called quadratic interpolation), we choose the velocity given by
v
(
t
)
i
2 0
L i
(
t
)
v
(
t i
)
L
0 (
t
)
v
(
t
0 )
L
1 (
t
)
v
(
t
1 )
L
2 (
t
)
v
(
t
2 ) http://numericalmethods.eng.usf.edu
10
Example
The upward velocity of a rocket is given as a function of time in Table 1. Find the velocity at t=16 seconds using the Lagrangian method for quadratic interpolation.
Table Velocity as a function of time
t
(s)
v
(
t
) (m/s) 0 10 15 20 22.5
30 0 227.04
362.78
517.35
602.97
901.67
Figure. Velocity vs. time data for the rocket example http://numericalmethods.eng.usf.edu
11
Quadratic Interpolation (contd)
t
0 10 ,
v
(
t
0 ) 227 .
04
t t
2 1 15 ,
v
(
t
1 ) 20 ,
v
(
t
2 ) 362 .
78 517 .
35
L
0 (
t
)
j j
2 0 0
t t
0
t j
t j
t t
0
t
1
t
1
t t
0
t
2
t
2
L
1 (
t
)
j j
2 0 1
t t
1
t
t j j
t
1
t
t
0
t
0
t
1
t
t
2
t
2
L
2 (
t
)
j j
2 0 2
t t
2
t j
t j
t t
2
t
0
t
0
t t
2
t
1
t
1 517.35
550 500 450 y s f range ) desired 400 350 300 250 227.04
200 10 10 12 14 16 x s range x desired 18 20 20 http://numericalmethods.eng.usf.edu
12
Quadratic Interpolation (contd)
v v t
t t
0
t
1
t
1
t t
0
t
2
t
2
v t
0
t t
1
t t
0 0
t t
1
t t
2 2
v
1
t t
2
t
0
t
0
t t
2
t
1
t
1
v
2 16 10 15 15 0 .
08 16 10 227 .
04 20 20 227 .
04 362 .
78 16 15 10 10 0 .
12 16 15 20 20 527 .
35 362 .
78 16 20 10 10 16 20 15 15 517 .
35 392 .
19 m/s The absolute relative approximate error obtained between the results from the first and second order polynomial is
a
392 .
19 393 .
70 100 392 .
19 0 .
38410 % http://numericalmethods.eng.usf.edu
Cubic Interpolation
13 For the third order polynomial (also called cubic interpolation), we choose the velocity given by
v
(
t
)
i
3 0
L i
(
t
)
v
(
t i
)
L
0 (
t
)
v
(
t
0 )
L
1 (
t
)
v
(
t
1 )
L
2 (
t
)
v
(
t
2 )
L
3 (
t
)
v
(
t
3 ) 602.97
700 600 y s f range ) desired 500 400 300 227.04
200 10 10 12 14 16 18 x s range x desired 20 22 24 22.5
http://numericalmethods.eng.usf.edu
14
Example
The upward velocity of a rocket is given as a function of time in Table 1. Find the velocity at t=16 seconds using the Lagrangian method for cubic interpolation.
Table Velocity as a function of time
t
(s)
v
(
t
) (m/s) 0 10 15 20 22.5
30 0 227.04
362.78
517.35
602.97
901.67
Figure. Velocity vs. time data for the rocket example http://numericalmethods.eng.usf.edu
Cubic Interpolation (contd)
15
t o
10 ,
v
o
227 .
04
t
2 20 ,
v
2 517 .
35
t
1 15 ,
v
1 362 .
78
t
3 22 .
5 ,
v
3 602 .
97
L
0 (
t
)
j j
3 0 0
t
0
t
t j
t j
t t
0
t
1
t
1
t t
0
t
2
t
2
t
0
t
t
3
t
3 ;
L
1 (
t
)
j j
3 1 0
t
1
t
t
t j j
t t
1
t
0
t
0
t t
1
t
2
t
2
t
1
t
t
3
t
3
L
2 (
t
)
j j
3 0 2
t t
2
t j
t j
t
2
t
t
0
t
0
t t
2
t
1
t
1
t
2
t
t
3
t
3 ;
L
3 (
t
)
j j
3 0 3
t
3
t
t j
t j
t t
3
t
0
t
0
t t
3
t t
1 1
t
3
t
t
2
t
2 602.97
700 600 y s f range ) desired 500 400 300 227.04
200 10 10 12 14 16 18 x s range x desired 20 22 24 22.5
http://numericalmethods.eng.usf.edu
16
Cubic Interpolation (contd)
v
t t
0
t
1
t
1
t t
0
t
2
t
2
t t
0
t
3
t
3
v
1
t t
1
t
0
t
0
t t
1
t
2
t
2
t t
1
t
3
t
3
v
2
v
t t
2
t
0
t
0
t t
2
t
1
t
1
t t
2
t
3
t
3
v
2
t t
3
t
1
t
1
t t
3
t
1
t
1
t t
3
t
2
t
2
v
3 16 15 10 15 16 10 20 20 16 10 22 .
5 22 .
5 227 .
04 16 10 16 20 15 10 15 20 16 15 22 .
5 22 .
5 362 .
16 20 0 .
10 10 0416 16 15 16 22 .
5 517 .
35 20 15 227 .
04 20 22 .
5 0 .
832 362 .
78 0 .
312 16 22 .
5 10 10 517 .
35 16 22 .
5 0 .
15 16 20 15 1024 22 .
602 .
5 20 97 392 .
06 m/s 78 602 .
97 The absolute relative approximate error obtained between the results from the first and second order polynomial is
a
392 .
06 392 .
19 100 392 .
06 0 .
033269 % http://numericalmethods.eng.usf.edu
17
Comparison Table
Order of Polynomial
v(t=16) m/s Absolute Relative Approximate Error
1
393.69
--------
2
392.19
3
392.06
0.38410% 0.033269% http://numericalmethods.eng.usf.edu
18
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s to t=16s ?
v
(
t
) (
t
3 57 .
5
t
2 1087 .
5
t
6750 )( 0 .
36326 ) (
t
3 52 .
5
t
2 875
t
4500 )( 1 .
9348 ) (
t
3 47 .
5
t
2 712 .
5
t
3375 )( 4 .
1388 ) (
t
3 45
t
2 650
t
3000 )( 2 .
5727 )
v
(
t
) 4 .
245 21 .
265
t
0 .
13195
t
2 0 .
00544
t
3 , 10
t
22 .
5
s
( 16 )
s
( 11 ) 16 11
v
(
t
)
dt
16 11 ( 4 .
245 21 .
265
t
0 .
13195
t
2 0 .
00544
t
3 )
dt
[ 4 .
245
t
21 .
265
t
2 2 0 .
13195
t
3 3 0 .
00544
t
4 4 ] 16 11 m http://numericalmethods.eng.usf.edu
19
Acceleration from Velocity Profile
Find the acceleration of the rocket at t=16s given that
v
(
t
) 4 .
245 21 .
265
t
0 .
13195
t
2 0 .
00544
t
3 , 10
t
22 .
5
a
d dt v
d dt
4 .
245 21 .
265
t
0 .
13195
t
2 0 .
, 00544
t
3 21 .
265 0 .
26390
t
0 .
01632
t
2
a
( 16 ) 21 .
265 0 .
26390 ( 16 ) 0 .
01632 ( 16 ) 2 29 .
665
m
/
s
2 http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit http://numericalmethods.eng.usf.edu/topics/lagrange_ method.html
THE END
http://numericalmethods.eng.usf.edu