cise301_topic8l31 se301: numerical methods topic 8 ordinary differential equations (odes) lecture...

26
CISE301_Topic8L3 1 Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2, 27-1

Upload: elijah-atkinson

Post on 22-Dec-2015

234 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 1

SE301: Numerical Methods

Topic 8 Ordinary Differential

Equations (ODEs)Lecture 28-36

KFUPM(Term 101)Section 04

Read 25.1-25.4, 26-2, 27-1

Page 2: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 2

Outline of Topic 8 Lesson 1: Introduction to ODEs Lesson 2: Taylor series methods Lesson 3: Midpoint and Heun’s

method Lessons 4-5: Runge-Kutta methods Lesson 6: Solving systems of ODEs Lesson 7: Multiple step Methods Lesson 8-9: Boundary value Problems

Page 3: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 3

Lecture 30Lesson 3: Midpoint and

Heun’s Predictor Corrector Methods

Page 4: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 4

Learning Objectives of Lesson 3 To be able to solve first order

differential equations using the Midpoint Method.

To be able to solve first order differential equations using the Heun’s Predictor Corrector Method.

Page 5: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 5

Topic 8: Lesson 3

Lesson 3: Midpoint and Heun’sPredictor-Corrector Methods

• Review Euler Method• Heun’s Method• Midpoint Method

Page 6: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 6

Euler MethodEuler Method

) Error Truncation Global

) Error Truncation Local

,...2,1

),()(

)(),()(

MethodEuler Problem

2

100

00

O(h

O(h

ifor

yxfhyyyxy

xyyyxfxy

iiii

Page 7: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 7

The methods proposed in this lesson have the general form:

For the case of Euler: Different forms of will be used for

the Midpoint and Heun’s Methods.

IntroductionIntroduction

hyy ii 1

),( ii yxf

00 )(),,()(

:ODEorder first a is solved be toProblem

yxyyxfxy

Page 8: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 8

Midpoint MethodMidpoint Method

) Error Truncation Global

) Error Truncation Local

),(

),(2

)(

)(),()(

MethodMidpoint Problem

2

3

2

1

2

11

2

100

00

O(h

O(h

yxfhyy

yxfh

yyyxy

xyyyxfxy

iiii

iiii

Page 9: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 9

Motivation The midpoint can be summarized as:

Euler method is used to estimate the solution at the midpoint.

The value of the rate function f(x,y) at the mid point is calculated.

This value is used to estimate yi+1.

Local Truncation error of order O(h3). Comparable to Second order Taylor series

method.

Page 10: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 10

Midpoint MethodMidpoint Method

1

2

10

ii

xxx

),( ii yx

),(,),(2 2

1

2

11

2

1

ii

iiiiii

yxfhyyyxfh

yy

Page 11: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 11

Midpoint MethodMidpoint Method

1

2

10

ii

xxx

),( ii yxfslope

),( ii yx

),(,),(2 2

1

2

11

2

1

ii

iiiiii

yxfhyyyxfh

yy

Page 12: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 12

Midpoint MethodMidpoint Method

1

2

10

ii

xxx

),( ii yxfslope

),( ii yx

),(,),(2 2

1

2

11

2

1

ii

iiiiii

yxfhyyyxfh

yy

),(2

1

2

1 iiyx

Page 13: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 13

Midpoint MethodMidpoint Method

1

2

10

ii

xxx

),(2

1

2

1

iiyxfslope

),( ii yx

),(,),(2 2

1

2

11

2

1

ii

iiiiii

yxfhyyyxfh

yy

),(2

1

2

1 iiyx

Page 14: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 14

Midpoint MethodMidpoint Method

1

2

10

ii

xxx

),(2

1

2

1

iiyxfslope

),( ii yx

),(,),(2 2

1

2

11

2

1

ii

iiiiii

yxfhyyyxfh

yy

),(2

1

2

1 iiyx

Page 15: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 15

Example 1

y(0.2) and y(0.1) Determine .1.0 Use

1)0(

1)(

ODE thesolve toMethodMidpoint theUse2

h

y

yxxy

Page 16: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 16

Example 1

4446.1)3438.2(1.02103.1),(

3213.1)2103.101.01(05.2103.1),(2

:2Step

2103.1)1.10025.01(1.01),(

1.1)101(05.01),(2

:1Step

1.0,1)0(,1),( :Problem

2

11

2

11

12

111

2

11

2

10

2

10

01

000

2

10

02

yxfhyy

yxfh

yy

yxfhyy

yxfh

yy

hyyyxyxf

Page 17: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 17

Heun’s Predictor Corrector

Page 18: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 18

Heun’s Predictor Corrector Heun’s Predictor Corrector MethodMethod

) ErrorTruncation Global

) ErrorTruncation Local

),(),(2

:Corrector

),(:Predictor)(

)(),()(

Method'HProblem

2

3

011

11

0100

00

O(h

O(h

yxfyxfh

yy

yxfhyyyxy

xyyyxfxy

seun

iiiiii

iiii

Page 19: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 19

Heun’s Predictor Corrector(Prediction)

1ii xx

),( ii yx

),(Prediction 01 iiii yxfhyy

),( 011 ii yx

Page 20: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 20

Heun’s Predictor Corrector(Prediction)

1ii xx

),( ii yx

),(Prediction 01 iiii yxfhyy

),( 011 ii yx

),( 011 ii yxfslope

Page 21: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 21

Heun’s Predictor Corrector(Correction)

1ii xx

),( ii yx

),( 011 ii yx

2

),(),( 011

iiii yxfyxfslope

),( 111 ii yx

),(),(2

011

11 iiiiii yxfyxf

hyy

Page 22: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 22

Example 2

y(0.2) and y(0.1) Determine

only correction One .1.0 Use

1)0(

1)(

ODE thesolve toMethod sHeun' theUse2

h

y

yxxy

Page 23: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 23

Example 2

4452.1),(),(2

:Corrector

4326.1),(:Predictor

:2Step

2105.1),(),(2

:Corrector

2.1)2(1.01),(:Predictor

:1Step

1.0,1)(,1),( :Problem

022111

12

11102

011000

11

00001

002

yxfyxfh

yy

yxfhyy

yxfyxfh

yy

yxfhyy

hxyyxyyxf

Page 24: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 24

Summary Euler, Midpoint and Heun’s methods are

similar in the following sense:

Different methods use different estimates of the slope.

Both Midpoint and Heun’s methods are comparable in accuracy to the second order Taylor series method.

slopehyy ii 1

Page 25: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 25

Comparison

),(

)()(),(2

Midpoint

),(),(2

:Corrector

)()(),(:Predictor

Method sHeun'

)()(),( MethodEuler

2

1

2

11

23

2

1

111

1

2301

21

iiii

iiii

kiiiii

ki

iiii

iiii

yxfhyy

hOhOyxfh

yy

yxfyxfh

yy

hOhOyxfhyy

hOhOyxfhyy

Method Local truncation error

Global truncation error

Page 26: CISE301_Topic8L31 SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM (Term 101) Section 04 Read 25.1-25.4, 26-2,

CISE301_Topic8L3 26

More in this Topic

Lessons 4-5: Runge-Kutta Methods Lesson 6: Systems of High order ODE Lesson 7: Multi-step methods Lessons 8-9: Boundary Value Problems