ordinary differential equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfmodified euler method...

21
1 Ordinary Differential Equations 0 0 ) 0 ( , ) 0 ( with 0 ) , , ( y y y y x y y x f y = = > = Initial Value Problem (IVP) Boundary Value Problem (BVP) b a y b y y a y b x a y y x f y = = < < = ) ( , ) ( with ) , , ( Initial Value Problem,1 st order 0 ) 0 ( with 0 ) , ( y y t y t f y = > = h t y h t y y ) ( ) ( of ion approximat difference forward + = ) , ( ) ( ) ( y t hf t y h t y + = + with in solution for Seek 0 n t t t M t t h h t t M i ih t t n i i i 0 1 0 and ,..., 1 , 0 = = = + = + ion approximat Euler ) , ( 1 i i i i y t hf y y + = +

Upload: others

Post on 26-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

1

Ordinary Differential Equations

00 )0(,)0(with 0),,( yyyyxyyxfy ′=′=>′=′′

Initial Value Problem (IVP)

Boundary Value Problem (BVP)

ba ybyyaybxayyxfy ==<<′=′′ )(,)(with ),,(

Initial Value Problem,1st order

0)0(with 0),( yytytfy =>=′

htyhtyy )()( ofion approximat difference forward −+

=′

),()( )( ythftyhty +=+⇒

within solution for Seek 0 nttt ≤≤

Mtthhtt

Miihtt

nii

i

01

0

and

,...,1,0−

==−

=+=

+

ionapproximatEuler ),( 1 iiii ythfyy +=⇒ +

Page 2: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

2

Example

22),(

1 with 30for )( Find

1)0( 2

1iiii

iiiiiytytyythfyy

htty

yyty

+=

−+=+=

=≤≤

=−

=′

+

(0.75+2)/2=1.37533(1+0.5)/2=0.7522(0+1)/2=0.511100yitii

As h gets smaller we approach the exact solution.

Geometric interpretation of Euler’s Method

Φ

Step size, h

t

y

t0,y0

True value

y1, Predictedvalue

Page 3: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

3

2),(

13)(

1)0(2

1ii

iiiiiytyythfyy

htty

yyty

−+=+=

=≤≤

=−

=′

+

with 0for Find

Page 4: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

4

Page 5: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

5

Error in Euler

Euler approximation

→ Local discretization error

→ Global discretization error

Final global error:

Page 6: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

6

How to improve accuracy of Euler’s Method?

( ) ...!32

)()(32

+′′′+′′+′+=+ ηyhyhyhxyhxy

Consider Taylor series

and compute the derivatives as

.....

( ) ( )ηyhfffhhfxyhxy yx ′′′++++=+!32

)()(32

For Taylor’s formula of order N

Local discretization error = O (hN+1)

Global discretization error = O (hN)

Page 7: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

7

)4(4

)3(3

)2(2

!4!32)()( yhyhyhyhxyhxy +++′+=+

Final global error:

Page 8: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

8

Taylor’s method is cumbersome from numerical point of view since higher derivatives need to be calculated.Alternative way to improve accuracy is to use several function evaluations:

slope at the beginning of

step

slope at the end of step

↓↓

Local DE Global DE

Page 9: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

9

Modified Euler Method(use two slopes sequentially)

Runge-Kutta Method : accuracy of Taylor N=4, no high derivatives,

several function evaluations

Find ai, bi by matching the Runge-Kutta method to N=4 Taylor method.This results in 11 equations for 13 unknowns.

2 of ai, bi are selected and the rest are solved in terms of the selected ones.

Page 10: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

10

Page 11: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

11

error in Simpson ~ O (h5); accumulated error in Runge-Kutta after M steps ~ O (h4 )

Page 12: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

12

For k2,k3,k4=0 we recover Euler’s method

Remark:

Find A, B, P, Q by matching the Runge-Kutta method to N=2 Taylor method:

let

}

Page 13: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

13

We need to select one of A,B,P or Q

Page 14: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

14

Sytem of ODEs

within solution for Seek 0 nttt ≤≤

Mtthhtt

Mkkhttn

kk

i

01

0 ,...,1,0−

==−

=+=

+ and

Euler’s approximation

Runge-Kutta method of order=4 (RK4)

Page 15: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

15

Higher order ODEs

Reduce the ODE to a system of lower order ODEs

Page 16: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

16

Boundary Value Problem (BVP)

Linear BVP

Page 17: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

17

Solution of

is given as

where u and v are the solutions of the following IVPs:

proof:

Page 18: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

18

Page 19: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

19

Page 20: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

20

Page 21: Ordinary Differential Equations y′web.boun.edu.tr/ozupek/me303/ode_web.pdfModified Euler Method (use two slopes sequentially) Runge-Kutta Method: accuracy of Taylor N=4, no high

21