blue271828's misc :-)

マルサスモデル

呼称

概要

マルサスモデルとは、ある生物の個体群サイズの指数関数的な増加あるいは現象を記述する数理モデル。

モデル

マルサスモデルでは、ある生物の個体数 $P$ の増加速度が個体数自体に比例するとして、次のように個体数増加速度 $dP/dt$ を表す。

\[ \frac{dP}{dt} = mP \]

ある時点における個体数

\[ P = P_0 e^{mt} \]

導出:

\[ \begin{aligned} \frac{dP}{dt} &= mP \cr \frac{dP}{P} &= mdt \end{aligned} \]

\[ \begin{aligned} \int{\frac{dP}{P}} &= \int{mdt} \cr \int{\frac{1}{P}dP} &= m\int{dt} \end{aligned} \]

\[ \ln{P} = mt + C \]

\[ \begin{aligned} P &= e^{mt+C} \cr &= e^C e^{mt} \end{aligned} \]

$t=0$ から $e^C$ を求める。

\[ \begin{aligned} P_0 &= e^C c^0 \cr e^C &= P_0 \end{aligned} \]

$e^C$ が $P$ の初期値 $P_0$ であるため、

\[ \begin{aligned} P &= e^C e^{mt} \\\ &= P_0 e^{mt} \end{aligned} \]

サンプルコード

モデル (Python 3)

import numpy as np


class MalthusianModel:
    """
    マルサスモデル
    """


    @staticmethod
    def population(init: np.float, rate: np.float, time: np.float) -> np.float:
        """
        Parameters
        ----------
        init : np.float
            初期個体数
        rate : np.float
            マルサス係数
        time : np.float
            時間
            
        Returns
        -------
        population : np.float
            個体数
        """
        
        return init * np.exp(rate*time)

グラフ (Python 3)

img

import matplotlib.pyplot as plt


X = np.linspace(0, 10, 100)

plt.figure()
plt.title("Malthusian model")

plt.xlim(0, 8)
plt.ylim(0, 1000)

plt.xlabel("Time")
plt.ylabel("Population")

plt.plot(X, MalthusianModel.population(1., 1., X), label="init=1, rate=1.")
plt.plot(X, MalthusianModel.population(1., 2., X), label="init=1, rate=2.")
plt.plot(X, MalthusianModel.population(1., 4., X), label="init=1, rate=4.")

plt.legend()
plt.show()

参考文献

Tags

#Ansible (3) #Bash (1) #Docker (1) #Git (2) #Hugo (2) #Molecule (1) #Python (1) #WSLtty (1) #アルゴリズム (4) #ビジネス用語 (1) #プログラミング (1) #位相空間論 (8) #初等数学 (20) #初等関数 (1) #実解析 (1) #幾何学 (3) #微分積分学 (18) #情報理論 (4) #抽象代数学 (14) #数理モデル (2) #数理論理学 (21) #機械学習 (3) #正規表現 (1) #測度論 (3) #特殊関数 (4) #確率論 (18) #組合せ論 (5) #統計学 (12) #線型代数学 (18) #複素解析学 (4) #解析学 (15) #論理学 (6) #順序集合論 (9)