Mathematics and physics
How to check time-step convergence for an ODE solver
Choose a quantity of interest such as the endpoint, peak, or event time. Refine the time step and compare the same output or event across runs.
Gather equations, initial values, integration interval, parameters, solver version, and the required accuracy. Write the comparison quantities and tolerances before inspecting the results.
Fixed-step methods can use a sequence of step sizes. For adaptive methods, record tolerances and maximum step separately from output sampling times.
How to do it
Freeze the model and comparison times
Hold equations, parameters, initial values, and end time fixed. Align outputs at common times. For events, record the event function and crossing direction.
Refine systematically
For fixed-step methods, try halving the step. For adaptive methods, tighten rtol and atol under otherwise comparable settings and assess max_step separately when needed. Compare the most important states and events.
Choose a reference
Use an analytic solution when available. Otherwise use a justified finer solution or independent numerical method and describe limitations of that reference.
Report errors, cost, and decisions
Save settings, work or runtime, and the largest relevant differences. If estimating observed order, explain the error and ratios used. Investigate roundoff, stiffness, events, and settings when refinement stops improving results.
Worked example
Teaching example y′ = −y with y(0) = 1, using explicit Euler to t = 1. The exact value exp(−1) is about 0.367879.
| Time step | Euler endpoint | Absolute error |
|---|---|---|
| 0.25 | 0.316406 | About 0.051473 |
| 0.125 | 0.343609 | About 0.024271 |
| 0.0625 | 0.356074 | About 0.011805 |
Errors roughly halve as the step is halved, consistent with first-order behavior in this example. A real report should include relevant time intervals, events, and the chosen reference.
Common questions
Does a denser t_eval make a solution more accurate?
t_eval specifies output times. Internal step size and error control follow the solver settings.
Is a stable endpoint enough?
Check peaks or event times if the study relies on them. Intermediate errors can differ from endpoint error.
Verified sources
The official sources below were checked on 2026-11-13. Access conditions and update dates are rechecked before publication.
RigorMed workspace
Review my time-step convergence record
Bring equations, solver settings, outputs at several resolutions, and common comparison times. Prepare an error table and report notes for review.
