This webMathematica page illustrates the logistic model which, among other things, is used to model the spread of a disease. Given a population of M individials, we assume that one individual becomes infected with a disease on Day 1. In each successive day, every infected person comes into contact with exactly one random person, who may or may not be already infected. A healthy person is infected if contacted by an infected person. This script simulates the process with a random number generator
Run the simulation several times and make observations. How would you describe a function resembles the total infected individuals as a function of time? Can you find an analytic function that resembles that function? How is the derivative of the function related to the total number of individuals infected?
contacts := Map[{Random[Integer, {1, M}], #} &, Range[M]];
newsicks := (addtosick = {};
Map[If[MemberQ[well, First[#]] && MemberQ[sick, Last[#]],
addtosick = Union[addtosick, {First[#]}]] &, #];
{well, sick} = {Complement[well, addtosick], Union[sick, addtosick]};
Length[sick]) &;
M = Input["Enter the population - no more than 1000 is suggested"];
{well, sick} = {Range[M - 1], {M}};
spreaddata =
Table[newsicks[contacts], {M}] //. {{a___, M, M} -> {a, M}} //
Prepend[#, 1] &;
ListPlot[spreaddata, PlotRange -> {0, M}, PlotJoined -> True,
Ticks -> {{0, Length[spreaddata]}, {0, M}}, PlotStyle -> RGBColor[0, 1, 0],
Epilog -> {PointSize[0.02], RGBColor[1, 0, 0],
Map[Point[{#, spreaddata[[#]]}] &, Range[Length[spreaddata]]]}]