Skip to main content
Mathematics LibreTexts

32.1: Epidemic Dynamics - Discrete Case

  • Page ID
    69576
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    %matplotlib inline
    import matplotlib.pylab as plt
    import numpy as np
    import sympy as sym
    sym.init_printing()

    The dynamics of infection and the spread of an epidemic can be modeled as a linear dynamical system.

    We count the fraction of the population in the following four groups:

    • Susceptible: the individuals can be infected next day
    • Infected: the infected individuals
    • Recovered (and immune): recovered individuals from the disease and will not be infected again
    • Deceased: the individuals died from the disease

    We denote the fractions of these four groups in \(x(t)\). For example \(x(t)=(0.8,0.1,0.05,0.05)\) means that at day \(t\), 80% of the population are susceptible, 10% are infected, 5% are recovered and immuned, and 5% died.

    We choose a simple model here. After each day,

    • 5% of the susceptible individuals will get infected
    • 3% of infected inviduals will die
    • 10% of infected inviduals will recover and immuned to the disease
    • 4% of infected inviduals will recover but not immuned to the disease
    • 83% of the infected inviduals will remain
    A = np.matrix([[0.95, 0.04, 0, 0],[0.05, 0.83, 0, 0],[0, 0.1, 1, 0],[0,0.03,0,1]])
    sym.Matrix(A)
    Do This

    If we start with \(x(0)=(1,0,0,0)\) for day 0. Use the for loop to find the distribution of the four groups after 50 days.

    x0 = np.matrix([[1],[0],[0],[0]])
    x  = x0
    for i in range(50):
        x = A*x
    print(x)
    [[0.15041595]
     [0.05576501]
     [0.61063003]
     [0.18318901]]
    
    Do This

    Write a program to apply the above transformation matrix for 200 iterations and plot the results.

    #Put your answer to the above question here

    This page titled 32.1: Epidemic Dynamics - Discrete Case is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Dirk Colbry via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?