Professional Documents
Culture Documents
Persamaan Differensial Biasa
Persamaan Differensial Biasa
ODEs
Ordinary Differential Equations
• Equations which are composed of an unknown
function and its derivatives are called
differential equations.
dv c v - dependent variable
=g- v
dt m t - independent variable
dy
- Linear 1st order ODE + a × y = f (x )
dx
dy
1st
- Non-Linear order ODE = f ( x, y )
Where f(x,y) is nonlinear
dx
Ordinary Differential Equations
Euler’s Method
!"
= %(#, ")
!#
")*+ − ")
= %(#) , ") )
ℎ
dy
= f ( x, y )
dx
Solution :
dy
yi +1 = y=i +f (fx(,xyi ,)yi ) × h
dx
Solution :
yi +1 = yi + f ( xi , yi ) × h
Obtain a solution between x = 0 to x = 4 with a step size of 0.5
for: dy 3
= -2 x + 12 x - 20 x + 8.5
2
dx Kondisi awal
Initial conditions are: x = 0 to y = 1
on : yi +1 = yi + f ( xi , yi ) × h x y
0 1
0.5
! "# , %# = −2"#) + 12"#, − 20"# + 8.5 1.0
1.5
2.0
2.5
3.0
3.5
4.0
n: yi +1 = yi + f ( xi , yi ) × h
! "# , %#) = −2"#* + 12"#- − 20"# + 8.5
x y
0 1
0.5 5.25
1.0 5.875
1.5
2.0
2.5
3.0
3.5
4.0
Euler’s Method: Example
• Although the computation captures the general trend
solution, the error is considerable.
• This error can be reduced by using a smaller step size.
Improvements of Euler’s method
• A fundamental source of error in Euler’s
method is that the derivative at the beginning
of the interval is assumed to apply across the
entire interval.
• Heun’s Method:
Involves the determination
dydy
of two derivatives for the f(xi+h,yi+k1h)
= f ( x , y ) f(xi,yi)
dxdx = fat( xthe
interval , y ) initial point
xi xi+h
x
and the end point.
Solution
Solution ::
11 1 1 y
yiy+1i +1== yyii ++(( k1k+1 + k2 )k× 2h) × h ea
22 2 2
k k1== ff ((xxi ,, yyi ))
1 i i
k 2 = f (( xi + h ), ( yi + k1h ) ) Slope: 0.5(k1+k2)
k 2 = f (( xi + h ), ( yi + k1h ) ) x
xi xi+h
Runge-Kutta Methods y
• Midpoint Method:
dy Euler’s method to predict
Uses
ady = off (yxat
value , ythe
) midpoint of
dx= f ( x, y ) f(xi,yi) f(xi+h/2,yi+k1h/2)
the
dxinterval: x
Solution : xi xi+h/2
Solution
yi +1 = yi: + k 2 × h
y
yki +1== fy(i x+,ky2 ×) h
1 i i
k1 = f ( xi , yi )1 1 ea
k 2 = f ( xi +1 h, yi +1 k1h )
k 2 = f ( xi + 2h, yi + 2k1h )
2 2 Slope: k2
x
Chapter 25 xi xi+h
dy
Runge-Kutta
dy = f ( x, y ) Methods y
dx = f ( x, y )
•dx
Ralston’s Method:
Solution :
Solution :
1 2 f(xi+ 3/4 h,
yi +1 = yi + ( 1k1 + 2k 2 ) × h f(xi,yi) yi+3/4k1h)
yi +1 = yi + (3 k1 +3 k 2 ) × h xi
k1 = f ( xi , yi )3 3 xi+3/4h x
k1 = f ( xi , y3i ) 3 y
k 2 = f ( xi + h, yi + k1h )
43 4 3 ea
k = f ( x + h, y + k h )
2 i i 1
4 4
Slope:
(1/3k1+2/3k2)
Chapter 25 xi xi+h x
Runge-Kutta Methods
• Runge-Kutta methods achieve the accuracy of a Taylor series
approach without requiring the calculation of higher derivatives.
y i +1 = y i + f (x i , y i , h )h
Increment function
f = a1k 1 + a2 k 2 + + an k n
(representative slope
a ' s = constants over the interval)
k 1 = f (x i , y i )
k 2 = f (x i + p1h , y i + q11k 1h )
k 3 = f (x i + p 3h , y i + q 21k 1h + q 22 k 2 h )
a1 + a2 = 1
1
a 2 p1 = A value is assumed for one of the
2 unknowns to solve for the other
1 three.
a2 q11 =
2
Runge-Kutta Methods
1 1
a1 + a2 = 1, a 2 p1 = , a2 q11 =
2 2
dx Kondisi awal
Initial conditions are: x = 0 to y = 1
on : yi +1 = yi + f ( xi , yi ) × h x y
0 1
0.5
! "# , %# = −2"#) + 12"#, − 20"# + 8.5 1.0
1.5
2.0
2.5
3.0
3.5
4.0
Chapter 25 22
Runge-Kutta Methods
3. Third order RK methods
1
yi +1 = yi + ( k1 + 4k 2 + k3 ) h
6
where
k1 = f ( x i , yi )
1 1
k 2 = f ( xi + h, yi + k1h)
2 2
k3 = f ( xi + h, yi - k1h + 2k 2 h)
Chapter 25
Runge-Kutta Methods
4. Fourth order RK methods
1
yi +1 = yi + (k1 + 2k 2 + 2k3 + k 4 )h
6
where
k1 = f ( x i , yi )
1 1
k 2 = f ( xi + h, yi + k1h)
2 2
1 1
k3 = f ( xi + h, yi + k 2 h)
2 2
k3 = f ( xi + h, yi + k3 h)
Chapter 25
Comparison of Runge-Kutta Methods
f ( x, y ) = 4e 0.8 x
- 0.5 y
Kondisi awal y(0) = 2,
Catatan: jawaban eksaknya y(4) = 75.33896
Chapter 25