N = 1000 # Initial number of infected and recovered individuals, I0 and R0. Import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # Total population, N. The plotted curves of $S(t)$, $I(t)$ and $R(t)$ are styled to look a bit nicer than Matplotlib's defaults. The model is started with a single infected individual on day 0: $I(0)=1$. \frac$ in a population of $N=1000$ (perhaps 'flu in a school). The differential equations describing this model were first derived by Kermack and McKendrick : $\gamma$ is the mean recovery rate: that is, $1/\gamma$ is the mean period of time during which an infected individual can pass it on. $\beta$ describes the effective contact rate of the disease: an infected individual comes into contact with $\beta N$ other individuals per unit time (of which the fraction that are susceptible to contracting the disease is $S/N$). The SIR model describes the change in the population of each of these compartments in terms of two parameters, $\beta$ and $\gamma$.