32.2: Epidemic Dynamics - Continuous Model

Matrix Algebra with Computational Applications · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    32.2: Epidemic Dynamics - Continuous Model
    %matplotlib inline
    import matplotlib.pylab as plt
    import numpy as np
    import sympy as sym
    sym.init_printing()

    Instead of using the discrete markov model, we can also use a continuous model with ordinary differential equations.

    For example, we have that

    \[\dot{x}_1 = {dx_1(t)\over dt} = -0.05x_1(t)+ 0.04 x_2(t) \nonumber \]

    It means that the changes in the susceptible group depends on susceptible and infected individuals. It increase because of the recovered people from infected ones and it decreases because of the infection.

    Similarly, we have the equations for all three groups.

    \[\dot{x}_2 = {dx_2(t)\over dt} = 0.05x_1(t)-0.17 x_2(t) \\
    \dot{x}_3 = {dx_3(t)\over dt}= 0.1 x_2(t) \\
    \dot{x}_4 = {dx_4(t)\over dt} = 0.03 x_2(t) \nonumber \]

    Do This

    We can write it as system of ODEs as \(\dot{x}(t) = Bx(t)\). Write down the matrix \(B\) in numpy.matrix

    # Put your answer to the above question here.
    Do This

    Plot all the distribution for 200 days. Then compare it with the discrete version.

    x0 = np.matrix([[1],[0],[0],[0]])
    n = 200
    x_all = np.matrix(np.zeros((4,n)))
    
    ### Your code starts here ###
    
    ### Your code ends here ###
    for i in range(4):
        plt.plot(x_all[i].T)
    Illustration
    D2, C2 = np.linalg.eig(B)
    np.allclose(C2*np.diag(D2)*C2**(-1), B)
    C = C2

    This page titled 32.2: Epidemic Dynamics - Continuous Model was last modified on Sat, 17 Sep 2022 15:14:35 GMT and 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.