+ All Categories
Home > Documents > yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf ·...

yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf ·...

Date post: 17-Oct-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
15
1 Initial-Value Problems for ODEs • numerical errors (round-off and truncation errors) Consider a perturbed system: • Does z(t) y(t)? (i) (uniqueness) a unique solution y(t) exists GIVEN: , , FIND: for a dy y t f ty ya y dt yt a t b 0 , , a dz f tz t a t b dt za y 2 0 0 0 (ii) (well-posed) for any >0, 0 such that whenever and , with , a unique soltion to the problem , , exists with , a t C ab t zt dz f tz t a t b dt za y zt yt a t b 3 • sufficient conditions for the problem to be well posed: 2 1 2 1 0 1 if , , , (Lipschitz condition); 2 if , and satisfies for some 0 f ty f ty Ly y f f C ab L L y GIVEN: , , FIND: for a dy y t f ty ya y dt yt a t b 4 Discretization: provide n n y yt 0 1 2 1 GIVEN: , , , , FIND: n n y y y y y GIVEN: , , FIND: for a dy y t f ty ya y dt yt a t b
Transcript
Page 1: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

1

Initial-Value Problems for ODEs

• numerical errors (round-off and truncation errors)

Consider a perturbed system:

• Does z(t) � y(t)?

(i) (uniqueness) a unique solution y(t) exists

� � � � � �

� �

GIVEN: , ,

FIND: for

ady y t f t y y a ydt

y t a t b

�� � �

� �

� � � �

� � 0

, ,

a

dz f t z t a t bdtz a y

� � � �

� �

2

� �� � � � �

� �

� � � �

� �

� � � � � �

0

0

0

(ii) (well-posed) for any >0, 0 such that

whenever and , with ,

a unique soltion to the problem

, ,

exists with

,

a

t C a b t

z tdz f t z t a t bdtz a y

z t y t a t b

� �

� � �

� � � �

� �

� � � �

� �

3

• sufficient conditions for the problem to be well posed:

� � � �

2 1 2 1

0

1 if , , , (Lipschitz condition);

2 if , and satisfies for some 0

f t y f t y L y y

ff C a b L Ly

� � �

�� � �

� � � � � �

� �

GIVEN: , ,

FIND: for

ady y t f t y y a ydt

y t a t b

�� � �

� �

4

� � Discretization: provide n ny y t� �

0 1 2

1

GIVEN: , , , ,

FIND:

n

n

y y y yy �

� � � � � �

� �

GIVEN: , ,

FIND: for

ady y t f t y y a ydt

y t a t b

�� � �

� �

Page 2: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

5

• Classification:

� �� �

1 0 1 2

1 0 1 2 1

Explicit Schemes: , , , ,

Implicit Schemes: , , , , ,

n n

n n n

y F y y y yy F y y y y y

� �

���

��

��

� �� �

� �� �

1

1 1

1 1

1 1 1

one-step method:

or ,

multi-step method: , ,

or , , ,

n n

n n n

n n m n

n n m n n

y F yy F y yy F y yy F y y y

� �

� � �

� � � �

��� ���

��� ��

��

6

Taylor methods (explicit, one-step method)

• Taylor method of order k:

� � � �1

GIVEN: and ,

FIND:

n

n

y y t f t yy �

� �

� � � �

� � � � � � � � � � � �1 1

2 11 1

2 !

n n n

kk kn n n n

y y t y t dt

y t dt y t dt y t dt y t O dtk

� �

� � �

� ��� � � � � ��

7

� � � � � � � � � �need compute , , , ,k

n n n ny t y t y t y t� ��� �

� �n ny t y�

� � � �,n n n ny t f t y f� � �

� � � �,n n n

n nt t t t y y

d dfy t y t fdt dt� � �

� � � ��� � �� � �� � � �� � � �

� � � �2

2

,n n n

n nt t t t y y

d d fy t y t fdt dt� � �

� �� ���� �� ��� � �� � � �� � � �

� � � �� �notice that , ,f f t y f t y t� � �

� �� � � �, ,df d f dy ff t y t f f t ydt dt t dt y t y

