Interactive Educational Modules in
Scientific Computing

Epidemic Population Model

This module illustrates the numerical solution of the Kermack-McKendrick model for the course of an epidemic in a population. Ordinary differential equations (ODEs) have applications in a wide variety of contexts, including biology and ecology. One such application is the modeling of the spread of an epidemic in a population. The Kermack-McKendrick model of this phenomenon tracks the population of three different groups: susceptible y1, infected y2, and removed y3 members of the population. The removed population group represents previously infected members of the population that no longer contribute to the spread of infection because they have either died, been quarantined, or are no longer contagious. The model, which depends on the rate of infection c and the rate of removal d, is given by the system of ODEs:

y1′ = − c y1 y2
y2′ = c y1 y2dy2
y3′ = d y2


The user first selects the rates of infection and removal, the initial populations of each population group, and how far forward in time to compute the solution. The user also selects a numerical method and step size to be used in computing the approximate solution. Clicking Solve then calculates the approximate solution using the chosen numerical method and step size, and displays the results graphically. Each component of the solution is graphed as a function of time. The degradation in the quality of the solution using a lower-order method or coarser step size is clearly visible, particularly for higher rates of infection. Indeed, the approximate solution may be so poor that it does not fit within the displayed portion of the graph, in which case using a higher-order method or smaller step size will yield a more accurate solution.

Reference: Michael T. Heath, Scientific Computing, An Introductory Survey, 2nd edition, McGraw-Hill, New York, 2002. See Computer Problem 9.2 on pages 418-419.

Developers: Evan VanderZee and Michael Heath