http://numericalmethods.eng.usf.edu 1 lagrangian interpolation major: all engineering majors...

21
http:// numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul http://numericalmethods.eng.us f.edu Transforming Numerical Methods Education for STEM Undergraduates

Upload: olivia-osborne

Post on 02-Jan-2016

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu 1

Lagrangian Interpolation

Major: All Engineering Majors

Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu

Transforming Numerical Methods Education for STEM Undergraduates

Page 2: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

Lagrange Method of Interpolation

http://numericalmethods.eng.usf.edu

Page 3: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu3

What is Interpolation ?

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

Page 4: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu4

Interpolants

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

EvaluateDifferentiate, and Integrate.

Page 5: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu5

Lagrangian Interpolation

Lagrangian interpolating polynomial is given by

n

iiin xfxLxf

0

)()()(

where ‘ n ’ in )(xf n stands for the thn order polynomial that approximates the function )(xfy

given at )1( n data points as nnnn yxyxyxyx ,,,,......,,,, 111100 , and

n

ijj ji

ji xx

xxxL

0

)(

)(xLi is a weighting function that includes a product of )1( n terms with terms of ij

omitted.

Page 6: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu6

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 010 227.0415 362.7820 517.35

22.5 602.9730 901.67

t )(tv

Page 7: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu7

Linear Interpolation

10 12 14 16 18 20 22 24350

400

450

500

550517.35

362.78

y s

f range( )

f x desired

x s1

10x s0

10 x s range x desired

)()()(1

0ii

itvtLtv

)()()()( 1100 tvtLtvtL

78.362,15 00 tt

35.517,20 11 tt

Page 8: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu8

Linear Interpolation (contd)

1

00 0

0 )(

jj j

j

tt

tttL

10

1

tt

tt

1

10 1

1 )(

jj j

j

tt

tttL

01

0

tt

tt

)()()( 101

00

10

1 tvtt

tttv

tt

tttv

)35.517(1520

15)78.362(

2015

20

tt

)35.517(1520

1516)78.362(

2015

2016)16(

v

)35.517(2.0)78.362(8.0

7.393 m/s.

Page 9: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu9

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

choose the velocity given by

2

0

)()()(i

ii tvtLtv

)()()()()()( 221100 tvtLtvtLtvtL

Page 10: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu10

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

Figure. Velocity vs. time data for the rocket example

(s) (m/s)

0 010 227.0415 362.7820 517.35

22.5 602.9730 901.67

t )(tv

Page 11: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu11

Quadratic Interpolation (contd)

10 12 14 16 18 20200

250

300

350

400

450

500

550517.35

227.04

y s

f range( )

f x desired

2010 x s range x desired

,100 t 04.227)( 0 tv

,151 t 78.362)( 1 tv

,202 t 35.517)( 2 tv

2

00 0

0 )(

jj j

j

tt

tttL

20

2

10

1

tt

tt

tt

tt

2

10 1

1 )(

jj j

j

tt

tttL

21

2

01

0

tt

tt

tt

tt

2

20 2

2 )(

jj j

j

tt

tttL

12

1

02

0

tt

tt

tt

tt

Page 12: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu12

Quadratic Interpolation (contd)

m/s19.392

35.52712.078.36296.004.22708.0

35.5171520

1516

1020

101678.362

2015

2016

1015

101604.227

2010

2016

1510

151616

212

1

02

01

21

2

01

00

20

2

10

1

v

tvtt

tt

tt

tttv

tt

tt

tt

tttv

tt

tt

tt

tttv

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

a

%38410.0

10019.392

70.39319.392

a

Page 13: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu13

Cubic Interpolation

10 12 14 16 18 20 22 24200

300

400

500

600

700602.97

227.04

y s

f range( )

f x desired

22.510 x s range x desired

For the third order polynomial (also called cubic interpolation), we choose the velocity given by

3

0

)()()(i

ii tvtLtv

)()()()()()()()( 33221100 tvtLtvtLtvtLtvtL

Page 14: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu14

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 010 227.0415 362.7820 517.35

22.5 602.9730 901.67

t )(tv

Page 15: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu15

Cubic Interpolation (contd) 04.227,10 oo tvt 78.362,15 11 tvt

35.517,20 22 tvt 97.602,5.22 33 tvt

3

00 0

0 )(

jj j

j

tt

tttL

30

3

20

2

10

1

tt

tt

tt

tt

tt

tt;

3

10 1

1 )(

jj j

j

tt

tttL

31

3

21

2

01

0

tt

tt

tt

tt

tt

tt

3

20 2

2 )(

jj j

j

tt

tttL

32

3

12

1

02

0

tt

tt

tt

tt

tt

tt;

3

30 3

3 )(

jj j

j

tt

tttL

23

2

13

1

03

0

tttt

tttt

tt

tt

10 12 14 16 18 20 22 24200

300

400

500

600

700602.97

227.04

y s

f range( )

f x desired

22.510 x s range x desired

Page 16: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu16

Cubic Interpolation (contd)

m/s06.392

97.6021024.035.517312.078.362832.004.2270416.0

97.602205.22

2016

155.22

1516

105.22

101635.517

5.2220

5.2216

1520

1516

1020

1016

78.3625.2215

5.2216

2015

2016

1015

101604.227

5.2210

5.2216

2010

2016

1510

151616

323

2

13

1

13

12

32

3

12

1

02

0

231

3

21

2

01

01

30

3

20

2

10

1

v

tvtt

tt

tt

tt

tt

tttv

tt

tt

tt

tt

tt

tt

tvtt

tt

tt

tt

tt

tttv

tt

tt

tt

tt

tt

tttv

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

a

%033269.0

10006.392

19.39206.392

a

Page 17: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu17

Comparison Table

Order of Polynomial

1 2 3

v(t=16) m/s 393.69 392.19 392.06

Absolute Relative

Approximate Error

--------0.38410

%0.033269

%

Page 18: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu18

Distance from Velocity Profile

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

t=16s ?

,00544.013195.0265.21245.4)( 32 ttttv 5.2210 t

16

11

)()11()16( dttvss

16

11

32 )00544.013195.0265.21245.4( dtttt

1611

432

]4

00544.03

13195.02

265.21245.4[ttt

t

1605 m

)5727.2)(300065045()1388.4)(33755.7125.47(

)9348.1)(45008755.52()36326.0)(67505.10875.57()(2323

2323

tttttt

tttttttv

Page 19: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu19

Acceleration from Velocity Profile

,

Find the acceleration of the rocket at t=16s given that

32 00544.013195.0265.21245.4 tttdt

dtv

dt

dta

201632.026390.0265.21 tt

2)16(01632.0)16(26390.0265.21)16( a

665.29 2/ sm

,00544.013195.0265.21245.4)( 32 ttttv 5.2210 t

Page 20: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

Additional ResourcesFor 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

Page 21: Http://numericalmethods.eng.usf.edu 1 Lagrangian Interpolation Major: All Engineering Majors Authors: Autar Kaw, Jai Paul

THE END

http://numericalmethods.eng.usf.edu