Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

離散指数増殖・ロジスティック成長モデル

世代が区切られた生物の個体数変動を差分方程式 (difference equation)で記述する.

離散指数増殖モデル (discrete exponential growth model)離散ロジスティック成長モデル (discrete logistic growth model)を実装し,平衡点 (equilibrium point)局所安定性 (local stability)を調べる.

離散指数増殖モデル

世代 tt における個体数を XtX_t,1世代あたりの増殖率を λ\lambdaマルサス係数 (Malthusian coefficient) a=λ1a = \lambda - 1 とすると,

Xt+1=Xt+aXtX_{t+1} = X_t + a X_t

a>0a > 0 なら個体数は増加,a=0a = 0 なら一定,a<0a < 0 なら減少する.

実装

axt をそれぞれ増殖率,個体数,世代とし,初期値から100世代分の時間発展を計算する.

# 離散指数増殖モデル(1)
import matplotlib.pyplot as plt
a = 0.1
x = 1
t = 0

t_list = [t]
x_list = [x]
for i in range(100):
    t = t + 1
    x = x + a * x

    t_list.append(t)
    x_list.append(x)
plt.plot(t_list, x_list)
<Figure size 640x480 with 1 Axes>

プロットの整え方

plt.plot に書式指定文字列(色+マーカー・線種)を渡すことで表示を変えられる.

# フォーマットの変更1
plt.plot(t_list, x_list, "ro")
<Figure size 640x480 with 1 Axes>
# フォーマットの変更2
plt.plot(t_list, x_list, "k--")
<Figure size 640x480 with 1 Axes>

複数のパラメータで結果を重ねてプロットするには,plt.plot に複数の (x, y) の組を渡す.

# 複数のデータのプロット2
x_lists = []

for a in [0.1, 0.11, 0.12]:
    x = 1
    t = 0
    t_list = [t]
    x_list = [x]

    for i in range(100):
        t = t + 1
        x = x + a * x

        t_list.append(t)
        x_list.append(x)

    x_lists.append(x_list)
plt.plot(t_list, x_lists[0], t_list, x_lists[1], t_list, x_lists[2])
<Figure size 640x480 with 1 Axes>

タイトルと軸ラベルを付けて図の意味を明示する.

# タイトル・軸ラベル1
plt.plot(t_list, x_list)
plt.title("Exponential growth")
plt.xlabel("Time (t)")
plt.ylabel("Pop. size (x)")
<Figure size 640x480 with 1 Axes>
# タイトル・軸ラベル2
plt.plot(t_list, x_list)
plt.title("Exponential growth", fontsize="xx-large")
plt.xlabel("Time (t)", fontsize="x-large")
plt.ylabel("Pop. size (x)", fontsize="x-large")
<Figure size 640x480 with 1 Axes>

解像度・図サイズの調整

plt.figure(dpi=...) で解像度を,figsize=[幅, 高さ] で図のサイズ(インチ単位)を指定できる.

# 解像度の変更
plt.figure(dpi=200)
plt.plot(t_list, x_list)
<Figure size 1280x960 with 1 Axes>
# プロットサイズの変更
plt.figure(figsize=[5, 7])
plt.plot(t_list, x_list)
<Figure size 500x700 with 1 Axes>

線とマーカーを重ねた表示の例を示す.

# 離散指数増殖モデル(2)
a = 0.1
x = 1
t = 0

t_list = [t]
x_list = [x]
for i in range(100):
    t = t + 1
    x = x + a * x

    t_list.append(t)
    x_list.append(x)
plt.figure(dpi=200)
plt.plot(t_list, x_list, "-", t_list, x_list, "r.")
plt.title("Exponential growth", fontsize="xx-large")
plt.xlabel("Time (t)", fontsize="x-large")
plt.ylabel("Pop. size (x)", fontsize="x-large")
<Figure size 1280x960 with 1 Axes>

離散ロジスティック成長モデル

離散ロジスティック成長モデル (discrete logistic growth model)密度依存性 (density dependence)(個体数増加に伴い増殖率が低下する効果)を取り入れたモデルで,以下で定義される:

Nt+1=Nt+rNt(1NtK)N_{t+1} = N_t + r N_t \left(1 - \frac{N_t}{K}\right)

ここで,

Solution to Exercise 1
r = 0.5
K = 100
N = 1
t = 0

t_list = [t]
N_list = [N]
for i in range(50):
    t = t + 1
    N = N + r * N * (1 - N / K)
    t_list.append(t)
    N_list.append(N)

plt.figure(dpi=200)
plt.plot(t_list, N_list, "-", t_list, N_list, "r.")
plt.title("Logistic growth", fontsize="xx-large")
plt.xlabel("Time (t)", fontsize="x-large")
plt.ylabel("Pop. size (N)", fontsize="x-large")
<Figure size 1280x960 with 1 Axes>

平衡点と局所安定性

平衡点 (equilibrium point) Nˉ\bar N とは Nt+1=NtN_{t+1} = N_t を満たす個体数で,f(N)=N+rN(1N/K)f(N) = N + r N(1 - N/K) とおくと Nˉ=f(Nˉ)\bar N = f(\bar N) の解として求まる.

離散ロジスティック成長モデルの平衡点は:

局所安定性 (local stability)f(Nˉ)f'(\bar N) の絶対値で判定する.

f(N)=1+r2rN/Kf'(N) = 1 + r - 2rN/K より,Nˉ=K\bar N = K では f(K)=1rf'(K) = 1 - r0<r<20 < r < 2 のとき 1r<1|1 - r| < 1 なので Nˉ=K\bar N = K は局所安定となる.

パラメータと動態の多様性

rr の値に応じて離散ロジスティックモデルは単安定・周期振動・カオスなど多様な動態を示す.

演習

Solution to Exercise 2
plt.figure(dpi=150)
for a in [-0.1, 0.0, 0.05, 0.1, 0.2]:
    x = 1
    t = 0
    t_list = [t]
    x_list = [x]
    for i in range(50):
        t = t + 1
        x = x + a * x
        t_list.append(t)
        x_list.append(x)
    plt.plot(t_list, x_list, label=f"a = {a}")

plt.title("Discrete exponential growth")
plt.xlabel("Time (t)")
plt.ylabel("Pop. size (x)")
plt.legend()
<Figure size 960x720 with 1 Axes>
Solution to Exercise 3
def discrete_logistic(r, K, N0, n_steps):
    N = N0
    t_list = [0]
    N_list = [N]
    for i in range(n_steps):
        N = N + r * N * (1 - N / K)
        t_list.append(i + 1)
        N_list.append(N)
    return t_list, N_list


for r in [0.5, 1.5, 2.0, 2.5, 2.9]:
    t_list, N_list = discrete_logistic(r, K=100, N0=1, n_steps=200)
    plt.figure(dpi=120)
    plt.plot(t_list, N_list, "-")
    plt.title(f"Discrete logistic, r = {r}")
    plt.xlabel("Time (t)")
    plt.ylabel("Pop. size (N)")
    plt.show()
<Figure size 768x576 with 1 Axes>
<Figure size 768x576 with 1 Axes>
<Figure size 768x576 with 1 Axes>
<Figure size 768x576 with 1 Axes>
<Figure size 768x576 with 1 Axes>

rr が小さいうちは KK への収束だが,rr が大きくなるにつれて振動が現れ,さらに不規則な動態(カオス)が現れる.