276. Numerical Integration
Methods for numerically integrating the ODEs of a system-dynamics model. Critical for simulation accuracy.
276.1. Euler method (default for SD)
Forward Euler. Simple, fast, error per step , total error .
For SD models, Euler with a small enough is usually good enough.
276.2. Time step () selection rule
where are the time constants of the system. Rule of thumb: divide the fastest time constant by 4-10.
Why? At , Euler captures the dominant time scale; faster than that, all time scales are well-resolved.
276.3. Runge-Kutta 2 (RK2 / midpoint)
Error per step , total . Twice the work of Euler per step, better accuracy.
276.4. Runge-Kutta 4 (RK4)
The “classical” RK4:
Error per step , total . Four times the work per step, much higher accuracy.
276.5. Which to use?
| Method | Per-step cost | Per-step error | Best for |
|---|---|---|---|
| Euler | 1 eval | Most SD models, small | |
| RK2 | 2 evals | Moderate accuracy needs | |
| RK4 | 4 evals | High-accuracy / oscillatory systems |
For smooth SD models with : Euler is fine. For oscillatory or stiff systems: RK4 or adaptive methods.
276.6. Stiff systems
When time constants span orders of magnitude (e.g., , ), explicit methods (Euler, RK) need tiny to stay stable on the fast time scale, wasting effort on the slow.
Implicit methods (backward Euler, BDF) trade per-step cost for stability — large allowed.
In SD, stiff systems are rare; explicit methods are usually sufficient.
276.7. Initialization in equilibrium
Common SD practice: set initial stocks so that all flows balance at (system at steady state). Then study the response to a perturbation.
This isolates the dynamic response from initial-condition transients.
276.8. See also
- Stocks and Flows — the equations being integrated
- System Dynamics overview
- Differential Equations