Lab 6 Math 119A
SIR model for an infectious disease
is the number (in millions) of suceptible people, is the number (in millions) of infectious people, and is the number (in millions) of recovered and immune people. If we ignore births and deaths, the equations that describe the changes in these populations are: We will assume that our total population is million people. We start with 100 infected people, , million people and . (No one has recovered yet.)
Note that if we do not choose to track the number of recovered people, that the change equations for and are defined only in terms of each other.
Part 1: Trajectories
Throughout this lab, examples will be given from the Romeo and Juliet model. We start by plotting a vector field:
Exercise 1. For the SIR model, with and , plot a vector field in the -plane with values going from to and values going from to .
Exercise 2. Using the CoCalc functions point()
and text()
which were introduced in Lab 5, add the following labeled points to your vector field:
A point near the beginning of the disease where the number of susceptible people is high and the number of infectious people is low. Label this point "Outbreak Start".
Follow the arrows of the vector field and estimate the highest point of the trajectory starting from your first point. Add this high point to the vector field and label it "Max I". This represents the maximum number of people infected by the disease at a single time.
Following the trajectory you are imagining down to the -axis and add a point near where you think it would intersect the -axis. Label this point "Outbreak Ends". This point represents the end of the disease, when there are no more infected people.
From the above exercise you should have gotten an idea of how the number of susceptible and number of infected people change over the course of the disease (i.e. you have an idea of what the trajectory looks like). In the next few exercises we will plot a trajectory to see if it matches your intuition.
Exercise 3. Add the point , to your vector field and label it "Start". These correspond to 100 initial infected people and just under 330 million susceptible people.
We are now going to create a trajectory starting from the point in the previous exercise. To do this we will use our Euler2D function from Lab 3:
Euler2D
allows us to solve systems of differential equations (such as our Romeo and Juliet model or our SIR model). Here is an example of how we can plot a trajectory using the output of Euler2D:
Exercise 4. Run the code for Euler2D
above, then use it to plot a trajectory (for our SIR model) starting at the point from the previous exercise. Your time values should start at 0 days and go to 365 days in 1 day increments.
We can bring trajectories to life using animations. Here is an example with Romeo and Juliet:
Above we used the CoCalc function len()
to find the length of a list. For example len([4,7,3,-1])
will return 4 since the list has 4 elements in it.
Exercise 5. Make an animation showing the development of our trajectory for the pandemic over time.
(Hint: In line 13 of the previous example, notice that the for loop is going by increments of 200. We do this so that the code doesn't take forever to run. For this exercise you should go by increments of about 10.) If your animation is too long, Cocalc may give you a message about discarding intermediate output. To deal with that reduce the number of frames by either increasing the increment, or reducing the length of time. (The ending time can be reduced below 365 days to 200 days or less)
We can tell stories to go along with trajectories. For example, here is a story that matches up with our Romeo and Juliet trajectory:
Exercise 6. In a comment, tell a story that matches up with our trajectory.
Note that unlike the Romeo and Juliet trajectory, the trajectory for the SIR model does not develop at the same rate everywhere (this can be seen from Exercise 5). When writing your story you should take this into account.