SIR infection peak (source code)

= SIR infection peak
{c}
{title2=$s_*=\gamma/\beta,\quad i_{\mathrm{peak}}=i_0+s_0-s_*+s_*\ln(s_*/s_0)$}

If $i_0>0$ and $s_0>\gamma/\beta$, the <infectious compartment> initially grows. The <SIR model equations> give its unique later maximum when
$$
s_*=\frac{\gamma}{\beta}=\frac{1}{R_0}.
$$
Before this <SIR infection peak>, $\beta s-\gamma>0$; afterward it is negative because the <susceptible compartment> keeps shrinking. Substituting $s_*$ into the <SIR first integral> gives
$$
i_{\mathrm{peak}}
=i_0+s_0-s_*+s_*\ln\frac{s_*}{s_0}.
$$
For the stipulated <initial value problem>,
$$
s_*=\frac13,\qquad
i_{\mathrm{peak}}=1-\frac13+\frac13\ln\frac{1/3}{0.99}
\approx0.3038126824.
$$
Thus about $30.38\%$ of the modelled population belongs to the <infectious compartment> simultaneously at the <SIR infection peak>. This is a peak of the <infectious compartment>, not of <incidence>, whose flow is $\beta si$. If $s_0\leq\gamma/\beta$, the maximum is already $i_0$ at the start and the interior <SIR infection peak> formula does not apply.

\Image[/sir-outbreak-trajectories.png]
{title=Time evolution and <phase portrait> of the stipulated <SIR model>}
{description=The <SIR model equations> produce a <SIR infection peak> near day $26.63$. The <phase portrait> follows decreasing $s$ from right to left and changes from growth to decline of the <infectious compartment> at $s=1/3$. The <susceptible compartment> remains nonempty as $i$ approaches zero. The curves use a fourth-order <Runge-Kutta method> with a fixed step of $0.1$ day; all parameter values are illustrative.}

The numerical <solution of a differential equation> puts the <SIR infection peak> at about day $26.63258$ with $i\approx0.303812682386$, agreeing with the <SIR first integral> to within $10^{-11}$. The accompanying generator checks nonnegative <fractions> and <conservation of population> without clipping or rescaling. For steps $0.4$, $0.2$ and $0.1$ day, the largest differences between successive numerical trajectories at shared times are approximately $1.086\times10^{-7}$ and $6.985\times10^{-9}$. Their ratio is $15.55$, close to the factor $16$ expected when a fourth-order <Runge-Kutta method>'s step is halved.