� � � �� �� � � � � � �� � � �� �

8

� �2

2,

d f f f f t ydt t y t y

� � � �� �� �� � �� �� �� � � �� �� �

2

2f f f f f

t t y y t y y� �� � � � � � �� � � � � �� � � �� �� � � � � �� � � � � � �� � � � � �� �

22 2 22

2 22

f f f f ff f ft t y t y y y

� � � � � �� �� � � � �� �� � � � � � �� �

Page 3: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

9

� �1

1truncation error per time step (from to ) kn nt t O dt �

�� !

accumulated truncation error from 0 to :t t T� � �

� � � �1 kkT dt O dt dtO T� �

� � � � � � � � � �2

1

1 1

2 !

kkn n n n ny y t dt y t dt y t dt y t

k� � ��� � � � ��

• Taylor method of order k:

10

• forward Euler method (k = 1, explicit, one-step):

� �1 ,n n n ny y dt f t y� � �

accumulated truncation error ~ O(T·dt)

simple but poor accuracy

� � � � 1i.e. , n nn n n

y yy t f t ydt

� �� � �

forward difference

• higher order (higher k): better accuracy but too much trouble

seldom in use

11

• backward Euler method (implicit, one-step):

� �1 1 1,n n n ny y dt f t y� � �� �

accumulated truncation error ~ O(T·dt)

� � � � 11 1 1, n n

n n ny yy t f t ydt

�� � �

�� � �

backward difference

12

� � � �� �1

1exact: ,n

n

t

n n n ty y t dt y f t y t dt�

� � � � � "

� � � � � �

� �

GIVEN: , ,

FIND: for

ady y t f t y y a ydt

y t a t b

�� � �

� �

� �,n ndt f t y � �1 1,n ndt f t y� �

Page 4: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

13

• Crank-Nilcoson method (trapezoidal, implicit, one-step):

� � � �� �

� �1 1 1

2accumulated truncation err

, ,

or

2n n n n n n

dty y f t y f t y

O T dt

� � �� � �

• leap-frog method (explicit, two-step):

� �

� �

1

2

1

1 1 2 ,

if

accumulated truncation error

n n n

n n

n

n n

t t

y y dt f t y

T

t

dt

t dt

O

� �

� ��

� �

� � � � 1 1i.e. ,2

central difference

n nn n n

y yy t f t ydt

� ��� � �

�14

Runge-Kutta methods (explicit, one-step)

• What values of #, $, %1, %2 are required to obtain an accuracy of order 2?

2nd order method: accumulated truncation error ~ O( T·dt2 )

� �1 ,n nk dt f t y�

� �2 1,n nk dt f t dt y k$ #� � �

1 1 1 2 2n ny y k k% %� � � �

1 nk dt f�

� � � � � �2

2 1n n

nf fk dt f dt k O dtt y

$ #� �� �� � � �� �� �� �

� � � � � �2n nn n

f fdt f dt dt f O dtt y

$ #� �� �� � � �� �� �� �

� � � � � �� � � � � �2 2 2

2 22 3

1 12 2

1 1P.S.

2 2n n nf f fO dt dt dt k k O dtt t y y

$ $ # #� � �� � � �

� � � �

15

� � � � � � � �1 2

2

1n n

n n nn nf fdt f dt f dt dt f O dtt

y yy� � � �

� �� �� � �� �� �� �

% % $ #

� � � � � � � �2 2 3

1 2 2 2n n

n n nf fy dt f dt dt f O dtt y

% % $% #%� �� � � � � �

� �

On the other hand, the Taylor series expansion of yn+1 about tn is:

� �2 3

1

1

2n

n n ndfy y dt f dt O dtdt� � � � �

� �2 31

2n n

n n nf fy dt f dt f O dtt y

� �� �� � � � �� �� �� �

Thus, to have a scheme with a truncation error/step ~ O(dt3), we need

� �1 2

2 2

1

1

2

% %

#% $%

� �

� �

16

3

2

1 2 1truncation error

4 3 6

ff f f ft y

dty t y

� &� � � � �� � � �� �� �� � � �� '� �� � � �� � � � �� �� � � �� �� (#�

