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

Lagrange

The document discusses Lagrangian interpolation, which is a method to find the value of an unknown data point (y) given known data points (x,y). It describes Lagrangian interpolation polynomials, which use weighting functions called Lagrangian coefficients to approximate a function at a desired x-value based on known data points. As an example, it uses Lagrangian linear and quadratic interpolation to find the velocity of a rocket at t=16 seconds using its known velocity-time data points. The quadratic interpolation results in a more accurate velocity value with a smaller error compared to linear interpolation.

Uploaded by

Robel
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)
21 views18 pages

Lagrange

The document discusses Lagrangian interpolation, which is a method to find the value of an unknown data point (y) given known data points (x,y). It describes Lagrangian interpolation polynomials, which use weighting functions called Lagrangian coefficients to approximate a function at a desired x-value based on known data points. As an example, it uses Lagrangian linear and quadratic interpolation to find the velocity of a rocket at t=16 seconds using its known velocity-time data points. The quadratic interpolation results in a more accurate velocity value with a smaller error compared to linear interpolation.

Uploaded by

Robel
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

Lagrangian Interpolation

Mechanical Engineering

Berhe Nerea Kahsay

1
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find
the value of ‘y’ at a value of ‘x’ that is
not given.

2
Interpolants
Polynomials are the most
common choice of interpolants
because they are easy to:

Evaluate
Differentiate, and
Integrate.

3
Lagrangian Interpolation
Lagrangian interpolating polynomial is given by
n
f n ( x)  Li ( x) f ( xi )
i 0

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

Li (x) is a weighting function that includes a product of (n  1) terms with terms of j i


omitted.

4
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
Table linear
Velocity as ainterpolation.
function of time
t (s) v (t ) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

Figure. Velocity vs. time data


5 for the rocket example
Linear Interpolation
550
517.35

¿Li(t)v(t i)¿¿¿
 L0 (t )v(t 0 )  L1 (t )v(t1 )
ys

f ( range)
500

450

f x desired 

t 0 15,  t 0  362.78 400

t1 20,  t1  517.35 362.78 350


10 12 14 16 18 20 22 24
x s  10 x s  range x desired x s  10
0 1

6
Linear Interpolation
(contd)
1 t  tj t  t1
L0 (t )  
j 0 t0  t j t 0  t1
j 0

1 t  tj t  t0
L1 (t )  
j 0 t1  t j t1  t 0
j 1

t  t1 t  t0 t  20 t  15
v(t )  v(t 0 )  v(t1 )  (362.78)  (517.35)
t 0  t1 t1  t 0 15  20 20  15
16  20 16  15
v(16)  (362.78)  (517.35)
15  20 20  15
0.8(362.78)  0.2(517.35)

393.7 m/s.

7
Quadratic Interpolation
For the second order polynomial interpolation (also called quadratic interpolation), we
choose the velocity given by
2
v (t )  Li ( t ) v(t i )
i 0

 L0 (t )v (t 0 )  L1 (t ) v( t1 )  L2 (t ) v( t 2 )

8
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 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Figure. Velocity vs. time data
9 for the rocket example
Quadratic Interpolation
(contd)
550
t 0 10, v(t 0 ) 227.04 517.35

500
t1 15, v(t1 ) 362.78
t 2 20, v(t 2 ) 517.35 450

ys
400
f ( range)
2 t  tj  t  t1   t  t 2 
L0 (t )      
f x desired  350
j 0 t0  t j t  t
 0 1  0 2  t  t
j 0
300
2 t tj  t  t0  t  t 2 
L1 (t )     
j 0 t1  t j  t1  t 0   t1  t 2  250
j 1

227.04
2 t  tj  t  t 0   t  t1  200
10 12 14 16 18 20
L2 (t )     
j 0 t2  t j t  t
 2 0  2 1  t  t 10 x s  range x desired 20
j 2

10
Quadratic Interpolation
(contd)
t−t1 t−t 2 t−t 0 t−t2 t−t0 t−t 1
( )( ) ( )( ) ( )( )
v ( t )=
t 0 −t 1 t 0 −t 2
v ( t 0) +
t1 −t 0 t 1 −t 2
v ( t1 ) +
t 2 −t 0 t 2 −t 1
v (t 2 )

16−15 16−20 16−10 16−20 16−10 16−15


v ( 16 )= ( )(
10−15 10−20 ) ( 227.04 ) + ( )(
15−10 15−20 )( 362.78 ) + ( )(
20−10 20−15 )
( 517 .35 )

