Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth...

16
Bab 6 MA2151 Simulasi dan Komputasi Matematika

Transcript of Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth...

Page 1: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Bab 6MA2151 Simulasi dan Komputasi Matematika

Page 2: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Metoda Euler

growth_rate = 0.10

population(0) = 100

growth(t) = growth_rate * population(t - Δt)

population(t) = population(t - Δt) + growth(t) * Δt

growth is the derivative of the function at the previous time step, t – Δt

𝑃 𝑡 + ∆𝑡 ≈ 𝑃 𝑡 + 𝑃′(𝑡)∆𝑡

Page 3: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Algoritma Metoda Euler

Page 4: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Example

Page 5: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Algoritma Metoda Euler (2)

Page 6: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Graphs of analytical solution and Euler’s Method solution with Δt = 1

Page 7: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Dari 3 teknik simulasi yang dipelajari, Metoda Euler memiliki waktueksekusi paling cepat, namun paling tidak akurat.

Error dalam metoda Euler dapat direduksi dengan menggunakan Δtyang lebih kecil, namun akan memperlambat simulasi.

Page 8: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Metoda Runge-Kutta 2

f(tn, Pn) menotasikan dP/dt pada langkah ke-n.

Metoda Euler menggunakan f(tn-1, Pn-1), yang sama dengan gradiengaris singgung di (tn-1, Pn-1) untuk memperoleh estimasi berikut:

Akan digunakan gradien garis yang menghubungkan (tn-1, Pn-1) ke (tn, Pn), bukan gradien garis singgung di (tn-1, Pn-1).

Page 9: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Euler vs Runge-Kutta 2

Page 10: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Algoritma Runge-Kutta 2

Page 11: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Estimasi (8, P(8))

Page 12: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

First Estimate

Page 13: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Second Estimate

Page 14: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Third Estimate

Page 15: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Fourth Estimate

Page 16: Bab 6 - · PDF fileEstimasi (8, P(8)) First Estimate. Second Estimate. Third Estimate. Fourth Estimate. Algoritma Runge-Kutta 4. ... 6 7 4 . The Runge-Kutta 4 estimate of Pn is as

Algoritma Runge-Kutta 4