• 2nd Runge-Kutta method:

� �1 ,n nk dt f t y�

� �2 1,n nk dt f t dt y k$ #� � �

1 1 1 2 2n ny y k k% %� � � �

� �1 2

2 2

1

1

2

% %

#% $%

� �

� �

Page 5: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

17

• 2nd Runge-Kutta method:

1 2

1

(1) 0, 1, 1 2 (midpoint method)

,2 2

n n n n ndt dty y dt f t y f�

� � � �

� �� � � �� �� �

% % # $

� �

1 2

1

(2) 1 2, 1 (midpoint Euler method)

,2 2

n n n n n ndt dty y f f t dt y dt f�

� � � �

� � � � �

% % # $

1 2

1

(3) 1 4, 3 4, 2 3 (Heun's method)

3 2 2,

4 4 3 3n n n n n n

dt dt dt dty y f f t y f�

� � � �

� �� � � � �� �� �

% % # $

� � � �1 1 2 1, ,n n n n n ny y dtf t y dtf t dt y k� � � � � �% % $ #

18

• 3rd Runge-Kutta method:

� �1 ,n nk dt f t y�

� �2 1 1 1,n nk dt f t dt y k$ #� � �

1 1 1 2 2 3 3n ny y k k k% % %� � � � �

� �3 2 2 1 3 2,n nk dt f t dt y k k$ # #� � � �

8 parameters!

6 constraints for O(dt4) per time step!

19

• 4th Runge-Kutta method (the most common one):

� �1 ,n nk dt f t y�

12 ,

2 2n ndt kk dt f t y� �� � �� �

� �

� � � �5

1 1 2 3 4

12 2

6n ny y k k k k O dt� � � � � � �

� �4 3,n nk dt f t dt y k� � �

23 ,

2 2n ndt kk dt f t y� �� � �� �

� �

� �4accumulated truncation error O T dt �

20

Adams-Bashforth methods of order m (explicit, multi-step)

� �,j j jf f t y�

� �1

1

1

0

mm

n n j n jj

y y dt b f O dt�

�� �

� � �)

� � � �1

0 1 1 1 1

mn n n m n my dt b f b f b f O dt �

� � � �� � � � � ��

e.g. Adams-Bashforth methods of order 3 (explicit, multi-step):

� �1 0 1 1 2 2n n n n ny y dt b f b f b f� � �� � � �

n-m+1 n-m+2 n-1 n n+1

Page 6: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

21

� �

� �

0

2 3 4

1

2 3 4

2

1 1

2 6

42 2

3

n

n n n n n

n n n n

b f

y dt b f dt f dt f dt f O dt

b f dt f dt f dt f O dt

� &� �� �� �� �� �� ���� � � � � � �� '� �

� �� �� �� �� �� ���� � � � �� �� �� �� (

• Adams-Bashforth methods of order 3 (explicit, multi-step):

� �1 0 1 1 2 2n n n n ny y dt b f b f b f� � �� � � �

� � � � � � � �2 3 41 2

0 1 2 1 2

42

2n n n n

b by b b b dt f b b dt f dt f O dt

�� ��� � � � � � � � �

� �2 3 41 1

2 6n n n ny dt f dt f dt f O dt� ��� � � � �

22

Therefore,

0 1 2

1 2

1 2

1

2 1 2

4 1 3

b b bb bb b

� � ���� � ��� � ��

0

1

2

23 12

16 12

5 12

bbb

���* � ��� ��

� �1 1 223 16 512

n n n n ndty y f f f� � �� � � �

Conclusion:

� Adams-Bashforth three-step method

� accumulated truncation error ~ O(T·dt3)

23

Adams-Moulton methods of order m+1 (implicit, multi-step)

� �1

2

1

1

mm

n n j n jj

y y dt b f O dt�

�� �

� � �)

� � � �2

1 1 0 1 1 1 1

mn n n n m n my dt b f b f b f b f O dt �

� � � � � �� � � � � � ��

e.g. Adams-Moulton methods of order m+1=3 (implicit, multi-step):

