Logistic Models:  A Simulation of the Spread of a Virus

This Mathematica notebook provides a simulation of the spread of a virus within a group of N people.  The spread of the virus is tracked for maxdays or until the entire population becomes infected.  The simulation provides a demonstration of a logistic model.

First Day:  One randomly chosen person is infected.
Second Day: The infected individual chooses at random a number between 1 and N.  If the chosen number is different from the number assigned to the infected individual, then there are two infected persons.  Otherwise, on the second day, only one person is infected.
Third Day: Each previously infected person chooses at random a number between 1 and N.  The pool of infected persons may grow or by chance remain the same.
Other Days: Repeat the previous procedure.  The process terminates when all N people are infected.

Since a random number generator is being used, it is possible that one or more people may remain uninfected for a long period of time.  So that we do not encounter an "infinite" loop, there is a maximum number of days, maxdays, during which we track the sprad of the disease.

n = number in population
maxdays = maximum number of days to track the spread of the disease.

The spread of the disease within the population is displayed graphically.  The graph plots the days vs the number infected.



From the matrix above, we can see the day at which each student becomes infected.

Download the Mathematica notebook from here.

Mathematica notebook by
Lila F. Roberts
Georgia Southern University
Statesboro, GA  30460

Converted by Mathematica      October 6, 2001