numerical analysis – differential equation
DESCRIPTION
Numerical Analysis – Differential Equation. Hanyang University Jong-Il Park. Differential Equation. Solving Differential Equation. Differential Equation Ordinary D.E. Partial D.E . Ordinary D.E. Linear eg. Nonlinear eg. Initial value problem Boundary value problem. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/1.jpg)
Numerical Analysis – Numerical Analysis – Differential EquationDifferential Equation
Hanyang University
Jong-Il Park
![Page 2: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/2.jpg)
Department of Computer Science and Engineering, Hanyang University
Differential EquationDifferential Equation
![Page 3: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/3.jpg)
Department of Computer Science and Engineering, Hanyang University
Solving Differential EquationSolving Differential Equation
Differential EquationOrdinary D.E.
Partial D.E. Ordinary D.E.
Linear eg. Nonlinear eg.
Initial value problem
Boundary value problem
)('' tfyy )(''' tfyyy
Usually no closed-form solution
linearizationnumerical solution
0)0()0(,0. ''' yyyyeg
3)1(,0)0(,1054. ''' yyyyyeg
![Page 4: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/4.jpg)
Department of Computer Science and Engineering, Hanyang University
Discretization in solving D.E.Discretization in solving D.E.
Discretization
Errors in Numerical Approach Discretization error
Stability error
y
tGrid Points
Exact sol.
deD yye
ndS yye
sol. numerical:
sol.ddiscretize:
sol.exact :
n
d
e
y
y
y
![Page 5: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/5.jpg)
Department of Computer Science and Engineering, Hanyang University
ErrorsErrors Total error
SD eee truncation round-off
De Se0 increaseas t 0 as t 0
trade-off
t
eDeSe
![Page 6: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/6.jpg)
Department of Computer Science and Engineering, Hanyang University
Local error & global errorLocal error & global error
Local error The error at the given step if it is assumed that all the
previous results are all exact Global error
The true, or accumulated, error
![Page 7: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/7.jpg)
Department of Computer Science and Engineering, Hanyang University
Useful concepts(I)Useful concepts(I)
Useful concepts in discretization Consistency
Order
Convergence
00)( Deht
55
22
)(
)(
hehO
hehO
D
D
0h
eyy
t
![Page 8: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/8.jpg)
Department of Computer Science and Engineering, Hanyang University
Useful concepts(II)Useful concepts(II) stability
stable
unstable
y
t
Consistentstable
Converge
![Page 9: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/9.jpg)
Department of Computer Science and Engineering, Hanyang University
StabilityStability
Stability condition
0' )0(, yyAyy eg.
Exact sol.Euler method
Ateyy 0
01
1
)1(
)1(
yhA
yhA
hAyyy
n
n
nnn
For stability
AhhA 201|1|
Amplification factor
![Page 10: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/10.jpg)
Department of Computer Science and Engineering, Hanyang University
nnnn
nnn
yhhyhyy
hfyy
)1(2.1)2.1(1
1
h
hy
yhyy
hfyy
n
nnn
nnn
1
2.1
)2.1( 11
11
Explicit :
Implicit :
h increase
h large
h small
ye
y
t
y
texplicit implicit
“conditionally stable” “stable”
yyyyy 2.12.0)0(,2.1 ''eg.= f
Implicit vs. Explicit MethodImplicit vs. Explicit Method
![Page 11: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/11.jpg)
Department of Computer Science and Engineering, Hanyang University
Modification to solve D.E.Modification to solve D.E.
Modified Differential Eq.
)(. ' tgAyyeg
Diff.eq.
ModifiedD.E.
Discretization
Discretization by Euler method)(1 nnnn Ayghyy
<Consistency check>
''!2
1'
''2!2
1'
''2!2
1'1
|
)(||
||
hygAyy
Ayghyyhhyy
yhhyyy
nnn
nnnnnn
nnnn
0Let h nnn gAyy |' consistent;
<Order>)(|' hOgAyy nnn
![Page 12: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/12.jpg)
Department of Computer Science and Engineering, Hanyang University
Initial Value Problem: ConceptInitial Value Problem: Concept
![Page 13: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/13.jpg)
Department of Computer Science and Engineering, Hanyang University
Initial value problemInitial value problem
Initial Value Problem
Simultaneous D.E.
High-order D.E.
00' )(,),( ytyytfdt
dyy
00,21
1001,2111
)(),,,,(
)(),,,,(
nnnnn
n
ytyyyytfdt
dy
ytyyyytfdt
dy
)1(00
)1('00
'0
)(
)1(''')(
)(,,)(,
),,,,,(0
nnt
nn
ytyytyyy
yyyytfy
![Page 14: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/14.jpg)
Department of Computer Science and Engineering, Hanyang University
Well-posed conditionWell-posed condition
![Page 15: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/15.jpg)
Department of Computer Science and Engineering, Hanyang University
Taylor Series Method
),(' ytfy
nnn
n Rhyhyhyyhty )(0!
12''0!2
1'000 )(
Truncation error)( 0 hty
)( 0ty
0t ht 0
h
htt
yn
hR n
n
n
00
)1(1
,)()!1(
Taylor series method(I)Taylor series method(I)
![Page 16: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/16.jpg)
Department of Computer Science and Engineering, Hanyang University
High order differentiation
Implementation
22
'''
''
2
)()(][
))](,([
fffffffff
fffy
fft
ffffffdt
dy
fffdt
dy
y
f
t
ftytf
dt
dy
yyytytytt
yytyttyt
yt
<Type 1>
Complicated computation
0t'0y''
0y'''
0y
hhh
y
tLess computation accuracy
<Type 2>
h h h
0t 1t 2t 3t'0y''
0y'''
0y
'1y''
1y'''
1y
'2y''
2y'''
2y
....
y
tMore computation accuracy
Requiring complicated source codes
Taylor series method(II)Taylor series method(II)
![Page 17: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/17.jpg)
Department of Computer Science and Engineering, Hanyang University
Euler method(I)Euler method(I)
Euler Method
0t
....y
t1t 2t 3t ....
0y0y
1y2y
3y
h
00' )(),,( ytyytfy
Talyor series expansion at to
1002
0''
!21'
001 ,)( tthyhyyy
0
00 ),(
f
ytf
![Page 18: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/18.jpg)
Department of Computer Science and Engineering, Hanyang University
Euler method(II)Euler method(II)
Error
Eg. y’ =-2x3+12x2-20x+8.5, y(0)=1
![Page 19: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/19.jpg)
Department of Computer Science and Engineering, Hanyang University
Euler method(III)Euler method(III)
12
2''!2
11
,)(
)(
nnnnn
nnnn
tthOhfy
hyhfyy
1
010112010 )()()()(
n
iiinnn yyyyyyyyyyy
)()()(2
1
)(2
1
)(
_''
0
2_
''0
2''1
021
hOhytt
hyh
tt
hye
n
n
i
n
it
Generalizing the relationship
Euler’s approx.truncation error
Error Analysis
Accumulated truncation error
h
ttn
ttyy
n
n
n
iin
0
0
1
0
''1'' ,)()(
; 1st order
![Page 20: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/20.jpg)
Department of Computer Science and Engineering, Hanyang University
Eg. Euler methodEg. Euler method
![Page 21: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/21.jpg)
Department of Computer Science and Engineering, Hanyang University
Modified Euler method: Heun’s methodModified Euler method: Heun’s method
Modified Euler’s Method Why a modification?
errormodify
nt nt 1nt
Cny 1
Pny 1
Pnf 1
nf2
1Pnn ff
1nt
Predictor
Average slope
Corrector
nnPn hfyy 1
2
),(),(
211
'1
''
Pnnnnnn ytfytfyy
y
)],(),([2 11
'1 nnnnnn
Cn ytfytf
hyyhyy
![Page 22: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/22.jpg)
Department of Computer Science and Engineering, Hanyang University
Heun’s method with iterationHeun’s method with iteration
Iteration
significant improvement
![Page 23: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/23.jpg)
Department of Computer Science and Engineering, Hanyang University
Error analysis Error analysis Error Analysis
Taylor series
Total error
)(][
)()(
)(
3'1
'2
'''3!3
1''
1221'
'''3!3
1''221'
1
hOyyy
yhhOh
yyhhyy
yhyhhyyy
nnh
n
nnnn
nnnn
truncation3rd order
)( 2hO ; 2nd order method
※ Significant improvement over Euler’s method!
![Page 24: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/24.jpg)
Department of Computer Science and Engineering, Hanyang University
Eg. Euler vs. Modified EulerEg. Euler vs. Modified Euler EulerModified
Euler Method
improvement
![Page 25: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/25.jpg)
Department of Computer Science and Engineering, Hanyang University
Runge-Kutta methodRunge-Kutta method
Runge-Kutta Method Simple computation
very accurate
The idea
code sourceEasy .,,no ''' yy
),,(1 hythyy nnnn
where
),(
),(
),(
11
112
1
2211
nnnnn
nn
nn
nn
ytfk
ytfk
ytfk
kakaka
![Page 26: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/26.jpg)
Department of Computer Science and Engineering, Hanyang University
Second-order Runge-Kutta methodSecond-order Runge-Kutta method
Second-order Runge-Kutta method
),(
),(
)(
112
1
22111
nn
nn
nn
ytfk
ytfk
kakahyy ①
Taylor series expansion
nnyf
ntf
n
hnyt
hnnn
Rfk
yffffhyy
112
'''!3!21
)(
)()()(32
nnytnnn hRffhafaahyy )())(( 112211
②
③
④③→①
Equating ② and ④
),(2
,2
,1 121221 nn ytfh
ah
aaa
![Page 27: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/27.jpg)
Department of Computer Science and Engineering, Hanyang University
Modified Euler - revisitedModified Euler - revisited
)( 2121 kkyy hnn
),(1 nn ytfk ),( 12 hkyhtfk nn Modified Euler method
set
1111 ,,2
1hkha
2
12 a
Modified Euler method is a kind of 2nd-order Runge-Kutta method.
P1
P2
),(1 nn ytfk
),( 12 hkyhtfk nn
1ny
![Page 28: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/28.jpg)
Department of Computer Science and Engineering, Hanyang University
Other 2nd order Runge-Kutta methodsOther 2nd order Runge-Kutta methods
Midpoint method
Ralston’s method
11121 2,
2,1,0 k
hhaa
))),(,(( 221 nnh
nh
nnn ytfytfhyy
)3( 2141 kkyy hnn
),(1 nn ytfk
),( 132
32
2 hkyhtfk nn
![Page 29: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/29.jpg)
Department of Computer Science and Engineering, Hanyang University
Comparison: 2Comparison: 2ndnd order R-K method order R-K method
![Page 30: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/30.jpg)
Department of Computer Science and Engineering, Hanyang University
Comparison: 2Comparison: 2ndnd order R-K method order R-K method
Eg. y’ =-2x3+12x2-20x+8.5, y(0)=1
![Page 31: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/31.jpg)
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
hkyhtfk
kytfk
kytfk
ytfk
kkkkhyy
nn
hn
hn
hn
hn
nn
nn
)( 1Pf
nt 2h
nt htn
P1
P2
P3
P4
)( 3Pf
)( 2Pf
)( 1Pf
※ significant improvement over modified Euler’s method
4-th order Runge-Kutta methods4-th order Runge-Kutta methods
![Page 32: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/32.jpg)
Department of Computer Science and Engineering, Hanyang University
Runge-Kutta methodRunge-Kutta method
![Page 33: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/33.jpg)
Department of Computer Science and Engineering, Hanyang University
Eg. 4-th order R-K methodEg. 4-th order R-K method
Significant improvement
![Page 34: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/34.jpg)
Department of Computer Science and Engineering, Hanyang University
DiscussionDiscussion
Better!
![Page 35: Numerical Analysis – Differential Equation](https://reader035.vdocuments.net/reader035/viewer/2022081503/56814d08550346895dba3b1b/html5/thumbnails/35.jpg)
Department of Computer Science and Engineering, Hanyang University
ComparisonComparison
(5th order)