fhat. Workspace

Fifth-order Radau IIA

Adaptive high-accuracy steps for stiff differential equations.

errorO(h5)costnonlinear solve / stepimplicit · L-stable · adaptive steps · dense output

Hairer & Wanner 1996Also known as Radau IIA order 5, three-stage Radau IIA, RADAU5

Full skillv0.1.0

Use with your agent

Use the fhat method "radau-iia-5" (https://fhat.dev/methods/radau-iia-5/SKILL.md) for this problem. Check first whether it applies.

1. What this solves

Advance a stiff ODE while resolving the evolution you care about, even when other modes decay much faster. Radau IIA uses three coupled implicit stages. Its endpoint has order five for smooth problems, and a collocation cubic provides values inside the step.

2. When to use

Use this for a stiff explicit ODE y′=f(t,y)y'=f(t,y) that needs tighter accuracy, adaptive steps, or output at irregular times. Provide a Jacobian Jf(t,y)J_f(t,y) or an equivalent way of solving the stage equations. Scale tolerances for the components that matter. The reference is for small dense systems.

3. When not to use (and what to use instead)

Situation Use instead
Smooth nonstiff ODE with an adaptive tolerance dormand-prince-rk45.
Fixed-grid stiff decay at modest accuracy bdf2, or backward-euler for rougher results and startup damping.
Long-time symplectic integration gauss-legendre-4 or implicit-midpoint for canonical nonseparable systems.
Algebraic equations or singular mass matrix Use a DAE solver appropriate to the index and constraints. The reference solves explicit ODEs.

4. Algorithm

Put s=6s=\sqrt6, c=((4−s)/10,(4+s)/10,1)c=((4-s)/10,(4+s)/10,1) and use the rows of AA below. The weights bb equal the last row of AA.

[(88-7s)/360,   (296-169s)/1800, (-2+3s)/225]
[(296+169s)/1800, (88+7s)/360,   (-2-3s)/225]
[(16-s)/36,     (16+s)/36,       1/9]

Solve the stage-state equations Yi=y+h∑jaijf(t+cjh,Yj)Y_i=y+h\sum_j a_{ij} f(t+c_jh,Y_j). Start all stage states at yy. For the residual ri=Yi−y−h∑jaijf(t+cjh,Yj)r_i=Y_i-y-h\sum_j a_{ij} f(t+c_jh,Y_j), the Newton block (i,j)(i,j) is δijI−haijJf(t+cjh,Yj)\delta_{ij}I-h a_{ij}J_f(t+c_jh,Y_j). Solve for the stage corrections and subtract them. The standalone step bounds each stage correction component by max(tol * scale, 4 * ulp(scale)). For each component, scale is its largest absolute value in the step input, the old stage, and the updated stage. Here ulp is floating-point spacing and the default is tol=2e-14. The reference permits 12 updates and reports failure for a singular block matrix, nonfinite arithmetic or an exhausted iteration limit. Return Y3Y_3 directly. Its equality with the Runge–Kutta output follows from c3=1c_3=1 and the last row of AA being bb.

For dense output at fractional time θ\theta, use the cubic Lagrange interpolant through the pairs (0,y)(0,y) and (ci,Yi)(c_i,Y_i). Interior interpolation has its own error, which can exceed the endpoint error. For z=hλz=h\lambda on the scalar linear equation, the amplification factor is

R(z)=1+2z/5+z2/201−3z/5+3z2/20−z3/60.R(z)=\frac{1+2z/5+z^2/20}{1-3z/5+3z^2/20-z^3/60}.

It is bounded by one on the closed left half-plane and tends to zero far into that half-plane, giving L-stability.

5. Adaptive steps and parameters

For the full step and each half step, require every Newton correction component to fit within 1% of its error weight. Use atol + rtol * magnitude, where magnitude is the largest absolute value of that component in the substep input, the old stage and the updated stage. The correction limit has a roundoff floor of four floating-point spacings at that magnitude.

The reference tests a full step against two half steps. At the endpoint, use (Yf−Yr)/31(Y_f-Y_r)/31 to estimate the error of the refined result in the smooth asymptotic regime. Scale each component by atol + rtol * max(abs(y), abs(Y_r)) and let eende_{\mathrm{end}} be the largest ratio.

Also compare the full-step cubic with the refined cubics at the midpoint and at one-third and two-thirds of each half step. At each of these five times, divide the absolute difference by atol + rtol * max(abs(full), abs(refined)) and let edensee_{\mathrm{dense}} be the largest ratio. Use the full difference for this check because the two dense outputs interpolate different segments. Reject if either ratio exceeds one. For the next trial, use 0.9/max⁡(eend1/6,edense1/4)0.9/\max(e_{\mathrm{end}}^{1/6},e_{\mathrm{dense}}^{1/4}) clipped to [0.2,4][0.2,4], with 4 when both errors are zero. The exponents reflect the smooth local endpoint and interior error orders. Keep the two half-step cubics on acceptance. Retry a failed Newton solve at half size, leave the accepted state intact on rejection, and clip the last trial to the end time.

Choose the first trial size with the fastest transient you intend to measure in mind. Set absolute tolerance to an error scale near zero and relative tolerance to the useful fractional accuracy. The interior check catches unresolved initial layers that give small differences at the endpoint alone. It samples the two interpolants, so verify the requested output times with tighter tolerances or smaller steps when accuracy matters there. The fifth-order endpoint and the local estimate can degrade in stiff nonautonomous or nonsmooth regimes.

6. Applying it to your code

Keep the stage ordering consistent when building the Jacobian blocks. For large systems use an established solver. Production codes such as RADAU5 or SciPy Radau use transformed stage systems, reuse linear algebra and use an embedded error estimate. The reference uses dense Newton with separate stage Jacobians, step doubling and its own sampled dense-output check. Add the code comment radau-iia-5 v0.1.0, Hairer & Wanner (1996).

7. Verification

Create port_adapter.py with step(fun, jac, t, y, h) -> (endpoint, dense). A signed hh is supported, and the callable dense(theta) takes a fraction from zero to one. You can also export solve(fun, jac, t0, y0, t_end, *, h0, rtol, atol) -> (endpoint, evaluate, accepted, rejected). That optional checker expects evaluate(time) to use physical time and counts trials, with each accepted trial containing two half steps. It checks a stiff initial layer and a nonlinear component in two unit scales. Run python <skill>/checks/check_port.py from the adapter directory and show the output. Other languages can use the formulas in checks/cases.json. The standalone step checker compares endpoints and dense output for a nonlinear problem in two state scales.

On your model, compare tighter tolerances at identical output times and check the resolved slow component and any transient you need. Inspect rejected steps and compare the endpoint and interior errors separately.

8. Failure signatures

Symptom Likely cause
Accurate endpoints, inaccurate interior values The interpolation is lower order or the output lies in an unresolved initial layer. Check the interpolation nodes and refine the steps through that layer.
Fast mode rings or persists across large steps Check that the last stage is used as the endpoint and that the couplings are in the displayed order.
Repeated rejection or Newton failure Check Jacobian orientation, scales, stiffness and whether the RHS is smooth through the trial interval.

9. Files and commands

reference/radau_iia_5.py provides a step and a forward adaptive solver. uv run examples/stiff_output.py shows irregular sampling. uv run verify/check_cases.py tests endpoints, dense output, damping, rejection, state scaling and three incorrect ports. uv run checks/make_cases.py prints the fixture JSON.

10. Sources

Evidence

Output of the verification scripts, run on the reference implementation of version 0.1.0 when this page was built.

Passed verify/check_cases.py: Confirms fifth-order endpoints, damping, dense output through a stiff initial layer, adaptive rejection, and accuracy under changes of scale for the standalone step and adaptive solve. Catches three faulty ports.
PASS forced: endpoint and interior error 0.00e+00
PASS coupled: endpoint and interior error 0.00e+00
PASS stiff: endpoint and interior error 0.00e+00
PASS damped: endpoint and interior error 0.00e+00
PASS fixed-step endpoint orders 4.927, 4.951, 4.972
PASS R(-1e5)=2.999490e-05
PASS mixed-scale active endpoint and dense error in normalized units: 1.11e-16
PASS adaptive dense error 1.50e-07 -> 6.46e-12; accepted/rejected loose (36, 4), tight (344, 5)
PASS stiff initial layer: early scaled error 3.80e-02; error at t=0.05 3.87e-43; accepted/rejected 132/11
PASS nonlinear slow-mode relative errors at scales 1 and 1e-12: 2.39e-10, 2.39e-10
PASS exact dense cubic reproduction within 4.44e-16
PASS straight_line: rejected by 4 fixture(s)
PASS freeze_time: rejected by 2 fixture(s)
PASS wrong_endpoint: rejected by 4 fixture(s)

More methods are coming.