+ All Categories
Home > Documents > Numerical Analysis Differential Equations

Numerical Analysis Differential Equations

Date post: 08-Aug-2018
Category:
Upload: zameer2u
View: 228 times
Download: 0 times
Share this document with a friend
35
Numerical Analysis   Differential Equation Hanyang University Jong-Il Park
Transcript

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 1/35

Numerical Analysis – 

Differential Equation

Hanyang University

Jong-Il Park

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 2/35

 

Department of Computer Science and Engineering, Hanyang University

Differential Equation

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 3/35

 

Department of Computer Science and Engineering, Hanyang University

Solving Differential Equation

Differential EquationOrdinary D.E.

Partial D.E.

Ordinary D.E.

Linear eg.

Nonlinear eg.

Initial value problem

Boundary value problem

)('' t  f   y y

)(''' t  f   y y y

Usually no closed-form solution 

linearization

numerical solution

0)0()0(,0. ''' y y y yeg 

3)1(,0)0(,1054. ''' y y y y yeg 

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 4/35

 

Department of Computer Science and Engineering, Hanyang University

Discretization in solving D.E.

Discretization

Errors in Numerical

 Approach

Discretization error 

Stability error 

y

t

Grid Points

Exact sol.

d e D y ye nd S  y ye

sol.numerical:

sol.ddiscretize:

sol.exact:

n

e

 y

 y

 y

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 5/35

 

Department of Computer Science and Engineering, Hanyang University

Errors

Total error 

S  D eee truncation round-off

 De S e0 increase

as t  0 as t  0

trade-off

e

 DeS e

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 6/35

 

Department of Computer Science and Engineering, Hanyang University

Local error & global error 

Local error 

The error at the given step if it is assumed that all theprevious results are all exact

Global error 

The true, or accumulated, error 

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 7/35

 

Department of Computer Science and Engineering, Hanyang University

Useful concepts(I)

Useful concepts in discretization

Consistency

Order 

Convergence

00)(  Deht 

55

22

)()(

hehOhehO

 D

 D

0h

e y

 y

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 8/35

 

Department of Computer Science and Engineering, Hanyang University

Useful concepts(II)

stability

stable

unstable

 y

Consistent

stableConverge

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 9/35

 

Department of Computer Science and Engineering, Hanyang University

Stability

Stability condition

0

' )0(, y y Ay y eg.

Exact sol.

Euler method

 At e y y 0

0

1

1

)1(

)1(

 yhA

 yhA

hAy y y

nn

nnn

For stability

 AhhA 201|1|

Amplification factor

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 10/35

 

Department of Computer Science and Engineering, Hanyang University

nnnn

nnn

 yhh yh y y

hf   y y

)1(2.1)2.1(1

1

h

h y

 yh y y

hf   y y

n

nnn

nnn

1

2.1

)2.1( 11

11

Explicit :

Implicit :

h increase

h large

h small

ye

y

t

y

txplicit implicit

“conditionally stable”  “stable” 

 y y y y y 2.12.0)0(,2.1 ''eg.

= f

Implicit vs. Explicit Method

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 11/35

 

Department of Computer Science and Engineering, Hanyang University

Modification to solve D.E.

Modified Differential Eq.

)(. ' t  g  Ay yeg 

Diff.

eq.Modified

D.E.

Discretization

Discretization by Euler method)(1 nnnn Ay g h y y

<Consistency check>

''

!21'

''2

!2

1'

''2

!21'

1

|

)(||

||

hy g  Ay y

 Ay g h y yhhy y

 yhhy y y

nnn

nnnnnn

nnnn

0Let h nnn g  Ay y |'consistent;

<Order>

)(|'

hO g  Ay y nnn

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 12/35

 

Department of Computer Science and Engineering, Hanyang University

Initial Value Problem: Concept

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 13/35

 

Department of Computer Science and Engineering, Hanyang University

Initial value problem

Initial Value Problem

Simultaneous D.E.

High-order D.E.

00' )(,),( yt  y yt  f 

dt dy y

00,21

1001,2111

)(),,,,(

)(),,,,(

nnnnn

n

 yt  y y y yt  f  dt 

dy

 yt  y y y yt  f  dt 

dy

)1(

00

)1('

00

'

0

)(

)1(''')(

)(,,)(,

),,,,,(0

nnt 

nn

 yt  y yt  y y y

 y y y yt  f   y

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 14/35

 

Department of Computer Science and Engineering, Hanyang University

Well-posed condition

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 15/35

 

Department of Computer Science and Engineering, Hanyang University

Taylor Series Method

),(

'

 yt  f  y

n

nn

nRh yh yh y yht  y )(

0!12''

0!21'

000 )(

Truncation error)( 0 ht  y

)( 0t  y

0t  ht  0

h

ht t 

 yn

h R n

n

n

00

)1(1

,)()!1(

 

 

Taylor series method(I)

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 16/35

 

Department of Computer Science and Engineering, Hanyang University

High order differentiation

Implementation

22

'''

''

2

)()(][

))](,([

 f   f   f   f   f   f   f   f   f  

 f   f   f   y

 f   f  t 

 f   f   f   f   f   f  dt 

d  y

 f   f   f  dt 

dy

 y

 f  

 f  t  yt  f  

dt 

d  y

 yy yt  ytytt 

 y ytytt  yt 

 yt 

<Type 1>

Complicated computation

0t '

0 y''

0 y'''

0

 y

hhh

y

t

Less computation

accuracy

<Type 2>

h h h

0t  1t  2t  3t '

0 y''

0 y'''

0 y

'

1 y''

1 y'''

1 y

'

2 y''

2 y'''

2 y

....

y

t

More computation

accuracy

Requiring complicated

source codes

Taylor series method(II)

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 17/35

 

Department of Computer Science and Engineering, Hanyang University

Euler method(I)

Euler Method

0t 

....

y

t1t  2t  3t  ....

0 y0 y

1 y2 y

3 y

h

00

' )(),,( yt  y yt  f   y

Talyor series expansion at to

100

2

0

''

!21'

001 ,)( t t h yh y y y   

0

00 ),(

 f  

 yt  f  

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 18/35

 

Department of Computer Science and Engineering, Hanyang University

Euler method(II)

Error 

Eg. y’ =-2x3+12x2-20x+8.5, y(0)=1

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 19/35

 

Department of Computer Science and Engineering, Hanyang University

Euler method(III)

1

2

2''

!21

1

,)(

)(

nnnnn

nnnn

t t hOh f  y

h yh f  y y

 

 

1

0

10112010 )()()()(n

i

iinnn y y y y y y y y y y y

)()()(

2

1

)(2

1

)(

 _ ''

0

2 _ 

''0

2''1

02

1

hOh yt t 

h yh

t t 

h ye

n

n

i

n

it 

 

 

 

Generalizing the relationship

Euler’s approx.  truncation error

Error Analysis

Accumulated truncation error

h

t t n

t t  y y

n

n

n

iin

0

0

1

0

''1''

,)()(

   

; 1st order

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 20/35

 

Department of Computer Science and Engineering, Hanyang University

Eg. Euler method

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 21/35

 

Department of Computer Science and Engineering, Hanyang University

Modified Euler method: Heun’s method 

Modified Euler’s Method 

Why a modification?

errormodify

nt  nt 1n

n y 1

 P 

n y 1 P 

n f   1

n f  2

1

 P 

nn f   f  

1nt 

Predictor

Average slope

Corrector

nn

 P 

n hf   y y 1

2),(),(

2

11

'

1

''

 P 

nnnnnn yt  f   yt  f   y y y

)],(),([2

11

'

1 nnnnnn

n yt  f   yt  f  h

 y yh y y

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 22/35

 

Department of Computer Science and Engineering, Hanyang University

Heun’s method with iteration 

Iteration

significant

improvement

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 23/35

 

Department of Computer Science and Engineering, Hanyang University

Error analysis

Error Analysis

Taylor series

Total error 

)(][

)()(

)(

3'

1

'

2

'''3

!31

''

12

21'

'''3

!31''2

21'

1

hO y y y

 yhhOh

 y yhhy y

 yh yhhy y y

nnh

n

nnnn

nnnn

 

 

truncation

3rd order

)( 2hO ; 2nd order method

※ Significant improvement over Euler’s method! 

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 24/35

 

Department of Computer Science and Engineering, Hanyang University

Eg. Euler vs. Modified Euler 

 Euler  Modified 

Euler Method

improvement

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 25/35

 

Department of Computer Science and Engineering, Hanyang University

Runge-Kutta method

Runge-Kutta Method

Simple computation

very accurate

The idea

codesourceEasy.,,no ''' y y

),,(1 h yt h y y nnnn  

where

),(

),(

),(

11

112

1

2211

nnnnn

nn

nn

nn

 yt  f  k 

 yt  f  k 

 yt  f  k 

k ak ak a

   

   

 

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 26/35

 

Department of Computer Science and Engineering, Hanyang University

Second-order Runge-Kutta method

Second-order Runge-Kutta method

),(

),(

)(

112

1

22111

   

nn

nn

nn

 yt  f  k 

 yt  f  k 

k ak ah y y ① 

Taylor series expansion

nn y

 f 

nt 

 f 

n

hn yt hnnn

 R f k 

 y f  f  f  f h y y

112

'''!3!21

)(

)()()(32

   

 

nn yt nnn hR f   f  ha f  aah y y

)())(( 112211   

② 

③ 

④ ③→① 

Equating ② and ④ 

),(2

,2

,1 121221 nn yt  f  h

ah

aaa   

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 27/35

 

Department of Computer Science and Engineering, Hanyang University

Modified Euler - revisited

)( 2121 k k  y y hnn

),(1 nn yt  f  k 

),( 12 hk  yht  f  k  nn Modified Euler method

set

1111 ,,2

1hk ha   

2

12 a

Modified Euler method is a kind

of 2nd-order Runge-Kutta method.

P1

P2

),(1 nn yt  f  k 

),( 12 hk  yht  f  k  nn

1n y

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 28/35

 

Department of Computer Science and Engineering, Hanyang University

Other 2nd order Runge-Kutta methods

Midpoint method

Ralston’s method 

111212

,2

,1,0 k hhaa   

))),(,((221 nnh

nh

nnn yt  f   yt  f  h y y

)3( 2141 k k  y y hnn

),(1 nn yt  f  k 

),( 132

32

2 hk  yht  f  k  nn

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 29/35

 

Department of Computer Science and Engineering, Hanyang University

Comparison: 2nd order R-K method

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 30/35

 

Department of Computer Science and Engineering, Hanyang University

Comparison: 2nd order R-K method

Eg. y’ =-2x3+12x2-20x+8.5, y(0)=1

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 31/35

 

Department of Computer Science and Engineering, Hanyang University

Fourth-order Runge-Kutta Taylor series expansion to 4-th order 

accurate

short, straight, easy to use

),(

),(

),(

),(

})(2{

34

2223

1222

1

432161

1

hk  yht  f k 

k  yt  f k 

k  yt  f k 

 yt  f k 

k k k k h y y

nn

hn

hn

hn

hn

nn

nn

)( 1 P  f  

nt 2h

nt  ht n

P1

P2

P3

P4

)( 3 P  f  

)( 2 P  f  

)( 1 P  f  

※ significant improvement over

modified Euler’s method 

4-th order Runge-Kutta methods

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 32/35

 

Department of Computer Science and Engineering, Hanyang University

Runge-Kutta method

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 33/35

 

Department of Computer Science and Engineering, Hanyang University

Eg. 4-th order R-K method

Significant

improvement

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 34/35

 

Department of Computer Science and Engineering, Hanyang University

Discussion

Better!

8/22/2019 Numerical Analysis Differential Equations

http://slidepdf.com/reader/full/numerical-analysis-differential-equations 35/35

 

Comparison

(5th order)


Recommended