Ordinary Differential Equations – ODE
http://istiarto.staff.ugm.ac.id http://istiarto.staff.ugm.ac.id Persamaan Diferensial Biasa q Acuan q Chapra, S.C., Canale R.P., 1990, Numerical Methods for Engineers, 2nd Ed., McGraw-Hill Book Co., New York. n Chapter 19 dan 20, hlm. 576-640.
Persamaan Diferensial http://istiarto.staff.ugm.ac.id q
Benda bermassa m jatuh bebas dengan F = −c v
U kecepatan v
- F F F D U a
= =
Hukum Newton II m m
d
v c c = drag coefficient (kg/s)
= −
g v
2
d
t m
)
g = gravitational acceleration (m/s persamaan diferensial http://istiarto.staff.ugm.ac.id Persamaan Diferensial
F U = −c v q
Sebuah benda jatuh bebas q Jika pada saat awal benda dalam keadaan diam: syarat awal (initial condition)
( )
= =
t v v m c g t v
− = d d
( ) ( )
[ ] t m c e gm t v
−
− =
1 Persamaan Diferensial http://istiarto.staff.ugm.ac.id
q Persamaan diferensial
d
v c
= −
g v v variabel tak bebas (dependent variable) q
d
t m t variabel bebas (independent variable) q q Persamaan diferensial biasa
d
v c
= g − v
(ordinary differential equations, ODE)
d
t m
hanya terdiri dari satu variabel bebas 2 q
C C q Persamaan diferensial parsial
∂ ∂
D
− = 2
(partial differential equations, PDE) t x
∂ ∂ http://istiarto.staff.ugm.ac.id Persamaan Diferensial q Persamaan diferensial q tingkat (order) tertinggi suku derivatif q Persamaan diferensial tingkat-1 q suku derivatif bertingkat-1 q Persamaan diferensial tingkat-2 q suku derivatif bertingkat-2 v m c g t v
− = d d d d d d 2 2
= + +
kx t x c t x m http://istiarto.staff.ugm.ac.id Persamaan Diferensial Biasa q Beberapa contoh ODE di bidang engineering q Hukum Newton II ttg gerak q Hukum Fourier ttg panas q Hukum Fick ttg difusi m F t v
= d d
x T k
d d flux Heat
− =
x C D
d d flux Mass
− =
Persamaan Diferensial Biasa
http://istiarto.staff.ugm.ac.id
1 5 .
8
10
4 5 . 2 3 4
- − + − = x x x x y 5 .
8
20
12
2 d d 2 3
- − + − =
x x x x y
diketahui: fungsi polinomial tingkat 4 diperoleh: ODE
di-diferensial-kan Persamaan Diferensial Biasa http://istiarto.staff.ugm.ac.id
5 4 3 2
8 3 2
dy 0.5x + 4 x −10 x + 8.5 x +1 y = − x x x + 8.5
= −2 +12 − 20 dx
4
4
3 d
y Y
d
x
2
- 4
1
Persamaan Diferensial Biasa 5
diketahui: ODE fungsi asal
http://istiarto.staff.ugm.ac.id
8
20
12
2 d d 2 3
- − + − =
x x x x y
- −
- −
- − + − =
di-integral-kan ( )
=
∫ 5 .
8
10
4 5 . d 5 .
8
20
12
2 2 3 4 2 3
C x x x x y x x x x y
Persamaan Diferensial Biasa
- − + − = 5 .
- − + − = x x x
2
1 − 1 −
2
Y C = 3
d d
x y x y
2 d d 2 3
12
8
20
4 5 . 2 3 4 5 .
10
8
8 C x x x x y
4
8
4
http://istiarto.staff.ugm.ac.id
- 4
- 8
- 4
Persamaan Diferensial Biasa http://istiarto.staff.ugm.ac.id 4 3 2 .
5
4
10 8 .
5 y x x x x C
= − − + + + Hasil dari integrasi adalah sejumlah tak berhingga polinomial. q
Penyelesaian yang unique (tunggal, satu-satunya) diperoleh dengan
q menerapkan suatu syarat, yaitu pada titik awal x = 0, y = 1 à ini disebut dengan istilah syarat awal (initial condition).Syarat awal tersebut menghasilkan C = 1. q 4 3 2 .
5
4
10 8 .
5
1 y = − x x − x x + + + Persamaan Diferensial Biasa http://istiarto.staff.ugm.ac.id q Syarat awal (initial condition) q mencerminkan keadaan sebenarnya, memiliki arti fisik q pada persamaan diferensial tingkat n, maka dibutuhkan sejumlah n syarat awal q Syarat batas (boundary conditions) q syarat yang harus dipenuhi tidak hanya di satu titik di awal saja, namun juga di titik-titik lain atau di beberapa nilai variabel bebas yang lain
http://istiarto.staff.ugm.ac.id Persamaan Diferensial Biasa q Metode penyelesaian ODE q Metode Euler q Metode Heun q Metode Euler Modifikasi (Metode Poligon) q Metode Runge-Kutta http://istiarto.staff.ugm.ac.idMetode Euler http://istiarto.staff.ugm.ac.id q Dikenal pula sebagai metode satu y langkah (one-step method) q Persamaan: new value = old value + slope x step size q
y = φ i i q Dalam bahasa matematika:
- y h
- 1
= y y φ h i i
- slope = φ
- 1
jadi, slope atau gradien φ dipakai untuk
q x x i
meng-ekstrapolasi-kan nilai lama y ke
i+1 x i Metode Satu Langkah http://istiarto.staff.ugm.ac.id y = y h
- y
φ
i i
- 1
q Semua metode satu langkah dapat
dinyatakan dalam persamaan tsb. q Perbedaan antara satu metode dengan
metode yang lain dalam metode satu
y y h i i = φ +
- 1
langkah ini adalah perbedaan dalam
slope = φ menetapkan atau memperkirakan slope φ. q Salah satu metode satu langkah adalah
x x i i+1 x
Metode Euler. Metode Euler http://istiarto.staff.ugm.ac.id q Dalam Metode Euler, slope di x diperkirakan
i
d dengan derivatif pertama di titik (x ,y ). y i i, φ = f x y = ( ) i i d x q Metode Euler dikenal pula dengan nama
, x y i i Metode Euler-Cauchy. q Jadi nilai y baru diperkirakan berdasarkan slope, sama dengan derivatif pertama di titik
y = y f x y h ( )
- ,
- i 1 i i i
x, untuk mengekstrapolasikan nilai y lama secara linear dalam selang h ke nilai y baru. Metode Euler http://istiarto.staff.ugm.ac.id q Pakailah Metode Euler untuk mengintegralkan ODE di bawah ini, dari x = 0 s.d. x = 4 dengan selang langkah h = 0.5:
d
y
3
2
,
2
12
20 8 .
5
f x y = = − x x − x
( )
d
x q Syarat awal yang diterapkan pada ODE tsb adalah bahwa di titik x= 0, y = 1 q Ingat, penyelesaian eksak ODE di atas adalah:
- =
= + =
Error, yaitu selisih antara nilai y
1
sesungguhnya dari penyelesaian eksak:
qy q Nilai y
=
=
4 5 . 5 . 2 3 4 1
10 5 .
8 5 .
3 1 5 . 5 .
h y x f y y ( ) ( ) ( ) ( ) 21875 .
1 , 1
8
5 5 . 5 .
( ) ( ) 25 .
12 2 , 2 3 = + − + − = y x f
20
8
8 5 .
( ) ( ) ( ) ( ) 5 .
1 = x + h = 0.5:
http://istiarto.staff.ugm.ac.id Metode Euler q Selang ke-1, dari x = 0 s.d. x
- −
- −
1 sesungguhnya dan estimasi: http://istiarto.staff.ugm.ac.id Metode Euler i x i y i(eksak) y i(Euler)
ε t
5 2.5 2.71875 4.75 -75%
6
4
2
7 3.5 4.71875 7.125 -51%
3 4 5.875 -47%
6
2 4.5 -125%
1
2
4
3 1.5 2.21875 5.125 -131%
1 3 5.875 -96%
2
1 0.5 3.21875 5.25 -63%
1
8 X Y Euler Eksak Metode Euler http://istiarto.staff.ugm.ac.id q Error atau kesalahan terdiri dari dua aspek
q Truncation or discretization errors (kesalahan pemotongan) yang
disebabkan oleh teknik penyelesaian dalam mengestimasikan nilai y. n local truncation error, yaitu kesalahan pada satu langkah n propagated truncation error, yaitu kesalahan-kesalahan pada langkah-langkah terdahulu
q Round-off errors yang disebabkan oleh keterbatasan jumlah digit dalam hitungan atau jumlah digit dalam alat hitung (kalkulator, komputer).
O h h y x f h y x f h y x f y y
ξ adalah sembarang titik di antara x
n n i i
n
i i i i i iʹ′
,
, ... ,
1
2
1
1
( ) ( )
( ) ( )
( )
Deret Taylor dapat pula dituliskan dalam bentuk lain sbb.
i+1 .
dan x
i
n n n i i h n y R x x h
- ʹ′
- =
- ʹ′ʹ′
- ! ...
R h n y h y h y y y
http://istiarto.staff.ugm.ac.id Metode Euler q
Deret Taylor ( ) x y y x f y
d d ,
= = ʹ′
( ) n n n i i
2 2 1
ξ = − =
( ) ( ) ( )
1
1
1
!
1 ,
−
- =
n −
1 ( )
ʹ′ , ,
f x y f x y ( )
2 ( )
n n1 i i i i , ... y = y f x y h h h O h
( ) ( )
- i 1 i i i
2 !
n
Euler Error, E
t true local truncation error of the Euler Method (E ) q t
untuk selang h kecil, error mengecil seiring dengan
q
peningkatan tingkat
error E dapat didekati dengan E q t a
ʹ′ ,
f x y ( ) 2 Metode Euler http://istiarto.staff.ugm.ac.id
3
2
5 − −
( )
2 x 12 x 20 x + + f x , y = 8 .
Hitunglah error yang terjadi (E ) pada penyelesaian ODE tersebut;
q t hitunglah komponen error setiap suku pada persamaan E . t
Selesaikan ODE tersebut dengan memakai h = 0.25;
q
bandingkan dengan penyelesaian sebelumnya; bandingkan juga error yang terjadi.
Baca buku acuan pada hlm 580-584 untuk membantu Sdr dalam membuat
q
Metode Euler http://istiarto.staff.ugm.ac.id
q Error pada Metode Euler dapat dihitung dengan memanfaatkan Deret Taylor
q Keterbatasan qDeret Taylor hanya memberikan perkiraan/estimasi local truncation error, yaitu error yang timbul pada satu langkah hitungan Metode Euler, bukan propagated truncation error. q
Hanya mudah dipakai apabila ODE berupa fungsi polinomial sederhana yang mudah untuk di-diferensial-kan, fi(xi,yi) mudah dicari. q Perbaikan Metode Euler, memperkecil error q Pakailah selang h kecil. q Metode Euler tidak memiliki error apabila ODE berupa fungsi linear. http://istiarto.staff.ugm.ac.id
Metode Heun Metode Heun http://istiarto.staff.ugm.ac.id
Slope di selang antara x dan di x ditetapkan i i+1 y
sebagai nilai rata-rata slope di awal dan di akhir selang, yaitu di x dan di x :
i i+1 ʹ′
y = f x , y
i i i ( )- + φ φ i i 1 sl
- y y f x , y h
2 i i i i 1 = ( )
Euler à sebagai prediktor
- ʹ′ ,
y = f x y i 1 i ( ) 1 i 1
slope = φ i ʹ′ ʹ′ , , y y f x y f x y i i i i i + + 1 ( ) ( ) 1 i 1
ʹ′ y
= = slope = φ i x x
- 1
i i+1 x
2
2 Metode Heun http://istiarto.staff.ugm.ac.id q Pakailah Metode Heun untuk mengintegralkan ODE di bawah ini, dari x = 0 s.d. x = 4 dengan selang langkah h = 1
d y . 8
x 4 .
5 ʹ′
y = = e − y
d
x
q Syarat awal yang diterapkan pada ODE tsb adalah bahwa pada x = 0,
y = 2 q Penyelesaian eksak ODE tsb yang diperoleh dari kalkulus adalah:4 Metode Heun http://istiarto.staff.ugm.ac.id
Selang ke-1, dari x = 0 s.d. x = x + h = 1: q . 8
1 ( )
, ,
2 4 − .
5
2 3 slope di titik ujung awal, (x , y )
f x y = f ( ) = e ( ) = ( )
[ ]
,
2
3
1
5
y y f x y h
= = ( ) = prediktor y + + 1 ( )
1 .
8
1 ( ) f x , y = f
1 , 5 = 4 e .
5 5 = 6 . 4021637 slope di titik ujung akhir, (x , y ) −
( ) ( ) ( ) [ ]
1
1
1
1
6 . 4021637 4 . 70108185 ʹ′ slope rata-rata selang ke-1 y = =
- 3
2
2 4 . 70108185
1 6 . 7010819
korektor y
y y y ʹ′ h = = = + +
http://istiarto.staff.ugm.ac.id Metode Heun i x i y i (eksak) f(x i
,y i
) awal y i (prediktor) f(x i
,y i
) akhir f(x i
,y i
) rerata y i (korektor)
ε t
2 3 --- --- --- 2 ---
1 1 6.1946 5.5516 5.0000 6.4022 4.7011 6.7011 -8%
2 2 14.8439 11.6522 12.2527 13.6858 9.6187 16.3198 -10%
3 3 33.6772 25.4931 27.9720 30.1067 20.8795 37.1992 -10%
4 4 75.3390 --- 62.6923 66.7840 46.1385 83.3378 -11%
Metode Heun http://istiarto.staff.ugm.ac.id
90 Heun
60 Y
Eksak
30
1
2
3
4 http://istiarto.staff.ugm.ac.id Metode Heun q
Metode Heun dapat diterapkan secara iteratif pada saat menghitung slope di ujung akhir selang dan nilai y i+1 korektor q nilai y i+1 korektor pertama dihitung berdasarkan nilai y i+1 prediktor q nilai y i+1 korektor tersebut dipakai sebaga nilai y i+1 prediktor q hitung kembali nilai y i+1 korektor yang baru q ulangi kedua langkah terakhir tersebut beberapa kali q
- =
- =
Perlu dicatat bahwa q error belum tentu selalu berkurang pada setiap langkah iterasi
( ) ( ) h y x f y x f y y i i i i i i
2 , , 1 1
- + 1 + +
( ) ( ) h y x f y x f y y i i i i i i
2 , , 1 1
- + 1 + +
Iterasi kedua pada selang ke-1, dari x = 0 s.d. x = x + h = 1: q
1
6 . 7010819
y = y = 1 1 old
prediktor y = korektor y
( ) 1 1(lama)
, 1 , 6 . 7010819
f x y = f ( ) ( ) 1 1 slope di titik ujung akhir, (x , y ) . 8 1
1
1 ( ) 4 .
5 6 . 7010819 −
= e ( )
[ ]
5 . 5516228 =
5 . 5516228 4 . 2758114 ʹ′ slope rata-rata selang ke-1 y = =
- 3
2
2 4 . 27581145
1 6 . 2758114
korektor y
ʹ′ y y y h 1 = = ( ) = + +
1 http://istiarto.staff.ugm.ac.id
Metode Poligon
Modified Euler Method
( ) Metode Poligon http://istiarto.staff.ugm.ac.id
Slope di selang antara x dan di x ditetapkan i i+1 y
sebagai nilai slope di titik tengah selang, yaitu di
x : i+½
ʹ′ y = f x , y i i i ( ) slope di titik awal slope = φ i
- ½
h 1 , i i i
- y = y f x y ekstrapolasi ke titik tengah
( )
- i 2
- ½
- i i+½ i+1 x 1 , 1 ekstrapolasi ke titik akhir y = y f x y h i
- 3.5 47.5022 42.0275 75.9686 -0.8%
- q
- = φ ... 2 2 1 1
- =
=
- ... , ,
- = φ
- -order RK
- =
- ( ) ( )
- = =
- ∂ ∂
- =
- ( )
- i i i i i i i i 1 2 2 1 2 11 x x
- ,
- i
- a a =
- =
- 2
- = =
- =
- ( )
- = =
- =
- ( )
- = = >−
- =
- =
- ( ) >=
- =
- = =
2 ʹ′ y 1 = f x 1 , y 1 slope = φ i i ( i i ) slope di titik tengah 2 2 + + + 2 slope = φ i
x x x
1 ii i 2 2
( ) Metode Poligon http://istiarto.staff.ugm.ac.id q Pakailah Metode Poligon untuk mengintegralkan ODE di bawah ini, dari x = 0 s.d. x = 4 dengan selang langkah h = 1
d y . 8
x 4 .
5 ʹ′
y = = e − y
d
x
q Syarat awal yang diterapkan pada ODE tsb adalah bahwa pada x = 0,
y = 2 q Ingat penyelesaian eksak ODE tsb yang diperoleh dari kalkulus adalah:4 Metode Poligon http://istiarto.staff.ugm.ac.id
Selang ke-1, dari x = 0 sd x = x + h = 1: q . 8
1 ( )
, ,
2 4 − .
5
2 3 slope di titik ujung awal, (x , y )
f x y = f ( ) = e ( ) = ( )
[ ] h
,
2
3
1
2 3 .
5
y 1 = y f x y = = titik tengah y
( ) ( ) 2 ½
2 .
8 .
5 ( ) slope di titik tengah, (x , y ) f x 1 , y 1 f .
5 , 3 .
5 4 e .
5 3 .
5 4 . 2173 ½ ½ = = − =
( ) [ ] ( ) ( ) 2 2 1 , y 1 h =
ekstrapolasikan y ke y
1 ( )
2 + + y = y f x 4 . 2173 1 = 6 . 2173
1 ( ) 2 2
http://istiarto.staff.ugm.ac.id Metode Poligon i x i y i (eksak) f(x i
,y i
) x i +½ y i +½ f(x i +½
,y i +½
) y i
ε t
2 3 --- --- --- 2 ---
1 1 6.1946 5.7935 0.5 3.5000 4.2173 6.2173 -0.4%
2 2 14.8439 12.3418 1.5 9.1141 8.7234 14.9407 -0.7%
3 3 33.6772 27.1221 2.5 21.1116 19.0004 33.9412 -0.8%
4 4 75.3390
Metode Poligon http://istiarto.staff.ugm.ac.id
90 Poligon
60 Y
Eksak
30
1
2
3
4 http://istiarto.staff.ugm.ac.id
Metode Runge-Kutta Metode Runge-Kutta http://istiarto.staff.ugm.ac.id q Metode Euler q kurang teliti q ketelitian lebih baik diperoleh dengan cara memakai pias kecil atau memakai suku-suku derivatif berorde lebih tinggi pada Deret Taylor q Metode Runge-Kutta q lebih teliti daripada Metode Euler q tanpa memerlukan suku derivatif
http://istiarto.staff.ugm.ac.id Metode Runge-Kutta q Bentuk umum penyelesaian ODE dengan Metode Runge-Kutta adalah:( ) h h y x y y i i i i
, ,
1 φ + =
Fungsi φ dapat dituliskan dalam bentuk umum sbb: ( ) h y x i i
, , φ adalah increment function yang dapat diinterpretasikan sebagai slope atau gradien fungsi y pada selang antara x
i s.d. x i+1 n n k a k a k a
a adalah konstanta dan k adalah: ( ) ( ) h k q y h p x f k y x f k i i i i 1 11 1 2 1
, ,
setiap k saling terhubung dengan http://istiarto.staff.ugm.ac.id Metode Runge-Kutta q Terdapat beberapa jenis Metode Runge-Kutta yang dibedakan dari jumlah suku pada persamaan untuk menghitung k: q RK tingkat-1 (first-order RK): n = 1 q RK tingkat-2 (second-order RK): n = 2 q RK tingkat-3 (third-order RK): n = 3 q RK tingkat-4 (fourth-order RK): n = 4 q Order of magnitude kesalahan penyelesaian Metode RK tingkat n: q local truncation error = O(h n+1
)
n ( ) ( ) n n i i i i i i k a k a k a h y x h h y x y y
φ + =
, , 2 2 1 1 1
q Bentuk umum persamaan penyelesaian ODE dengan 2 nd
∂
⎞ ⎛ ∂
2
h
y x f,
= ʹ′ d
∂ ∂
d d ,
x y y f x f y x f i i
ʹ′
h y x f h y x f y y i i i i i i
2 , , 2 1
q Deret Taylor ( ) ( )
unknowns à perlu 4 persamaan
11
1
, q
, p
2
, a
1
a
, ,
h k q y h p x f k
y x f k
i i i i 1 11 1 2 11
1
1
2
2
( ) h k a k a y y i i
http://istiarto.staff.ugm.ac.id Second-order Runge-Kutta Method
Second-order Runge-Kutta Method
http://istiarto.staff.ugm.ac.id q Ingat, Deret Taylor untuk fungsi yang memiliki 2 variabel∂ ∂
g g , , ... g x r y s g x y r s
( ) = ( ) + + + + +
∂ x ∂ y
Bentuk di atas diterapkan pada persamaan k q
2
∂ ∂
f f 2
, ,
k f x p h y q k h f x y p h q k h O h
= = + + +
- 2 ( ) ( ) 1 11 1 1 11 1
∂ x ∂ y
i i i i ( )
nd
q Bentuk umum penyelesaian ODE metode 2 -order RK menjadi:
2 ∂ f ∂ f 2 3 y hf x , y hf x , y p h q h f x , y= y + a + a + a + a + O h 1 2 2 1 2 11 i+1 i i i i i i i
( ) ( ) ( ) ( ) ∂x ∂x
Second-order Runge-Kutta Method http://istiarto.staff.ugm.ac.id q Bandingkan persamaan di atas dengan persamaan semula f f 2 3
∂ ∂ ⎡ ⎤
, , ,
y = y a f x y a f x y h a p a q f x y h O h
[ ( ) ( ) ] ( ) ( ) 1
∂ ∂ ⎢⎣ ⎥⎦
2
d
f x y h
⎛ ∂ ∂ ⎞
y = y f x y h
( ) ⎜ ⎟
1 i i i
d
2
x y x
∂ ∂ ⎝ ⎠
Agar kedua persamaan di atas ekuivalen, maka: q
1
1
q
1 a p = salah satu variabel harus ditetapkan.
2
2
1
Second-order Runge-Kutta Method http://istiarto.staff.ugm.ac.id q Jika a ditetapkan, maka:
2
= +
a a a = − a Karena ada sejumlah tak berhingga nilai a , q
1
1
2
1
2
1
2
maka terdapat pula sejumlah tak berhingga
1 a p =
2
1
2
1 p = q = 2nd-order RK methods.
1
11
1 a a q =
2
2
2
2
q
hasil yang persis sama jika fungsi penyelesaian ODE yang dicari adalah fungsi kuadrat, linear, atau konstanta.
hk y h x f k y x f k i i i i
1
1
2 ,
1 = = = ⇒ = q p a a
( ) ( ) 1 2 1
, ,
2 1 h k y y i i
1
2
1
( ) 1 2 1 2 1 2 1
, ,
hk y h x f k y x f k i i i i
3
1
11
1
2
2
http://istiarto.staff.ugm.ac.id Second-order Runge-Kutta Method q Metode Heun dengan korektor tunggal q Metode poligon yang diperbaiki (improved polygon method) q Metode Ralston
1 ,
11
1
2
1
1
1
1
2 = = = ⇒ = q p a a
( ) h k k y y i i
2
2
1
1
2
Second-order Runge-Kutta Method http://istiarto.staff.ugm.ac.id nd q Pakailah berbagai 2 -order RK methods untuk mengintegralkan ODE di bawah ini, dari x = 0 s.d. x = 4 dengan selang langkah h = 0.5:
d
y
3
2
,
2
12
20 8 .
5
f x y = = − x x − x
( )
d x
q Syarat awal yang diterapkan pada ODE tsb adalah bahwa di titik x= 0, y = 1
q Bandingkan hasil-hasil penyelesaian dengan berbagai metode RK tsb.
Second-order Runge-Kutta Method http://istiarto.staff.ugm.ac.id
Single-corrector Heun
i x y k k φ y ε t i i (eksak)
1 2 i
1
8.5
1.25 4.875 1 0.0%1 0.5 3.21875 1.25 -1.5 -0.125 3.4375 -6.8%
2
1 3 -1.5 -1.25 -1.375 3.375 -12.5%
3 1.5 2.21875 -1.25 0.5 -0.375 2.6875 -21.1%
4
2
2
0.5
2.25 1.375 2.5 -25.0%5 2.5 2.71875
2.25
2.5 2.375 3.1875 -17.2%6
3
4 2.5 -0.25 1.125 4.375 -9.4%
7 3.5 4.71875 -0.25 -7.5 -3.875 4.9375 -4.6% http://istiarto.staff.ugm.ac.id Second-order Runge-Kutta Method
Improved Polygon i x i y i (eksak) k
4
4 2.5 1.59375 1.59375 3.8125 4.7%
3
6
5 2.5 2.71875 2.25 2.65625 2.65625 2.484375 8.6%
2 0.5 1.46875 1.46875 1.75 12.5%
2
3 1.5 2.21875 -1.25 -0.46875 -0.46875 1.984375 10.6%
1 k
1 3 -1.5 -1.65625 -1.65625 2.8125 6.3%
2
1 0.5 3.21875 1.25 -0.59375 -0.59375 3.109375 3.4%
1 8.5 4.21875 4.21875 1 0.0%
ε t
2 φ y i
7 3.5 4.71875 -0.25 -3.21875 -3.21875 4.609375 2.3% http://istiarto.staff.ugm.ac.id Second-order Runge-Kutta Method
Second-order Ralston Runge-Kutta i x i y i (eksak) k
4
4 2.5 0.800781 1.367188 4.117188 -2.9%
3
6
5 2.5 2.71875 2.25 2.660156 2.523438 2.855469 -5.0%
2 0.5 1.894531 1.429688 2.140625 -7.0%
2
3 1.5 2.21875 -1.25 0.003906 -0.41406 2.347656 -5.8%
1 k
1 3 -1.5 -1.51172 -1.50781 3.101563 -3.4%
2
1 0.5 3.21875 1.25 -1.15234 -0.35156 3.277344 -1.8%
1 8.5 2.582031 4.554688 1 0.0%
ε t
2 φ y i
7 3.5 4.71875 -0.25 -5.18359 -3.53906 4.800781 -1.7%
Second-order Runge-Kutta Method http://istiarto.staff.ugm.ac.id
6 Y
4 Exact Heun
Improved Polygon
2 Ralston
X http://istiarto.staff.ugm.ac.id Third-order Runge-Kutta Method q Persamaan penyelesaian ODE 3rd-order RK methods: q Catatan: q
Jika derivatif berupa fungsi x saja, maka 3rd-order RK sama dengan persamaan Metode Simpson ⅓
( ) [ ] h k k k y y i i 3 2 1 6 1 1
4
( ) ( ) 2 1 3 1 2 1 2 1 2 1
2 , ,
,
hk hk y h x f k hk y h x f k y x f k i i i i i i http://istiarto.staff.ugm.ac.id Third-order Runge-Kutta Method
Third-order Runge-Kutta i x i y i (eksak) k
4
4 2.5 1.594 -0.25 1.438 4 0.0%
3
6
5 2.5 2.71875
2.25 2.656
2.5 2.563 2.71875 0.0%2
0.5 1.469
2.25 1.438 2 0.0%2
3 1.5 2.21875 -1.25 -0.469 0.5 -0.438 2.21875 0.0%
1 k
1 3 -1.5 -1.656 -1.25 -1.563 3 0.0%
2
1 0.5 3.21875 1.25 -0.594 -1.5 -0.438 3.21875 0.0%
1
8.5 4.219
1.25 4.438 1 0.0%ε t
3 φ y i
2 k
7 3.5 4.71875 -0.25 -3.219 -7.5 -3.438 4.71875 0.0% http://istiarto.staff.ugm.ac.id Fourth-order Runge-Kutta Method q Persamaan penyelesaian ODE 4th-order RK methods: q Catatan: q
Jika derivatif berupa fungsi x saja, maka 4th-order RK sama dengan persamaan Metode Simpson ⅓
( ) [ ] h k k k k y y i i 4 3 2 1 6 1 1
2
2
( ) ( ) ( ) 3 4 2 2 1 2 1 3 1 2 1 2 1 2 1
, , ,
,
hk y h x f k hk y h x f k hk y h x f k y x f k i i i i i i i i
Fourth-order Runge-Kutta Method http://istiarto.staff.ugm.ac.id
Fourth-order Runge-Kutta i x y k k k k φ y ε t i i (eksak)
1
2
3 4 i
1
8.5 4.219 4.219
1.25
4.44 1 0.0%
1 0.5 3.21875 1.25 -0.594 -0.594 -1.5 -0.44 3.21875 0.0%
2
1 3 -1.5 -1.656 -1.656 -1.25 -1.56 3 0.0%
3 1.5 2.21875 -1.25 -0.469 -0.469 0.5 -0.44 2.21875 0.0%
4
2
2
0.5 1.469 1.469
2.25
1.44 2 0.0%
5 2.5 2.71875
2.25 2.656 2.656
2.5 2.56 2.71875 0.0%6
3
4 2.5 1.594 1.594 -0.25
1.44 4 0.0%
7 3.5 4.71875 -0.25 -3.219 -3.219 -7.5 -3.44 4.71875 0.0%
59 3rd- and 4th-order Runge-Kutta Methods http://istiarto.staff.ugm.ac.id rd q Pakailah 3 -order dan 4th-order RK methods untuk mengintegralkan ODE di bawah ini, dari x = 0 s.d. x = 4 dengan selang langkah h = 0.5:
d
y
3
2
,
2
12
20 8 .
5
f x y = = − x x − x
( )
d x
§ Syarat awal yang diterapkan pada ODE tsb adalah bahwa di titik x = 0, y = 1 http://istiarto.staff.ugm.ac.id
3rd- and 4th-order Runge-Kutta Methods
60 Node Exact Solution Third-order RK Fourth-order RK i x i y i y iε t y i
ε t
1 1 0.0% 1 0.0%
1 0.5 3.21875 3.21875 0.0% 3.21875 0.0%
2
1
3 3 0.0% 3 0.0%
3 1.5 2.21875 2.21875 0.0% 2.21875 0.0%
4
2
2 2 0.0% 2 0.0%
5 2.5 2.71875 2.71875 0.0% 2.71875 0.0%
6
3
4 4 0.0% 4 0.0%
7 3.5 4.71875 4.71875 0.0% 4.71875 0.0%