SIR equations solver

This webpage uses the Runge-Kutta-Fehlberg fourth-order method with fifth-order error checking (RKF45) to approximate the solution to the SIR equations with the δ\delta parameter to account for quarantine effects:

dSdt=−βI(1−δ)SNdIdt=βI(1−δ)SN−γIdRdt=γI.\begin{aligned} \dfrac{dS}{dt} &= -\dfrac{\beta I (1-\delta)S}{N} \\ \dfrac{dI}{dt} &= \dfrac{\beta I(1-\delta)S}{N} - \gamma I \\ \dfrac{dR}{dt} &= \gamma I. \end{aligned}

Where tt is time and is usually in units of days. SS is the number of susceptible persons, II is the number of infected persons and RR is the number of recovered persons. β\beta is a parameter that pertains to the average number of contacts per person per time and the rate of transmission for the disease. γ\gamma is the inverse of the average time a person is infected with the disease. Consequently, the basic reproduction number, which is typically represented as R0R_0 (not to be confused with the initial population of recovered individuals), is given by:

R0=β(1−δ)γ\begin{aligned} R_0 = \dfrac{\beta(1-\delta)}{\gamma} \end{aligned}

(Ridenhour et al., 2014). NN is the total population.

If you would like to examine a more realistic model, with birth and death rates, loss of immunity, and incubation periods, then check out the SEIRS model solver webpage.

Simulation parameter form.
Parameter Value Explanation
A parameter that pertains to how many contacts there are per person and how easily the disease spreads from an infected person to an uninfected person.
A parameter that is a measure of how quickly people recover from the disease.
A parameter with values from 0 to 1 pertaining to how effective quarantine measures are at slowing the disease outbreak. If δ=0\delta = 0, the measures are either non-existent or completely ineffective. If δ=1\delta = 1, all infected persons are immediately, as soon as they become infected, quarantined.
End time of simulation.
Initial number of susceptible individuals.
Initial number of infected individuals.
Initial number of recovered individuals.
Error tolerance for our numerical solution to the SIR equations.
Tolerance type, can be either absolute (0) or relative (1).
Initial step size.
Minimum allowed step size.
Time increment for skipping ahead in animation.
Time you want to skip ahead to in animation when you press the skip button.
Width (in px) of Plotly windows used for plotting and animation below.
Height (in px) of Plotly windows used for plotting and animation below.
Proportion of animation time passed per real time. tScale=1.0t_{\mathrm{Scale}}=1.0 means animation and real time match. tScale<1.0t_{\mathrm{Scale}}<1.0 means the animation is going more slowly than real time. tScale>1.0t_{\mathrm{Scale}}>1.0 means it is going more rapidly.
Opacity of the lines in the 3D phase space animation. Customizable in case you need to tweak it in order to see the red dot marker.

Reference list

Ridenhour, B; Kowalik, JM; & Shay, DK (2014). Unraveling R0R_0: Considerations for Public Health Applications. American Journal of Public Health, 104(2): e32–e41. doi: 10.2105/AJPH.2013.301704. PMID 24328646. PMC 3935673.