Anda di halaman 1dari 33

PERSAMAAN

DIFERENSIAL
(DIFFERENTIAL EQUATION)

metode euler
metode runge-kutta

Persamaan Diferensial
Persamaan paling penting dalam bidang
rekayasa, paling bisa menjelaskan apa yang
terjadi dalam sistem fisik.
Menghitung jarak terhadap waktu dengan
kecepatan tertentu, 50 misalnya.

dx
50
dt

Rate equations

Persamaan Diferensial
Solusinya, secara analitik dengan integral,

dx 50dt

x 50t C

C adalah konstanta integrasi


Artinya, solusi analitis tersebut terdiri dari
banyak alternatif
C hanya bisa dicari jika mengetahui nilai x
dan t. Sehingga, untuk contoh di atas, jika
x(0) = (x saat t=0) = 0, maka C = 0

Klasifikasi Persamaan Diferensial


Persamaan yang mengandung turunan dari
satu atau lebih variabel tak bebas, terhadap
satu atau lebih variabel bebas.
Dibedakan menurut:
Tipe (ordiner/biasa atau parsial)
Orde (ditentukan oleh turunan tertinggi yang
ada
Liniarity (linier atau non-linier)

PDO
Pers.dif. Ordiner = pers. yg mengandung
sejumlah tertentu turunan ordiner dari satu
atau lebih variabel tak bebas terhadap satu
variabel bebas.
2

d y (t )
dy (t )
t

5
y
(
t
)

e
dt 2
dt
y(t) = variabel tak bebas
t = variabel bebas
dan turunan y(t)
Pers di atas: ordiner, orde dua, linier

PDO
Dinyatakan dalam 1 peubah dalam
menurunkan suatu fungsi
Contoh:

dy
sin x y ' sin x
dx
dP
kP P ' kP
dt

Partial Differential Equation


Jika dinyatakan dalam lebih dari 1 peubah, disebut
sebagai persamaan diferensial parsial
Pers.dif. Parsial mengandung sejumlah tertentu
turunan dari paling tidak satu variabel tak bebas
terhadap lebih dari satu variabel bebas.
Banyak ditemui dalam persamaan transfer polutan
(adveksi, dispersi, diffusi)

2 y ( x , t ) 2 y ( x, t )

0
2
2
x
t

PDO
y ' ' '4 y 2
d 2s
32
2
dt
( y' )2 3 y e x

Ordiner, linier, orde 3


Ordiner, linier, orde 2
Ordiner, non linier, orde 1

Solusi persamaan diferensial


Secara analitik, mencari solusi persamaan
diferensial adalah dengan mencari fungsi
integral nya.
Contoh, untuk fungsi pertumbuhan secara
eksponensial, persamaan umum:

dP
kP
dt

Rate equations

But what you really want to know is


the sizes of the boxes (or state variables) and how they
change through time
That is, you want to know:
the state equations

There are two basic ways of finding the state equations


for the state variables based on your known rate
equations:
1)
2)

Analytical integration
Numerical integration

Suatu kultur bakteria tumbuh dengan


kecepatan yang proporsional dengan
jumlah bakteria yang ada pada setiap
waktu. Diketahui bahwa jumlah bakteri
bertambah menjadi dua kali lipat setiap 5
jam. Jika kultur tersebut berjumlah satu
unit pada saat t = 0, berapa kira-kira
jumlah bakteri setelah satu jam?

Solusi persamaan diferensial


Jumlah bakteri menjadi dua kali lipat setiap 5 jam, maka k =
(ln 2)/5
Jika P0 = 1 unit, maka setelah satu jam

dP
kt
kP
P(t ) P0 e
dt
( (ln 2 ) )(1)
5
P1
t1
P
(
1
)

1
(
e
)
dP
P P t kdt

1
.
1487
0
0
P
ln Ck (t t0 )
P0

The Analytical Solution of the Rate Equation


is the State Equation

Rate equation

(dsolve in Maple)

State equation

There are very few models in


ecology that can be solved
analytically.

Solusi Numerik
Numerical integration
Eulers
Runge-Kutta

Numerical integration makes use of this relationship:

yt t

dy
yt t
dt

Which youve seen before

Relationship between continuous and discrete time models


