Top Banner
Logistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical Sciences Seoul National University Sep 23, 2013
25

Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Jan 17, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map, Euler & Runge-Kutta Method andLotka-Volterra Equations

S. Y. Ha and J. Park

Department of Mathematical SciencesSeoul National University

Sep 23, 2013

Page 2: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Contents

1 Logistic Map

2 Euler and Runge-Kutta MethodEuler MethodRunge-Kutta MethodEuler vs. Runge-KuttaR-K Method for System ODEs

3 Lotka-Volterra Equations

Page 3: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Logistic Map

Definition

Let f : [0, 1]→ [0, 1] such that f(x) = rx(1− x) where r ∈ [0, 4].Then f is called a logistic map.

3 / 25

Page 4: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Logistic Map f(x) = rx(1− x)

Intersections are fixed points.

4 / 25

Page 5: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Two iterations of logistic map f2(x)

Intersections are fixed points and period-2 points.

5 / 25

Page 6: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Three iterations of logistic map f3(x)

Intersections are fixed points and period-3 points.

6 / 25

Page 7: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Comparison of five iterations of logistic map f5(x) with repect to r

r=2.5

r=3.5

r=3

r=47 / 25

Page 8: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Bifurcation of positions of fixed points and period-2 points

The figure indicates positions of x satisfying x = f2(x) with respectto 0 ≤ r ≤ 4.

8 / 25

Page 9: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Doubling iterations

The figure indicates positions of x satisfying x = f8(x) with respectto 2.8 ≤ r ≤ 3.6.

9 / 25

Page 10: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Let x0 = 0.5 and xn = fn(x0). Plot positions of xn whilen ∈ [500, 1500].

The figure indicates positions that xn wander with respect to3.5 ≤ r ≤ 4.

10 / 25

Page 11: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Euler Method

Euler and Runge-Kutta Method

Let given ODE be x = f(x, t) and ∆t = h.

dx

dt≈ xn+1 − xn

h

Explicit Euler Method

xn+1 − xn

h= f(xn, tn)

⇒ xn+1 = xn + hf(xn, tn), tn+1 = tn + h

h must be small.

Implicit Euler Method

xn+1 − xn

h= f(xn+1, tn+1)

⇒ xn+1 = g(xn, tn), tn+1 = tn + h

It is difficult to find out g.

11 / 25

Page 12: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Runge-Kutta Method

4th Order Runge-Kutta Method

xn+1 − xn

h=

1

6(k1 + 2k2 + 2k3 + k4)

⇒ xn+1 = xn +1

6h(k1 + 2k2 + 2k3 + k4)

weighted average of k1, k2, k3, k4 where,

k1 = f(xn, tn)

k2 = f(xn +1

2hk1, tn +

1

2h)

k3 = f(xn +1

2hk2, tn +

1

2h)

k4 = f(xn + hk3, tn + h)

tn+1 = tn + h

12 / 25

Page 13: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Euler vs. Runge-Kutta

Solve x = x(1− x).Exact solution is

x(t) =x0e

t

1 + x0(et − 1)

Trajectory of x(t) with x0 = 0.05

13 / 25

Page 14: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Euler vs. Runge-Kutta

Let x0 = 0.05, h = 0.01.

Trajectories of x(t) with Euler and Runge-Kutta methods

Euler method Runge-Kutta method

14 / 25

Page 15: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Euler vs. Runge-Kutta

Difference from exact solution

Error of Euler method is less than 2.5× 10−3

Error of Runge-Kutta method is less than 2.5× 10−11

15 / 25

Page 16: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Euler vs. Runge-Kutta

Using 4th order Runge-Kutta method needs 4 times morecalculations than using Euler method.

Let h1 = 0.01 for Runge-Kutta method and h2 = 0.0025 for Eulermethod in order to adjust the number of calculations.

Error of Euler method is less than 6× 10−4

Error of Runge-Kutta method is less than 2.5× 10−11

16 / 25

Page 17: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

R-K Method for System ODEs

Runge-Kutta Method for System ODEs

A system ODE

x = f(x, y, t)

y = g(x, y, t)

Runge-Kutta method for the system

xn+1 = xn +1

6h(k1 + 2k2 + 2k3 + k4)

yn+1 = yn +1

6h(l1 + 2l2 + 2l3 + l4)

17 / 25

Page 18: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

R-K Method for System ODEs

where

k1 = f(xn, yn, tn),

l1 = g(xn, yn, tn),

k2 = f(xn +1

2hk1, yn +

1

2hl1, tn +

1

2h),

l2 = g(xn +1

2hk1, yn +

1

2hl1, tn +

1

2h),

k3 = f(xn +1

2hk2, yn +

1

2hl2, tn +

1

2h),

l3 = g(xn +1

2hk2, yn +

1

2hl2, tn +

1

2h),

k4 = f(xn + hk3, yn + hl3, tn + h),

l4 = g(xn + hk3, yn + hl3, tn + h),

tn+1 = tn + h.

18 / 25

Page 19: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

R-K Method for System ODEs

Higher order ODE can be transformed into a system ODE

x + ax + b = 0

Let x1 := x, x2 := x then

x1 = x2

x2 = −ax1 − b

19 / 25

Page 20: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Lotka-Volterra Equations

Lotka-Volterra equation

x = x(a− by)

y = y(−c + dx)

with positive a, b, c, d.

We use 4th order Runge-Kutta method for calculations.

20 / 25

Page 21: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Set a = 4, b = 2, c = 3, d = 1 and h = 0.01.

We plot 10000 iterations starting at square shaped points.We plot ’o’ shape at every 10 iterations.In this system, the phase follow the orbits counterclockwise.If the phase is far from the point (3, 2), the phase moves fast.

21 / 25

Page 22: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Lotka-Volterra equation with small perturbations.

x = x(a− ε1x− by)

y = y(−c + dx− ε2y)

Set a = 4, b = 2, c = 3, d = 1, ε1 = 0.0001, ε2 = 0.0001 .

In this system, the phase moves to (3, 2) slowly.

22 / 25

Page 23: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Lotka-Volterra equation with intraspecific competition.

x = x(a− ex− by)

y = y(−c + dx− fy)

Set a = 6, b = 3, c = 4, d = 1, e = 2, f = 1 .

23 / 25

Page 24: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Lotka-Volterra equation with intraspecific competition.

x = x(a− ex− by)

y = y(−c + dx− fy)

Set a = 18, b = 2, c = 1, d = 1, e = 3, f = 1 .

24 / 25

Page 25: Logistic Map, Euler & Runge-Kutta Method and …syha/appliedpde.pdfLogistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations S. Y. Ha and J. Park Department of Mathematical

Logistic Map Euler and Runge-Kutta Method Lotka-Volterra Equations

Thank You

25 / 25