8.11 ODE tolerances, error control and stiffness
The default ODE options are relative tolerance (10^{-6}), absolute tolerance (10^{-9}), and at most 100,000 accepted/rejected step attempts per interval. Control-stream TOL=n sets relative tolerance to (10^{-n}), clamped to exponents 2–15. ATOL=n sets absolute tolerance to (10^{-n}), clamped to 3–20.
When ATOL is absent, nlmx scales its default with TOL:
atol = 1e-9 × min(10^(6 − TOL), 1)
Thus tightening TOL above 6 also tightens the absolute floor. If an ODE model omits TOL, a build note records relative tolerance 1e-6.
Error norm
For each state, the local error is scaled by
and combined as a root-mean-square norm. Step acceptance requires the norm not exceed one. Step-size selection uses value parts of dual numbers; derivative components propagate through accepted arithmetic but do not control adaptivity.
Stiffness handling
Dormand–Prince uses an embedded 5(4) estimate and FSAL structure. In automatic mode, excessive steps or a repeated stiffness indicator cause the current interval to restart with Rosenbrock; the subject stays on the stiff path. Stiff ADVANs start with the L-stable Rosenbrock implementation.
Table 8.3. Tolerance review
| Item | Default | Review concern |
|---|---|---|
| RTOL | 1e-6 |
Relative error of non-small states |
| ATOL | 1e-9 at TOL 6 |
Error floor near zero |
| Max steps | 100000 per interval |
Pathological/stiff intervals |
| ADVAN13 switch budget | source default 200000 |
Usually stiffness detector switches earlier |
The switch budget exceeding the generic maximum means ordinary max-step failure can occur before that budget; stiffness indicators and integration errors are the practical automatic triggers. Document this implementation detail rather than promising a 200,000-step trial.
Common mistakes
- Comparing solvers with unmatched RTOL/ATOL.
- Reporting only relative tolerance for near-zero states.
- Assuming tighter tolerances always improve an ill-posed model.
Checklist
- Record TOL, ATOL, ADVAN and solver path.
- Run a tolerance-convergence study on representative subjects.
- Test near-zero and stiff states separately.
Further reading
See $DES solver selection, the analytic/ODE experiment and Chapter 9's forthcoming numerical reproducibility guidance.