Assignment given 14 April 2009


This assignment was given on 14 April 2009. The work is due 21 April 2009.


Write a program which can model the evolution of a disease in a hospital in which patients are arranged on an array of beds.

Assume that the beds form an array of M rows and N columns, so that there are a total of M * N patients.

Assume that the patients can be classified as Susceptible, Infected or Recovering, with the properties that

Set up an M by N array P to represent the patients. P(I,J) contains information on the patient in row I, column J. P(I,J) will be

The rules for transmission of the disease essentially update the patient array once a day. If patient P(I,J) was:

Let's suppose we start with exactly one infected patient, P(M/2,N/2) whose value is 1. All other patients start at 0.

Using the rules for transmission of the disease, update the patient array one day at a time. (You'll probably need an "old" and a "new" copy of the array, so you keep all the old information until all the updated information has been computed.)

On each day, compute the values of S, I, and R, that is, the total number of susceptible, infected, and recovering patients. Store these values in vectors, so that we can plot them.

The actual number of days to simulate will depend on the problem size and other issues. For now, let's just try using 50 days. You should count the initial condition (all patients are "S" except for 1 "I" and no "R"'s) as day #1.)

Question 1: Using M = 10, N = 10, K = 4 and TAU = 0.2, run your program for 50 days.

Turn in: Make one plot on which you display the values of S, I, and R over this time period.


Last revised on 13 April 2009.