� �1 1 1 0 1 1n n n n ny y dt b f b f b f� � � �� � � �

n-m+1 n-m+2 n-1 n n+1

24

• Adams-Moulton methods of order m+1=3 (implicit, multi-step):

� �

� �

2 3 4

1

0

2 3 4

1

1 1

2 6

1 1

2 6

n n n n

n n

n n n n

b f dt f dt f dt f O dt

y dt b f

b f dt f dt f dt f O dt

�� &� �� �� ���� � � �� �� �� �� �

� � �� '� �� �� �� ���� �� � � � �� �

� �� (

� � � � � � � �2 3 41 1

1 0 1 1 12

n n n nb b

y b b b dt f b b dt f dt f O dt�� �

�� ��� � � � � � � �

� �2 3 41 1

2 6n n n ny dt f dt f dt f O dt� ��� � � � �

� �1 1 1 0 1 1n n n n ny y dt b f b f b f� � � �� � � �

Page 7: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

25

Therefore,

1 0 1

1 1

1 1

1

1 2

1 3

b b bb bb b

� � ��� � ��� � ��

1

0

1

5 12

8 12

1 12

bbb

� ���* ��� � ��

� �1 1 15 812

n n n n ndty y f f f� � �� � � �

Conclusion:

� Adams-Moulton two-step method

� accumulated truncation error ~ O(T·dt3)

26

predict-corrector methods

accumulated truncation error ~ O(T·dtm+1)

� �1

* 1

1

0

mm

n n j n jj

y y dt b f O dt�

�� �

� � �)

*

1PREDICTOR: use Adams-Bashforth -step method to predict :nm y �

� �* *

1 1 1,n n nf f t y� � ��

1CORRECTOR: use Adams-Moulton -step method to predict :nm y �

� �1

* 2

1 1 1

0

mm

n n n j n jj

y y dt b f b f O dt�

�� � � �

� �� � � �� �

� �)

advantage: explicit

disadvantage: need many more computations

27

2 31 1 (expected)

2 6n n n ny dt f dt f dt f� �� ���� � � � ��

1

1

0 explicit schemes

0 implicit schemes

b

b

���� �+��

� �1 0 1 1 1 1

1 1 0 1 1 1 1

n n n m n m

n n n m n m

y a y a y a y

dt b f b f b f b f

� � � � �

� � � � � �

� � � �

� � � � �

General multi-step methods:

0AB/AM methods: 1, 0 for 1ja a j� � � ,

28