= ( −0.08 ) ( 227.04 ) + ( 0.96 ) ( 362 .78 ) + ( 0.12 )( 527 .35 )


= 392.19 m/s
The absolute relative approximate error |∈ a| obtained between
the results from the first and second order polynomial is

392.19−393.70
|∈ a|=| |×100
392.19
= 0.38410%
11
Cubic Interpolation
For the third order polynomial (also called cubic interpolation), we choose the velocity given by
3
v (t )  Li ( t ) v(t i )
i 0

 L0 (t ) v( t 0 )  L1 ( t ) v(t 1 )  L2 ( t ) v(t 2 )  L3 ( t ) v(t 3 )


700
602.97

600

ys 500

f ( range)


f x desired 
400

300

227.04 200
10 12 14 16 18 20 22 24
10 x s  range x desired 22.5

12
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 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67 Figure. Velocity vs. time data
13 for the rocket example
Cubic Interpolation (contd)
t o 10, v  t o  227.04 t1 15, v t1  362.78

t 2 20, v t 2  517.35 t 3 22.5, v  t 3  602.97

700
602.97
3 t  tj  t  t1  t  t2  t  t 3 
L0 (t )        ;
j 0 t0  t j t  t t  t
 0 1  0 2  0 3  t  t 600
j 0

3 t  tj  t  t0  t  t 2  t  t3  ys 500
L1 (t )       
t1  t j  t1  t 0   t1  t 2   t1  t 3 f ( range)
j 0 
j 1 
f x desired 
400

3 t  tj  t  t 0   t  t1   t  t 3 
L2 (t )        ;
t2  t j  t2  t0  t 2  t1  t 2  t3
300
j 0 
j 2

227.04
3 t  tj  t  t 0   t  t1   t  t 2  200
10 12 14 16 18 20 22 24
L3 ( t )        10 x s  range x desired 22.5

j 0 t3  t j  t3  t 0   t 3  t1   t3  t 2 
j 3

14
Cubic Interpolation (contd)
t−t 1 t−t 2 t−t 3 t−t 0 t−t 2 t−t 3
( )( )( ) ( ) ( )( )( ) ( )
v ( t )=
t 0 −t 1 t 0 −t 2 t 0 −t 3
v t1 +
t 1−t 0 t 1 −t 2 t 1−t 3
v t2

t−t 0 t−t 1 t−t 3 t−t1 t−t 1 t−t 2


( )( )( ) ( ) ( )( )( ) ( )
+
t 2 −t 0 t 2−t 1 t 2 −t 3
v t2 +
t 3 −t 1 t 3 −t 1 t 3 −t 2
v t3

16−15 16−20 16−22. 5 16−10 16−20 16−22. 5


v ( 16 )= ( )(
10−15 10−20 10−22. 5 )( ) (
( 227 . 04 ) + )(
15−10 15−20 15−22. 5)( )
( 362 .78 )

16−10 16−15 16−22. 5 16−10 16−15 16−20


+( )(
20−10 20−15 20−22. 5 )( ) (
( 517 . 35 ) + )(
22 .5−10 22 .5−15 22 .5−20 )( )( 602 . 97 )
(−0 . 0416 )( 227 . 04 ) + ( 0 .832 )( 362 .78 ) + ( 0 . 312 ) ( 517 .35 ) + (−0. 1024 )( 602 . 97 )
= 392 . 06 m/s
The absolute relative approximate error |∈ a| obtained between
the results from the first and second order polynomial is
392.06−392.19
|∈ a|=| |×100
392.06
=0.033269%
15
Comparison Table

Order of
1 2 3
Polynomial
v(t=16) m/s 393.69 392.19 392.06
Absolute
Relative 0.38410 0.033269
--------
Approximate % %
Error

16
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.265t  0.13195t 2  0.00544t 3 , 10 t 22.5
16
s(16)  s (11)  v( t ) dt
11

16

 (  4.245  21.265t  0.13195t 2  0.00544t 3 ) dt


11

t2 t3 t 4 16
[  4.245t  21.265  0.13195  0.00544 ]11
2 3 4

1605 m
17
Acceleration from Velocity
Profile
Find the acceleration of the rocket at t=16s given that

v(t )  4.245  21.265t  0.13195t 2  0.00544t 3 , 10 t  22.5

d d ,
a  t   v  t     4.245  21.265t  0.13195t  0.00544t 3 
2

dt dt

21.265  0.26390t  0.01632t 2


a (16) 21. 265  0.26390(16)  0.01632(16) 2

29.665 m / s 2

18

You might also like