Initial Value Problem Methods: A Computational Laboratory

Compare numerical methods for \(y' = f(t,y),\ y(t_0)=y_0\) — Euler, improved Euler, backward Euler, trapezoidal, Adams–Bashforth, Adams–Moulton, BDF, Taylor, and Runge–Kutta. Tick several methods, vary the step size live, and study accuracy, convergence order, and absolute stability on stiff and non-stiff problems.

Examples

To solve your own equation, choose Custom at the bottom of this list, then edit \(f(t,y)\), \(t_0\), \(y_0\) and \(t_{\text{end}}\) below.

Parameter \(\lambda\)

−2.0

Drag the slider or type an exact \(\lambda\) (any value); large negative makes \(y'=\lambda y\) stiff.

Number of steps \(N\)

N = 8
h = 0.25

Slide right to add steps (smaller \(h\)); each notch is one more step.

Graph height

380px
Global error
Select methods and press Solve.
Solution & approximations
About this plotThe equation and reference shown above the plot identify what is being solved. The black curve is the exact solution (for built-in examples) or a fine numerical reference (dense RK4, or an A-stable implicit solver when the problem is stiff). Colored curves with markers are the selected methods sampled at their step nodes. The view is auto-scaled to the reference so it fills the frame; divergent (unstable) runs simply shoot off the top or bottom — scroll to zoom or drag to pan to follow them.
About this plotAbsolute error at each grid point on a logarithmic axis. Higher-order methods sit lower; watch the error explode once a step leaves a method’s stability region. For the discontinuous right-hand sides (the staircase, relay, and square-wave examples) the error jumps at each discontinuity of the equation, so the line is broken there: it stays connected within each smooth stretch but leaves a gap across the step that straddles a jump, rather than drawing a misleading diagonal through it.
Computing…
About this plotShaded blue: \(z=h\lambda\) values for which the method is absolutely stable (\(|\)amplification\(|\le1\)); the dark curve is the stability boundary. The red × marks \(z=h\lambda\) for this problem. When no explicit \(\lambda\) is set, \(\lambda=\partial f/\partial y\) is sampled along the solution and the \(\times\) is placed at its most negative value — the worst case for absolute stability (hover to see at which \(t\)). If the × lies outside the shaded region, expect the method to grow there.
Computing…
About this plotLog–log plot of the global error (in the norm chosen by the norm selector) against \(h\) (each \(h\) halved). The fitted empirical order \(p\) — the slope of the line — appears in the legend; a straight line of slope \(p\) confirms \(O(h^p)\) convergence. Step sizes where a method is unstable (large \(h\), error far beyond the solution scale) or round-off-dominated (very small \(h\), error stuck near machine precision) are dropped automatically, so the axis and the fitted order use only the clean convergent range. In adaptive mode this becomes a work–precision diagram: the error is plotted against the number of accepted steps \(N\) over a sweep of tolerances, and since error \(\approx C\,N^{-p}\) the slope of \(\log|\text{Error}|\) vs. \(\log N\) gives \(-p\); the fitted \(p\) shown in the legend is measured on the most-refined (tightest-tolerance) points.
Cite this tool
Kapita, S. (2026). Initial Value Problem Methods: A Computational Laboratory. Math Tools. https://doi.org/10.5281/zenodo.20981245