kuliah-minggu-7

33
PERSAMAAN DIFERENSIAL (DIFFERENTIAL EQUATION) metode euler metode runge-kutta

Upload: ahmad-rizqia

Post on 09-Dec-2015

216 views

Category:

Documents


0 download

DESCRIPTION

bedah

TRANSCRIPT

Page 1: kuliah-minggu-7

PERSAMAAN DIFERENSIAL

(DIFFERENTIAL EQUATION)

metode euler

metode runge-kutta

Page 2: kuliah-minggu-7

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.

50dt

dx

Page 3: kuliah-minggu-7
Page 4: kuliah-minggu-7

Rate equations

Page 5: kuliah-minggu-7

Persamaan Diferensial

• Solusinya, secara analitik dengan integral,

• 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

dtdx 50 Ctx 50

Page 6: kuliah-minggu-7

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)

Page 7: kuliah-minggu-7

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

y(t) = variabel tak bebast = variabel bebasdan turunan y(t)

Pers di atas: ordiner, orde dua, linier

tetydt

tdyt

dt

tyd )(5

)()(2

2

Page 8: kuliah-minggu-7

PDO

• Dinyatakan dalam 1 peubah dalam menurunkan suatu fungsi

• Contoh:

kPPkPdt

dP

xyxdx

dy

'

sin'sin

Page 9: kuliah-minggu-7

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)

0),(),(

2

2

2

2

t

txy

x

txy

Page 10: kuliah-minggu-7

PDO

xeyy

dt

sd

yy

3)'(

32

24'''

2

2

2

Ordiner, linier, orde 3

Ordiner, linier, orde 2

Ordiner, non linier, orde 1

Page 11: kuliah-minggu-7

Solusi persamaan diferensial

• Secara analitik, mencari solusi persamaan diferensial adalah dengan mencari fungsi integral nya.

• Contoh, untuk fungsi pertumbuhan secara eksponensial, persamaan umum:

kPdt

dP

Page 12: kuliah-minggu-7

Rate equations

Page 13: kuliah-minggu-7

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) Analytical integration 2) Numerical integration

Page 14: kuliah-minggu-7

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?

Page 15: kuliah-minggu-7

• Jumlah bakteri menjadi dua kali lipat setiap 5 jam, maka k = (ln 2)/5

• Jika P0 = 1 unit, maka setelah satu jam…

Solusi persamaan diferensial

kPdt

dP

dtkP

dPt

t

P

P 1

0

1

0

)(ln 00

ttCkP

P

ktePtP 0)(

)(1)1()1)(5

)2(ln(eP

1487.1

Page 16: kuliah-minggu-7

Rate equation State equation(dsolve in Maple)

The Analytical Solution of the Rate Equation is the State Equation

Page 17: kuliah-minggu-7

There are very few models in ecology that can be solved

analytically.

Page 18: kuliah-minggu-7

Solusi Numerik

• Numerical integration– Eulers– Runge-Kutta

Page 19: kuliah-minggu-7

Numerical integration makes use of this relationship:

Which you’ve 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:

1 where,11

tt

K

NrNNN t

ttt

tdt

dyyy ttt

Page 20: kuliah-minggu-7

, known

Fundamental Approach of Numerical Integration

y = f(t), unknown

t, specified

y

t

yt, knowndt

dy

yt+t, estimated

tdt

dyyy ttt

yt+t,

unknown

Page 21: kuliah-minggu-7

Euler’s Method: yt+ t ≈ yt + dy/dt t

1 where,1

tt

K

NrNNN t

tttt

dtdN

Calculate dN/dt*1 at Nt

Add it to Nt to estimate Nt+ t

Nt+ t becomes the new Nt

Calculte dN/dt * 1 at new Nt

Use dN/dt to estimate next Nt+ t

Repeat these steps to estimate the state function over your desired time length

(here 30 years)

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

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0 10 20 30 40 50

time (years)

Nt/K

Page 22: kuliah-minggu-7

Example of Numerical Integrationdy

dty y 6 007 2.

Analytical solution to dy/dt

Y0 = 10

t = 0.5

point to estimate

Page 23: kuliah-minggu-7

y

Euler’s Method: yt+ t ≈ yt + dy/dt t

yt = 10

m1 = dy/dt at yt

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

y = m1*t

yest= yt + y

t = 0.5

y

estimated y(t+ t)

analytical y(t+ t)

dy

dty y 6 007 2.

Page 24: kuliah-minggu-7

Runge-Kutta Exampledy

dty y 6 007 2.

t = 0.5

point to estimate

Problem: estimate the slope to

calculate y

y

Page 25: kuliah-minggu-7

Runge-Kutta Example

yt

Weighted

avera

ge of >

1 slope

Unknown point to estimate, yt+Δt

½ Δt Δt t

estimated yt+Δt

estimated yt+Δt

estimated yt+Δt

t = 0.5

Page 26: kuliah-minggu-7

Uses the derivative, dy/dt, to calculate 4 slopes (m1…m4) within Δt:

Runge-Kutta, 4th order

),(

)2/,2/(

)2/,2/(

),(

34

23

12

1

tmyttm

tmyttfm

tmyttfm

ytfm

),(at derivative),( ytytf

tmmmmyy ttt )22(6

14321

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:

Page 27: kuliah-minggu-7

y

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.3m1=slope 1

y0

Page 28: kuliah-minggu-7

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 m2=slope 2

t = 0.5/2

y1

Page 29: kuliah-minggu-7

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

k3 = slope 3

t = 0.5/2

y2

Page 30: kuliah-minggu-7

Step 4:

Calculate y3 at t +t using k3.

Evaluate slope at y3.

y3 = y0 + k3* t

y3 =141.5

k4 = dy/dt at y3

k4 = 6*141.0-.007*(141.0)2

k4 = 706.9

k4 = slope 4

t = 0.5

y2

y3

Page 31: kuliah-minggu-7

m4 = slope 4

t = 0.5

m3 = slope3

m2 = slope 2

m1 = slope 1

Now you have 4 calculations of the slope of the state equation between t and t+Δt

Page 32: kuliah-minggu-7

Step 5:

Calculate weighted slope.

Use weighted slope to estimate y at t +t

t = 0.5

weighted slope =

true value

estimated valueweighted slope

tmmmmyy ttt )22(6

14321

)22(6

14321 mmmm

Page 33: kuliah-minggu-7

Conclusions

• 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

Analytical

Eulers