• Tidak ada hasil yang ditemukan

PERSAMAAN DIFERENSIAL (DIFFERENTIAL EQUATION) M E T O D E E U L E R M E T O D E R U N G E - K U T T A

N/A
N/A
Protected

Academic year: 2021

Membagikan "PERSAMAAN DIFERENSIAL (DIFFERENTIAL EQUATION) M E T O D E E U L E R M E T O D E R U N G E - K U T T A"

Copied!
49
0
0

Teks penuh

(1)

PERSAMAAN

DIFERENSIAL

(DIFFERENTIAL EQUATION)

M E T O D E E U L E R M E T O D E R U N G E - K U T T A

(2)

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.

50

dt

dx

(3)
(4)
(5)

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

(6)

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)

(7)

SOLUSI PERSAMAAN DIFERENSIAL

• Secara analitik, mencari solusi persamaan

diferensial adalah dengan mencari fungsi integral nya.

• Contoh, untuk fungsi pertumbuhan secara

eksponensial, persamaan umum:

kP

dt

(8)
(9)

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

(10)

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?

(11)

• 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

kP

dt

dP

dt

k

P

dP

t t P P

1 0 1 0

)

(

ln

0 0

t

t

Ck

P

P

kt

e

P

t

P

(

)

0

)

(

1

)

1

