Docsity

Lagrangian Interpolation Method for Finding Function Values and Derivatives, Slides of Mathematical Methods for Numerical Analysis and Optimization

Partial preview of the text

Download Lagrangian Interpolation Method for Finding Function Values and Derivatives and more Slides Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Lagrangian Interpolation

What is Interpolation?

Given (x

,y

), (x

,y

), …… (x

n

,y

n

), find the

value of ‘y’ at a value of ‘x’ that is not given.

Lagrangian Interpolation

Lagrangian interpolating polynomial is given by

∑

n

i

f n x Li x f xi

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 ) (, x 1 , y 1 ),......, ( xn − 1 , yn − 1 ) (, xn , yn ), and

∏ ≠

n

j i

j (^) i j

j i

x x

x x

L x

0

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

omitted.

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

Figure. Velocity vs. time data

for the rocket example

(s) (m/s)

0 0 10 227. 15 362. 20 517. 22.5 602. 30 901.

t v ( t )

Linear Interpolation (contd)

≠

= −

−

1

0

(^0 )

0 () j

j (^) j

j t t

t t L t 0 1

1 t t

t t

−

−

≠

= −

−

1

1

(^0 )

1 ( ) j

j (^) j

j t t

t t L t 1 0

0 t t

t t

−

−

( ) ( ) ( 1 ) 1 0

0 0 0 1

(^1) v t t t

t t v t t t

t t v t −

−

−

− = ( 517. 35 ) 20 15

15 ( 362. 78 ) 15 20

20 −

−

−

−

t t

( 517. 35 ) 20 15

16 15 ( 362. 78 ) 15 20

16 20 ( 16 ) −

−

−

− v =

= 0. 8 ( 362. 78 )+ 0. 2 ( 517. 35 )

= 393. 7 m/s.

Quadratic Interpolation

For the second order polynomial interpolation (also called quadratic interpolation), we

choose the velocity given by

=

=

2

0

( ) ( ) ( ) i

v t Li t vti

= L 0 (^) ( t ) v ( t 0 )+ L 1 ( t ) v ( t 1 )+ L 2 ( t ) v ( t 2 )

Quadratic Interpolation (contd)

This image cannot currently be displayed.

(^20010 12 14 16 18 )

250

300

350

400

450

500

517.35^550

y (^) s f range( ) f x( (^) desired)

10 x (^) s , range,x (^) desired 20

t 0 = 10 , v ( t 0 ) = 227. 04

t 1 = 15 , v ( t 1 )= 362. 78

t 2 = 20 , v ( t 2 )= 517. 35

≠

2

0 (^0 )

j j (^) j

j

t t

t t

L t 

0 2

2 0 1

1

t t

t t

t t

t t

≠

2

1 (^0 )

j j (^) j

j

t t

t t

L t 

1 2

2 1 0

0

t t

t t

t t

t t

≠

2

2 (^0 )

j j (^) j

j

t t

t t

L t 

2 1

1 2 0

0

t t

t t

t t

t t

Quadratic Interpolation (contd)

( ) ( ) ( ) ( )

( ) ( ) ( ) ( )

( )( ) ( )( ) ( )( )

  1. 19 m/s

  2. 08 227. 04 0. 96 362. 78 0. 12 527. 35

  3. 35 20 15

16 15

20 10

16 10

  1. 78 15 20

16 20

15 10

16 10

  1. 04 10 20

16 20

10 15

16 15 16

2 2 1

1

2 0

0 1 1 2

2

1 0

0 0 0 2

2

0 1

1

=

= − + +

 

  

−

−  

  

−

−  + 

  

−

−  

  

−

−  + 

  

−

−  

  

−

−

  

 

 

−

− 

 

 

 

−

−

 

 

 

−

− 

 

 

 

−

−

 

 

 

−

− 

 

 

 

−

−

v

v t t t

t t

t t

t t vt t t

t t

t t

t t vt t t

t t

t t

t t v t

The absolute relative approximate error obtained between the results from the first and second order polynomial is

∈ a

  1. 38410 %

100

  1. 19

  2. 19 393. 70

=

×

− ∈ a =

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

Figure. Velocity vs. time data

for the rocket example

(s) (m/s)

0 0 10 227. 15 362. 20 517. 22.5 602. 30 901.

t v ( t )

Cubic Interpolation (contd)

t (^) o = 10 , v ( t (^) o ) = 227. 04 t 1 = 15 , v ( t 1 ) = 362. 78

t 2 = 20 , v ( t 2 ) = 517. 35 t 3 = 22. 5 , v ( t 3 ) = 602. 97

≠

3

0 (^0 )

j j (^) j

j

t t

t t

L t 

0 3

3 0 2

2 0 1

1

t t

t t

t t

t t

t t

t t

≠

3

1 (^0 )

j j (^) j

j

t t

t t

L t 

1 3

3 1 2

2 1 0

0

t t

t t

t t

t t

t t

t t

≠

3

2 (^0 )

j j (^) j

j

t t

t t

L t 

2 3

3 2 1

1 2 0

0

t t

t t

t t

t t

t t

t t

≠

3

3 (^0 )

j j (^) j

j

t t

t t

L t 

3 2

2 3 1

1 3 0

0

t t

t t

t t

t t

t t

t t^20010 12 14 16 18 20 22

300

400

500

600

602.97^700

y (^) s f range( ) f x( (^) desired)

10 x (^) s , range,x (^) desired 22.

Comparison Table

Order of Polynomial 1 2 3

v(t=16) m/s 393.69 392.19 392.

Absolute Relative

Approximate Error

Distance from Velocity Profile

Find the distance covered by the rocket from t=11s to

t=16s?

( ) 4. 245 21. 265 0. 13195 0. 00544 , 2 3 v t = − + t + t + t 10 ≤ t ≤ 22. 5

16

11

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

16

11

( 4. 245 21. 265 t 0. 13195 t^2 0. 00544 t^3 ) dt

16 11

2 3 4 ] 4

  1. 00544 3

  2. 13195 2

[ 4. 245 21. 265

t t t = − t + + +

= 1605 m

3 2 3 2

3 2 3 2

t t t t t t

v t t t t t t t