2 explicit schemesdegrees of freedom (# of adjustable variables):

2 1 implicit schemes

mm

�� � ��

2 1 explicit schemesmaximum order of accuracy attainable:

2 implicit schemes

mm

��� �

General multi-step methods:

2 31 1 (expected)

2 6n n n ny dt f dt f dt f� �� ���� � � � ��

� �1 0 1 1 1 1

1 1 0 1 1 1 1

n n n m n m

n n n m n m

y a y a y a y

dt b f b f b f b f

� � � � �

� � � � � �

� � � �

� � � � �

Page 8: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

29

� �

� �

� �

11 1 2

22 1 2

1 2

, , , ,

, , , ,

, , , ,

N

N

NN N

du f t u u udtdu f t u u udt

du f t u u udt

� ���� ������ ���

Systems of differential equations

� � � � � �1 1 2 2 NI.C.s: 0 = , 0 = , , 0 =Nu u u# # #�

� �� �

� �

1 1 21

2 1 22

1 2

, , , ,

, , , ,

, , , ,

N

N

N N N

f t u u uuf t u u uu

ddt

u f t u u u

� �� �� �� �� �� �� �� � �� �� �� �� �

� � � �� � � �

��

� �� �

30

� �

� � � �1 2

,

0 , , ,T

N

dU F t UdtU # # #

� �

� � � �1 2 1 2Let , , , and , , , , ThenT T

N NU u u u F f f f� � �� �

� �1 1 15 812

n n n n ndty y f f f� � �� � � �

e.g. Adams-Moulton two-step method (3rd order)

1 1 1 1 1

2 2 2 2 2

1 1 1

5 812

N N N N Nn n n n n

u u f f fu u f f fdt

u u f f f� � �

� &� � � � � � � � � �� �� � � � � � � � � �� �� � � � � � � � � �� � � �� '� � � � � � � � � �� �� � � � � � � � � �� �� � � � � � � � � �� (

� � � � �

31

� �� �

� �� �� �

1 1 1

1 1 1 2

1 1 1

2 1 1 2

1 1 1

1 1 2

11 1 2

1 1

12 1 22 2

1

1

, , , ,

, , , ,5

, , , ,

, , , ,

, , , ,8

12

n n nn N

n n nn N

n n nN n N

n n nn nn N

n n nn nn N

n nN Nn N n

f t u u u

f t u u u

f t u u u

f t u u uu uf t u u uu u dt

u u f t

� � ��

� � ��

� � ��

��

� �� �� �� �� �� �� �

� � � �� � � �� � � �� � �� � � �� � � �� � � �� � � �

��

�� � �

� �� �� �

� �

1 2

1 1 1

1 1 1 2

1 1 1

2 1 1 2

1 1 1

1 1 2

, , , ,

, , , ,

, , , ,

, , , ,

n n nN

n n nn N

n n nn N

n n nN n N

u u u

f t u u u

f t u u u

f t u u u

� � ��

� � ��

� � ��

� &� �� �� �� �� �� �� �� �� �� �� �� �� �� '� �� �� �� �� �

� �� �� �� �� �� �� �� �� ��� �� �� �� �� �� �� �� (

��

1

2

1N n

ff

f�

� �� �� �� �� �� �

1

2

N n

ff

f

� �� �� �� �� �� �

1

2

1N n

ff

f�

� �� �� �� �� �� �

32

2 1

2 1, , , ,

m m

m md y dy d y d yf t ydt dt dt dt

� �� � �

� ��Higher order equations

� � � � � � � �2 1

1 2 3 m2I.C.s 0 = , 0 = , 0 = , , 0 =

m

mdy d y d yydt dt dt

# # # #�

� � � �

� �

� �

� �

1

12

2

23 2

1

1

Let

mm

m m

u t y tdu dyu tdt dtdu d yu tdt dt

du d yu tdt dt

��

���� � ���� � ������ � ���

� �

� �

� �

� �

12

23

1

1 2, , , ,

mm

mm

du u tdtdu u tdt

du u tdtdu f t u u udt

� ���� ������ ���

���

� � � � � �1 1 2 2 mI.C.s: 0 = , 0 = , , 0 =mu u u# # #�

Page 9: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

33

Consistency: difference equation - differential equation

as dt- 0 ? (truncation errors - 0 as dt- 0)

Stability: computed solution to the difference equation

- exact solution to the difference equation?

(round-off errors under control)

Convergence: computed solution to the difference equation

- exact solution to the differential equation

as dt- 0 ?

34

� � � � � �� � 0

,

0

r i

y t f t y y ty y

i C

� � � .

. � . � . �

test problem

the exact solution is:

� � � � � � � �� �0 exp cos sinr i iy t y t t i t� . . � .

� �where is bounded for all 0 as long as 0.ry t t , . �

35

Schemes stability

(1) forward Euler method:

� �1 1 orn n n n n ny y dt f y dt y dt y. .� � � � � � �

� � � � � �1 1n nf y dt f y.� � �� �

� �� �1 1 1n n n ny e dt y e.� �� � � �

Alternatively, the solution of the difference equation is

� � 01 if 1 1 even if 0.n

n ry dt y dt. . .� � - / � � �

(numerical instability instead of physical instability)

� � � � � �,y t f t y y t� � � .

� �Suppose + , where is the round-off error. Thenn n n nf y y e e��

� �1Th s 1u n ne dt e� � � .

� � 0 1 if 1 1.n

ne dt e dt* � � . - / � . �

36

~ a limitation on the magnitude of dtbesides the consideration of accuracy

(1) forward Euler method

stability criterion: 1 1dt� . �

Numerical Stability

Page 10: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

1

37

(2) backward Euler method:

1 1 1n n n n ny y dt f y dt y� � �� � � � .

� � � �1

1 01 1n

n n ny dt y y dt y. .� �� � � * � �

stable if 1 1.dt* � ,.

Inconsistent with the exact solution

when 0 and 1 1!rdt dt. � � . ,

1because the Taylor's secies of has a convergence radius of 1.

1 z�38

backward Euler method

2 31 11 for (1)

2! 3!

ze z z z z� � � � � � /�

211 for 1 (2)

1z z z

z� � � � �

��

Regions I, II, and V: truncation errors under control.

Regions I, and III: rounding errors out of control.

39

0 Region I: Both series converge to a value > 1

Rounding error diverges.

40

0 Region II: Exact series converge to a value > 1

Numerical series converge to a value < 1.

Rounding error converges.

Page 11: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

1

41

0 Region III: Exact series converges to a value > 1.

Numerical series does not converge.

Rounding error diverges.

42

0 Region IV: Exact series converges to a value > 1.

Numerical series does not converge.

Rounding error converges.

43

0 Region V: Both series converge to a value < 1.

Rounding error converges.

44

0 Region VI: Exact series converges to a value < 1.

Numerical series does not converge.

Rounding error converges.

Page 12: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

1

45

(3) Trapezoidal (Crank-Nilcoson) method:

� � � �1 1 1

1 1

2 2n n n n n n ny y dt f f y dt y y.� � �� � � � � �

1

12

12

n n

dt

y ydt�

� ��� �� � �

�� �� �

.

. 0

12

12

n

n

dt

y ydt

� ��� �� � �

�� �� �

.

.

stable if 12

0 12

rdt dtdt

� � � �1 .. .

46

(4) leapfrog method:

1 1 12 2n n n n ny y dt f y dt y.� � �� � � �

Suppose . Substitute into the difference equation to oftainnny 2�

2 2

1,2

2 2 1 0 1tdt dt d* �� � 3 �� 2. . .2 2

1 1 2 2 1,2stable if 1n nny C C2 2 2� � * �

1 2 1,2However, since 1 stable if 1 � � * �2 2 2

stable 0 if 1r idt and dt. � . �*

� � � �1 2Write exp . Then exp . i i� � � �2 4 2 4

1 2Moreover, 2 2 sindt i� � �2 2 . 4

47

(5) Runge-Kutta methods:

� �212nd method: 1+ 1

2dt dt. .� �

� � � �2 31 13rd method: 1+ 1

2 6dt dt dt. . .� � �

� � � � � �2 3 41 1 14nd method: 1+ 1

2 6 24dt dt dt dt. . . .� � � �

48

• 2nd order Runge-Kutta methods:

� �1 2

2 2

1

1

2

� �

� �

% %

#% $%

1 n nk dt f dt y� � .

� � � � � �2 1 1,n n n n nk dt f t dt y k dt y k dt y dt y� � $ � # � . � # � . � #.

� �

� � � �� �1 1 1 2 2 1 2

2

1 2 21

n n n n n n

n

y y k k y dt y dt y dt y

dt dt y

� � � % � % � � % . � % . � #.

� � % � % . � #% .

� �5 6211

2ndt dt y� � . � .

� �21stable if 1 1

2dt dt� . � . �

Page 13: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

1

49

• In general:

� �1 0 1 1 1 1

1 1 0 1 1 1 1

n n n m n m

n n n m n m

y a y a y a y

dt b f b f b f b f

� � � � �

� � � � � �

� � � �

� � � � �

� �� �

1 2

0 1 1

1

1 0 1

Define

m m mm

m mm

p z z a z a z a

q z b z b z b

� ��

�� �

� � � � �

� � � �

�����

• The multi-step method is said to be stable if all roofs of p(z)lie in the disk |z|�1 and if each root of modulus 1 is simple.

• The method is said to be consistent if � � � � � �1 0 and 1 1p p q�� �

Theorem For the multi-step method to be convergent, it is

necessary and sufficient that it be stable and consistent.

50

Conclusion:

implicit schemes: more stable – allow a larger time increment dt

troublesome

explicit schemes: less stable – need a small dt

easy to implement.

51

system of equations:

test problem: dU AUdt

where A is a constant complex matrix.

5 61

suppose are the complex eigenvalues of the matrix N

k k A�

.

stable if all stable regiondt. ��

52

Boundary-Value Problems for ODEs

� �

� � � �

, , ,

,

y g x y y a x b

y a y b

�� �� � �

� �# $

~ shooting method and finite difference method

Page 14: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

1

53

shooting method 7 IV ODEs� �

� � � �, , ,

,

y g x y y a x by a y b# $

�� �� � �

� �

� �STEP1: guess and integrate the ODEs until :y a t x b� � �

� � � �

� �

� � � �

1

12

21 2

1 2

, ,

,

u x y x

du udx

du g x u udx

u a u a t

� �#

� � � �STEP2: check if the relative error ? if not, re-guess .y b

y a� $

�� $

� �y a t� �

54

• How to re-guess? Notice � � � �fn. of bty b y t� �

� � � �Define .bf t y t� � $

� � � �1 ,STEP2: if , then

b i iy t u b t� �� �

$ $

$ $

root-searching mehods. e.g., Secant method:*

� � � �0 1STEP1: take two initial guesses = and = .y a t y a t� �

� �Thus we are looking for a value of such that =0t f t

� �� �� � � �

1

1

1

i i ii

i ii

f t t tt

f f tt

t�

��

�� �

� �� �� �� � � �

1

1

b i i ii

b i b i

y t t tt

y t y t�

� $ �� �

�� �� �� �� � � �

1 1

1 1 1

,

, ,

i i ii

i i

u b t t tt

u b t u b t�

� $ �� �

55

• A special case: the ODE is linear

� � � � � � � �� � � �

, ,y g x y y p x y q x y r xy a y b

�� � �� � � �

� �# $

� � � � � �� �� �

� �1(1)

0

y p x y q x y r xy a y xy a

�� �� � �� &� �� *� '� �� �� (

#

� � � �� �� �

� �2(2) 0

1

y p x y q x yy a y xy a

�� �� �� &� �� *� '� �� �� ( � � � � � �

� �� �1

1 2

2

Theny b

y x y x y xy b�

� � $

56

Finite-difference methods

� � � � � �� �, ,i i i iy x g x y x y x�� ��

0BC's: , Ny y# $� �

implicit equations for , 1,2,3, , 1iy i N� �� �

root-searching for multi-variable system�

� �� � � �

, , ,

,

y g x y y a x by a y b# $

�� �� � �

� �

truncation error ~ O(h2)

1 1 1 1

2

2, ,

2

i i i i ii i

y y y y yg x yh h

� � � �� � �� �� � �� �

e.g. central difference:

for i = 1,2,…, N�1

Page 15: yt a t b Initial-Value Problems for ODEs ytww2.me.ntu.edu.tw/course/heatflow/numerical/sec7.pdf · yayay ay dt b f b f b f b f ¨ General multi-step methods: 0 AB/AM methods: 1, 0

1

57

� � � � � � � �linear equation: , ,g x y y p x y q x y r x� �� � �

� � � � � �1 1 1 1

2

2

2

i i i i ii i i i

y y y y yp x q x y r xh h

� � � �� � �� � �

1 12 2 2

1 2 1

2 2

i ii i i i i

p py q y y rh h h h h� �

� � � �� �� � � � � �� �� � � �� �� � � �

0

1 112 2 2

1 1

2 22 2 22 2 2

1 1 1 112 2 2

1 0 0 0

1 2 10 0

2 2

1 2 10 0 0

2 2

1 2 10 0

2 2

0 0 1

N N N NN

N

yp pq y rh h h h h

p pq y rh h h h h

p p y rqh h h h h

y

� � � ��

� �� � �� �� � �� �� �� � � � � � �� �

� �� �� � �� �� � �� �� �� � � � � � �� � �� �� �� �� �� �� �� �

� �� �� �� � � �� �� �� �� �� �� � �� �� �

#

$

� � �

� �

�� ��

������

� �� �� �� �� �� �


Recommended