(

5 )(1) ) 2 (ln (

e

P

1487

.

1

(12)

Rate equation (dsolve in Maple) State equation

The Analytical Solution of the Rate

Equation is the State Equation

(13)

THERE ARE VERY FEW MODELS IN

ECOLOGY THAT CAN BE SOLVED

(14)

SOLUSI NUMERIK

• Numerical integration • Eulers

(15)

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 , 1 1             t t K N rN N Nt t t t t dt dy y yttt  

(16)

, known

Fundamental Approach of Numerical Integration

y = f(t), unknown t, specified y t yt, known dt dy yt+t, estimated t dt dy y yttt   yt+t, unknown

(17)

Euler’s Method:

y

t+ t

≈ y

t

+

dy

/

dt

t

1 where , 1              t t K N rN N N t t t t t dt dN 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

(18)

EXAMPLE OF NUMERICAL

INTEGRATION

dy

dt

6

y

007

y

2

.

Analytical solution to dy/dt

Y0 = 10

 t = 0.5

point to estimate

(19)

y

Euler’s Method:

y

t+ t

≈ y

t

+

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

dt

6

y

007

y

2

.

(20)

20

RUNGE-KUTTA

METHODS

(21)

MOTIVATION

• We seek accurate methods to solve ODEs that do

not require calculating high order derivatives.

• The approach is to use a formula involving

unknown coefficients then determine these

coefficients to match as many terms of the Taylor series expansion.

(22)

SECOND ORDER RUNGE-KUTTA

METHOD

22

possible.

as

accurate

as

is

that

such

,

,

,

:

Problem

)

,

(

)

,

(

1 2 1 2 2 1 1 1 1 2 1  

i i i i i i i

y

w

w

Find

K

w

K

w

y

y

K

y

h

x

f

h

K

y

x

f

h

K

(23)

TAYLOR SERIES IN ONE VARIABLE

23

h

x

and

x

between

is

x

where

x

f

n

h

x

f

i

h

h

x

f

f(x)

n

n n i n i i

  

(

)

)!

1

(

)

(

!

)

(

of

expansion

Series

Taylor

order

The

) 1 ( 1 ) ( 0 th Approximation Error

(24)

DERIVATION OF 2

ND

ORDER

RUNGE-KUTTA METHODS – 1 OF 5

24

)

(

)

,

(

'

2

)

,

(

:

as

written

is

which

)

(

2

)

,

(

:

ODE

solve

to

Used

Expansion

Series

Taylor

Order

Second

3 2 1 3 2 2 2 1

h

O

y

x

f

h

y

x

f

h

y

y

h

O

dx

y

d

h

dx

dy

h

y

y

y

x

f

dx

dy

i i i i i i i i

 

(25)

DERIVATION OF 2

ND

ORDER

RUNGE-KUTTA METHODS – 2 OF 5

25

)

(

2

)

,

(

)

,

(

:

)

,

(

)

,

(

)

,

(

)

,

(

'

ation

differenti

rule

-chain

by

obtained

is

)

,

(

'

where

3 2 1

O

h

h

y

x

f

y

f

x

f

h

y

x

f

y

y

ng

Substituti

y

x

f

y

f

x

f

dx

dy

y

y

x

f

x

y

x

f

y

x

f

y

x

f

i i i i i i





(26)

TAYLOR SERIES IN TWO VARIABLES

26 ) , ( and ) , ( between joining line the on is ) , ( ) , ( )! 1 ( 1 ) , ( ! 1 ... 2 ! 2 1 ) , ( ) , ( 1 0 2 2 2 2 2 2 2 k y h x y x y x error ion approximat y x f y k x h n y x f y k x h i y x f hk y f k x f h y f k x f h y x f k y h x f n n i i                                                             

(27)

DERIVATION OF 2

ND

ORDER

RUNGE-KUTTA METHODS – 3 OF 5

27

)

,

(

)

,

(

:

ng

Substituti

)

,

(

)

,

(

that

such

,

,

,

:

Problem

1 2 1 1 2 2 1 1 1 1 2 1 2 1

K

y

h

x

f

h

w

y

x

f

h

w

y

y

K

w

K

w

y

y

K

y

h

x

f

h

K

y

x

f

h

K

w

w

Find

i i i i i i i i i i i i

 

(28)

DERIVATION OF 2

ND

ORDER

RUNGE-KUTTA METHODS – 4 OF 5

28 ... ) , ( ) , ( ) ( ... ) , ( ) ( ... ) , ( ) , ( : ... ) , ( ) , ( 2 2 2 2 2 1 1 1 2 2 1 1 1 2 1 1 1 1                                                      i i i i i i i i i i i i i i i i i i i i y x f y f h w x f h w y x f h w w y y y f K x f h h w y x f h w w y y y f K x f h y x f h w y x f h w y y ng Substituti y f K x f h y x f K y h x f          

(29)

DERIVATION OF 2

ND

ORDER

RUNGE-KUTTA METHODS – 5 OF 5

29 2 1 , 1 : solution possible One solutions infinite unknowns 4 with equations 3 2 1 and , 2 1 , 1 : equations three following the obtain we terms, M atching ) ( 2 ) , ( ) , ( ... ) , ( ) , ( ) ( : for expansions two derived We 2 1 2 2 2 1 3 2 1 2 2 2 2 2 1 1 1                                      w w w w w w h O h y x f y f x f h y x f y y y x f y f h w x f h w y x f h w w y y y i i i i i i i i i i i i i      

(30)

2

ND

ORDER RUNGE-KUTTA METHODS

30

2

1

and

,

2

1

,

1

:

that

such

,

,

,

Choose

)

,

(

)

,

(

2 2 2 1 2 1 2 2 1 1 1 1 2 1

w

w

w

w

w

w

K

w

K

w

y

y

K

y

h

x

f

h

K

y

x

f

h

K

i i i i i i

(31)

ALTERNATIVE FORM

2 2 1 1 1 1 2 1

)

,

(

)

,

(

Kutta

e

Order Rung

Second

K

w

K

w

y

y

K

y

h

x

f

h

K

y

x

f

h

K

i i i i i i

31

1 1 2 2

1 1 2 1

)

,

(

)

,

(

Form

e

Alternativ

k

w

k

w

h

y

y

k

h

y

h

x

f

k

y

x

f

k

i i i i i i

(32)

CHOOSING

,

, W

1

AND W

2 32

Corrector

Single

a

with

'

is

This

)

,

(

)

,

(

2

2

1

)

,

(

)

,

(

:

becomes

method

Kutta

-e

Order Rung

Second

2

1

,

1

then

,

1

choosing

example,

For

0 1 1 2 1 1 1 2 1 2 1

s Method

Heun

y

x

f

y

x

f

h

y

K

K

y

y

K

y

h

x

f

h

K

y

x

f

h

K

w

w

i i i i i i i i i i i   

(33)

CHOOSING

,

, W

1

AND W

2 33

M ethod

M idpoint

the

is

This

)

2

,

2

(

)

2

,

2

(

)

,

(

:

becomes

method

Kutta

-e

Order Rung

Second

1

,

0

,

2

1

then

2

1

Choosing

1 2 1 1 2 1 2 1

K

y

h

x

f

h

y

K

y

y

K

y

h

x

f

h

K

y

x

f

h

K

w

w

i i i i i i i i i

(34)

2

ND

ORDER RUNGE-KUTTA METHODS

ALTERNATIVE FORMULAS

34 2 1 1 1 i 2 1

2

1

2

1

1

)

,

(

)

,

(

)

0

(select

mulas

Kutta For

e

Order Rung

Second

K

K

y

y

K

y

h

x

f

h

K

y

x

f

h

K

i i i i i

 

2

1

1

,

2

1

,

:

number

nonzero

any

Pick

1

,

2

1

,

2

1

1 2 2 1 2 2

w

w

w

w

w

w

(35)

SECOND ORDER RUNGE-KUTTA

METHOD

EXAMPLE CISE301_Topic8 L4&5 35

8269 . 3 2 / ) 1662 . 0 18 . 0 ( 4 2 / ) 1 ( ) 01 . 0 1 ( 1662 . 0 ) ) 01 . ( ) 18 . 0 ( 1 ( 01 . 0 ) , ( 18 . 0 ) 1 ( 01 . 0 ) 4 , 1 ( : 1 STEP 1 , 01 . 0 , 4 ) 1 ( , 1 ) ( RK2 using (1.02) find to system following the Solve 2 1 3 0 2 0 1 0 0 2 3 0 2 0 0 0 1 3 2                                   K K x x t x K x h t f h K t x x t f h K h x t x t x x

(36)

SECOND ORDER RUNGE-KUTTA

METHOD

EXAMPLE 36

6662 . 3 ) 1546 . 0 1668 . 0 ( 2 1 8269 . 3 2 1 ) 01 . 1 ( ) 01 . 0 01 . 1 ( 1546 . 0 ) ) 01 . ( ) 1668 . 0 ( 1 ( 01 . 0 ) , ( 1668 . 0 ) 1 ( 01 . 0 ) 8269 . 3 , 01 . 1 ( 2 STEP 2 1 3 1 2 1 1 1 1 2 3 1 2 1 1 1 1                            K K x x t x K x h t f h K t x x t f h K

(37)

1

RK2,

Using

[1,2]

for t

Solution

,

4

)

1

(

,

)

(

1

)

(

2

3

x

t

t

x

t

x

37

(38)

2

ND

ORDER RUNGE-KUTTA

)

(

is

error

global

and

)

(

is

error

Local

2

)

,

(

)

,

(

corrector

single

a

with

method

s

Heun'

to

Equivalent

RK2

as

Know

1,

of

value

Typical

2 3 2 1 1 1 2 1

h

O

h

O

k

k

h

y

y

h

k

y

h

x

f

k

y

x

f

k

i i i i i i

38 RK2

(39)

HIGHER-ORDER RUNGE-KUTTA

39

Higher order Runge-Kutta methods are available. Derived similar to second-order Runge-Kutta.

Higher order methods are more accurate but require more calculations.

(40)

3

RD

ORDER RUNGE-KUTTA

40 RK3

)

(

is

error

Global

and

)

(

is

error

Local

4

6

)

2

,

(

)

2

1

,

2

(

)

,

(

RK3

as

Know

3 4 3 2 1 1 2 1 3 1 2 1

h

O

h

O

k

k

k

h

y

y

h

k

h

k

y

h

x

f

k

h

k

y

h

x

f

k

y

x

f

k

i i i i i i i i

(41)

4

TH

ORDER RUNGE-KUTTA

41 RK4

)

(

is

error

global

and

)

(

is

error

Local

2

2

6

)

,

(

)

2

1

,

2

(

)

2

1

,

2

(

)

,

(

4 5 4 3 2 1 1 3 i 4 2 i 3 1 2 1

h

O

h

O

k

k

k

k

h

y

y

h

k

y

h

x

f

k

h

k

y

h

x

f

k

h

k

y

h

x

f

k

y

x

f

k

i i i i i i i i

(42)

HIGHER-ORDER RUNGE-KUTTA

1 3 4 5 6

1 5 4 3 2 1 6 4 1 5 3 2 4 2 1 3 1 2 1 7 32 12 32 7 90 ) 7 8 7 12 7 12 7 2 7 3 , ( ) 16 9 16 3 , 4 3 ( ) 2 1 , 2 1 ( ) 8 1 8 1 , 4 1 ( ) 4 1 , 4 1 ( ) , ( k k k k k h y y h k h k h k h k h k y h x f k h k h k y h x f k h k h k y h x f k h k h k y h x f k h k y h x f k y x f k i i i i i i i i i i i i i i                               42

(43)

EXAMPLE

4

TH

-ORDER RUNGE-KUTTA METHOD

43

)

4

.

0

(

)

2

.

0

(

4

2

.

0

5

.

0

)

0

(

1

2

y

and

y

compute

to

RK

Use

h

y

x

y

dx

dy

RK4

(44)

EXAMPLE: RK4

) 4 . 0 ( ), 2 . 0 ( 4 5 . 0 ) 0 ( , 1 : Problem 2 y y find to RK Use y x y dx dy     44

(45)

4

TH

ORDER RUNGE-KUTTA

45 RK4

)

(

is

error

global

and

)

(

is

error

Local

2

2

6

)

,

(

)

2

1

,

2

(

)

2

1

,

2

(

)

,

(

4 5 4 3 2 1 1 3 i 4 2 i 3 1 2 1

h

O

h

O

k

k

k

k

h

y

y

h

k

y

h

x

f

k

h

k

y

h

x

f

k

h

k

y

h

x

f

k

y

x

f

k

i i i i i i i i

(46)

EXAMPLE: RK4

             2 2  0.8293 6 7908 . 1 2 . 0 16545 . 0 1 ) , ( 654 . 1 1 . 0 164 . 0 1 ) 2 1 , 2 1 ( 64 . 1 1 . 0 15 . 0 1 ) 2 1 , 2 1 ( 5 . 1 ) 1 ( ) , ( 4 3 2 1 0 1 2 0 0 3 0 0 4 2 0 0 2 0 0 3 2 0 0 1 0 0 2 2 0 0 0 0 1                                       k k k k h y y x y h k y h x f k x y h k y h x f k x y h k y h x f k x y y x f k ) 4 . 0 ( ), 2 . 0 ( 4 5 . 0 ) 0 ( , 1 : Problem 2 y y find to RK Use y x y dx dy 5 . 0 , 0 1 ) , ( 0.2 0 0 2       y x x y y x f h 46 See RK4 Formula S tep 1

(47)

EXAMPLE: RK4

2 2

1.2141 6 2 . 0 0555 . 2 ) , ( 9311 . 1 ) 2 1 , 2 1 ( 9182 . 1 ) 2 1 , 2 1 ( 1.7893 ) , ( 4 3 2 1 1 2 3 1 1 4 2 1 1 3 1 1 1 2 1 1 1                     k k k k y y h k y h x f k h k y h x f k h k y h x f k y x f k ) 4 . 0 ( ), 2 . 0 ( 4 5 . 0 ) 0 ( , 1 : Problem 2 y y find to RK Use y x y dx dy 8293 . 0 , 2 . 0 1 ) , ( 0.2 1 1 2       y x x y y x f h 47 S tep 2

(48)

EXAMPLE: RK4

) 4 . 0 ( ), 2 . 0 ( 4 5 . 0 ) 0 ( , 1 : Problem 2 y y find to RK Use y x y dx dy xi yi 0.0 0.5 0.2 0.8293 0.4 1.2141 48

(49)

SUMMARY

• Runge Kutta methods generate an accurate

solution without the need to calculate high order derivatives.

• Second order RK have local truncation error of

order O(h3) and global truncation error of order

O(h2).

• Higher order RK have better local and global

truncation errors.

• N function evaluations are needed in the Nth order

RK method.

Referensi

Dokumen terkait

Meskipun sudah berusaha melawan kecanggungannya, Charlie tetap gagal karena dalam dirinya sendiri Charlie tidak memiliki keyakinan yang kuat dan keteguhan hati

Penjumlahan & Pengurangan Matriks Perkalian Matriks TRANSFORMA SI Translasi (Pergeseran) T=(a,b) Pengertian Refleksi (Pencermina n) Terhadap sumbu x atau sumbu y Terhadap

Beberapa pembelajaran yang bisa diambil dari penelitian Asuransi Indeks Iklim menurut Boer (2014) adalah: 1) mitra lokal dan penyuluh pertanian harus terlibat dalam desain

Tekan (T) untuk menambah maklumat pusat bagi sekolah yang didaftarkan dan pengguna akan memperolehi skrin seperti pada Gambar rajah 10 di atas.. Pengguna boleh melihat

Pengaturan tersebut menggunakan konverter arus searah pensaklaran yang terhubung dengan kumparan medan dan kumparan jangkar yang dalam aplikasinya menggunakan MOSFET

Hasil penelitian ini mendukung penelitian sebelumnya yang dilakukan oleh Didik Isnadi (2005) dengan judul Analisis Pengaruh Customer Relationship Management Terhadap

Starbucks Coffee merupakan sebuah perusahaan retail kopi yang menjual produk minuman espresso ala Italia, dimana mereka melakukan pembelian dan pemrosesan pada biji kopi secara

5 Saya suka bertanya tentang konsep biologi yang belum jelas 6 Saya senang jika guru memberi reward/hadiah pada saya 7 Saya sedih jika guru member pusihment/hukuman pada saya 8