{ "cells": [ { "cell_type": "markdown", "id": "a9815087-958b-493c-8a7c-7e4ed6a2a1e7", "metadata": {}, "source": [ "# Birth-death process" ] }, { "cell_type": "markdown", "id": "df48d4be-2dd6-457d-9576-be5ad25110f7", "metadata": {}, "source": [ "Recall our simple [birth–death processes](https://en.wikipedia.org/wiki/Birth%E2%80%93death_process) with a fixed constant birth rate $\\mu$ for particles and a fixed death rate $\\nu$ for all active particles. Going through our recipe for master equations, we ask:\n", "\n", "*What is the set of discrete states available to the system?* The system consists of a discrete number $n$ of active particles which can take any value from 0 to infinity.\n", "\n", "*What are the possible transitions between states?* The system will go from state $n$ to state $n+1$ when a new particle is created, and from state $n>0$ to state $n-1$ when a particle disappears.\n", "\n", "*At what rates do these transitions occur?* $J_{n\\rightarrow n+1} = \\mu$ and $J_{n>0\\rightarrow n-1} = n\\nu$. All other transitions are impossible (null current equal to zero).\n", "\n", "And we thus write accordingly:" ] }, { "cell_type": "markdown", "id": "765e0cb8", "metadata": {}, "source": [ "$$\n", "\\begin{align}\n", "\\frac{d}{dt}P_n(t) &= -\\mu P_n(t) + (n+1)\\nu P_{n+1}(t) \\quad \\textrm{for n=0}\\\\\n", "\\frac{d}{dt}P_n(t) &= -(\\mu + n\\nu)P_n(t) + (n+1)\\nu P_{n+1}(t) + \\mu P_{n-1}(t) \\quad \\textrm{for n>0}\\\\\n", "\\end{align}\n", "$$" ] }, { "cell_type": "markdown", "id": "fb99c875-b30c-4461-9c21-12f67e9cd6ca", "metadata": {}, "source": [ "This simple process could be a model various scenarios: evolution of bacteria or other species, an infectious disease through a contaminated environment, or really any collection of things that appears at some global rate but decays according to a local rate per \"thing\"." ] }, { "cell_type": "markdown", "id": "d8c061d2-fa08-4cd0-a626-8a44adde97ab", "metadata": {}, "source": [ "Some questions of interest are:\n", "1. What is the distribution underlying the number of particles at time $t$?\n", "2. How much time is spent in an inactive $n=0$ state?" ] }, { "cell_type": "markdown", "id": "acde9146-8e85-41bf-a188-01f6a25a2525", "metadata": {}, "source": [ "To answer these questions, we need master equations and can thankfully simply integrate the system derived above. " ] }, { "cell_type": "markdown", "id": "619c7786-ebcc-493b-b0a1-dba5a83673b7", "metadata": {}, "source": [ "## Distribution of particles through time" ] }, { "cell_type": "markdown", "id": "d95a7049-b4c1-4f71-996f-556f05a7162d", "metadata": {}, "source": [ "In practice, master equations are not different than other models based on dynamical systems of ordinary differential equations. Conceptually, they are reacher as they do not simply track an average state but a distribution of states. What this means is that we can simply integrate them as we would simpler models, but will need to be a bit more careful when processing and interpreting the resulting dynamics." ] }, { "cell_type": "code", "execution_count": 31, "id": "4ea9746f-fd99-485f-8b2c-f87dea4b046e", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/var/folders/qs/h2k9jxts0n34jj1zq8z7dvtw0000gn/T/ipykernel_49208/3782432136.py:3: MatplotlibDeprecationWarning: The seaborn styles shipped by Matplotlib are deprecated since 3.6, as they no longer correspond to the styles shipped by seaborn. However, they will remain available as 'seaborn-v0_8-