*You used this relationship in Lab 1 to program the
logistic rate equation in Visual Basic:

Nt
N t 1 N t rN t 1
K

t ,

where t 1

Fundamental Approach of Numerical Integration


yt t

dy
yt t
dt

y = f(t), unknown
yt+t,

yt+t, estimated

unknown
y

dy
dt
yt, known

t, specified

, known

N t t N t rN t 1 t t ,
K

dN

where t 1

dt

Nt/K with time, lambda = 1.7, time step = 1


0.45
0.4
0.35

Nt/K

0.3
0.25
0.2
0.15
0.1
0.05
0
0

10

20

30

40

50

time (years)

Calculate dN/dt*1
at Nt

Nt+ t becomes the new Nt

Add it to Nt to
estimate Nt+ t

Use dN/dt to estimate next Nt+ t

Calculte dN/dt * 1 at new Nt

Repeat these steps to estimate the state


function over your desired time length
(here 30 years)

Eulers Method: yt+ t yt + dy/dt t

Example of Numerical Integration


dy
6 y .007 y 2
dt
Analytical solution to dy/dt

Y0 = 10

t = 0.5

point to
estimate

Eulers Method: yt+ t yt + dy/dt t

dy
6 y .007 y 2
dt
analytical y(t+ t)

m1 = dy/dt at yt
m1 = 6*10-.007*(10)2

y = m1*t

estimated y(t+ t)

yest= yt + y

y
yt = 10
t = 0.5

Runge-Kutta Example
dy
6 y .007 y 2
dt

point to
estimate

Problem: estimate the slope to


calculate y
y

t = 0.5

Runge-Kutta Example

estimated yt+t
Unknown point to
estimate, yt+t

te
h
eig
W

ve
a
d

f>
o
e
r ag

pe
o
l
1s

estimated yt+t

estimated yt+t

yt
t

t
t = 0.5

Runge-Kutta, 4th order


Uses the derivative, dy/dt, to calculate 4 slopes (m1m4)
within t:
f (t , y ) derivative at (t , y )
m1 f (t , y )
m2 f (t t / 2, y m1t / 2)
m3 f (t t / 2, y m2 t / 2)
m4 (t t , y m3 t )

These 4 slopes are used to calculate a weighted slope of the


state function between t and t + t, which is used to estimate
yt+ t:
1
yt t yt (m1 2m2 2m3 m4 )t
6

Step 1:
Evaluate slope at current value of state
variable.

y0 = 10
m1 = dy/dt at y0

m1 = 6*10-.007*(10)2
m1 = 59.3

y0

m1=slope 1

Step 2:
A) Calculate y1at t +t/2 using m1.
B) Evaluate slope at y1.
A) y1 = y0 + m1* t /2
y1 = 24.82
B) m2 = dy/dt at y1
m2 = 6*24.8-.007*(24.8)2
m2 = 144.63

y1

t = 0.5/2

m2=slope 2

Step 3:
Calculate y2 at t +t/2 using k2.
Evaluate slope at y2.
y2 = y0 + k2* t /2
y2 = 46.2
k3 = dy/dt at y2
k3 = 6*46.2-.007*(46.2)2
k3 = 263.0
y2

t = 0.5/2

k3 = slope 3

Step 4:
Calculate y3 at t +t using k3.
Evaluate slope at y3.
y3 = y0 + k3* t

y3

y3 =141.5
k4 = dy/dt at y3
k4 = 6*141.0-.007*(141.0)2
k4 = 706.9
y2

t = 0.5

k4 = slope 4

Now you have 4 calculations of the slope of the state equation


between t and t+t
m4 = slope 4

m3 = slope3

m2 = slope 2
m1 = slope 1
t = 0.5

Step 5:
Calculate weighted slope.
Use weighted slope to estimate y at t +t
1
weighted slope = (m1 2m2 2m3 m4 )
1 6

yt t yt (m1 2m2 2m3 m4 )t


6
true value
weighted slope

t = 0.5

estimated value

Conclusions
Analytical

4th order Runge-Kutta offers


substantial improvement over
Eulers.
Both techniques provide estimates,
not true values.
The accuracy of the estimate
depends on the size of the step used
in the algorithm.

Runge-Kutta
Eulers

Anda mungkin juga menyukai