

Part 3: Euler's Method for Systems
In Part 2, we displayed solutions of an SIR model without any hint of solution formulas. This suggests the use of a numerical solution method, such as Euler's Method, which we introduced in the Limited Population and Raindrop modules.
Recall the idea of Euler's Method: If we have a "slope formula," i.e., a way to calculate dy/dt at any point (t,y), then we can generate a sequence of yvalues,
y_{0}, y_{1}, y_{2}, y_{3}, ...
by starting from a given y_{0}, and computing each rise as slope x run. That is,
y_{n} = y_{n1} + slope_{n1} Deltat
where Deltat is a suitably small step size in the time domain.
It really doesn't matter in this calculation if the slope formula happens to depend not just on t and y but on other variables, say x and z  as long as we know how x and z are related to t and y. If x and z happen to be other dependent variables in a system of differential equations, we can generate values of x and z in the same way.
Of course, for the SIR model, we want the dependent variable names to be s, i, and r. Thus we have three Euler formulas of the form
s_{n} = s_{n1} + sslope_{n1} Deltat,
i_{n} = i_{n1} + islope_{n1} Deltat,
r_{n} = r_{n1} + rslope_{n1} Deltat,
More specifically, given the SIR equations,
the Euler formulas become
Of course, to calculate something from these formulas, we must have explicit values for b, k, s(0), i(0), r(0), and Deltat. In this part we explore the adequacy of these formulas for generating solutions of the SIR model. If your helper application has Euler's Method as an option, we will use that rather than construct the formulas from scratch.


modules at math.duke.edu  Copyright CCP and the author(s), 2000 