eciv 301 programming & graphics numerical methods for engineers lecture 31 ordinary differential...

30
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 31 Ordinary Differential Equations

Post on 20-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

ECIV 301

Programming & Graphics

Numerical Methods for Engineers

Lecture 31

Ordinary Differential Equations

Fig 23.1FORWARD FINITE DIFFERENCE

Fig 23.2BACKWARD FINITE DIFFERENCE

Fig 23.3CENTERED FINITE DIFFERENCE

Data with Errors

Pendulum

W=mg

02

2

l

sinmg

dt

dm

02

2

l

sing

dt

d

OrdinaryDifferentialEquation

ODEs

02

2

l

sing

dt

dNon Linear

Linearization

Assume is small

sin 02

2

l

g

dt

d

ODEs

02

2

l

g

dt

dSecond Order

ydt

d

Systems of ODEs

0

l

g

dt

dy

Application of ODEs in Engineering Problem SOlving

ODE

15810450 234 x.xxx.y

5820122 23 .xxxdx

dy

ODE - OBJECTIVES

Cx.xxx.y 5810450 234

5820122 23 .xxxdx

dy

dx.xxxy 5820122 23

15810450 234 x.xxx.y

Undetermined

ODE- Objectives

15810450 234 x.xxx.y

Initial Conditions

10 y

ODE-Objectives

y,xfdx

dy

Given

.C.Iknowny,f 0

Calculate

xy

Runge-Kutta MethodsNew Value = Old Value + Slope X Step Size

hyy ii 1

Runge Kutta Methods

hyy ii 1

Definition of yields different Runge-Kutta Methods

Euler’s Method

hyy ii 1

y,xfdx

dy

ii y,xfLet

Example

15810450 234 x.xxx.y

5820122 23 .xxxdx

dy

10 y

Euler h=0.5

x dy/dx y ytrue

0.0000 8.5000 1.0000 1.00000.5000 1.2500 5.2500 3.21881.0000 -1.5000 5.8750 3.00001.5000 -1.2500 5.1250 2.21882.0000 0.5000 4.5000 2.00002.5000 2.2500 4.7500 2.71883.0000 2.5000 5.8750 4.00003.5000 -0.2500 7.1250 4.71884.0000 -7.5000 7.0000 3.00004.5000 -20.7500 3.2500 -3.78135.0000 -41.5000 -7.1250 -19.00005.5000 -71.2500 -27.8750 -46.78136.0000 -111.5000 -63.5000 -92.00006.5000 -163.7500 -119.2500 -160.28137.0000 -229.5000 -201.1250 -258.00007.5000 -310.2500 -315.8750 -392.28138.0000 -407.5000 -471.0000 -571.0000

Sources of Error

Truncation: Caused by discretization

• Local Truncation• Propagated Truncation

Roundoff: Limited number of significant digits

Sources of Error

Propagated

Local

Euler’s Method

Heun’s Method

Predictor Corrector

2-Steps

Heun’s Method

Predict

Predictor-CorrectorSolution in 2 steps

hyy ii 10

ii y,xf

Let

Heun’s Method

Correct

Corrector

hyy ii 1

01ii y,xf

Estimate

01ii y,xf

Estimate

2

01

iiii y,xfy,xfLet

Error in Heun’s Method

The Mid-Point Method

hyy ii 1

Remember:Definition of yields different Runge-Kutta Methods

Mid-Point Method

Predictor Corrector

2-Steps

Mid-Point Method

Predictor

Predict

22

1

hyy i

i

ii y,xf

Let

Mid-Point Method

Corrector

Correct

hyy ii 1

2

1

2

1 ,iiyxf

Estimate

2

1

2

1 ,iiyxf

Let