---
name: adams-bashforth-moulton-4
description: "Take many fixed steps on a smooth nonstiff ordinary differential equation with an expensive right-hand side. The fourth-order Adams–Bashforth–Moulton predictor–corrector reuses four stored slopes and costs two new slope evaluations per step after startup."
---

# Fourth-order Adams–Bashforth–Moulton (ABM43)

## 1. What this solves

When a smooth ODE needs many steps but calling its rate function dominates cost, ABM43 reuses past slopes. It predicts with fourth-order Adams–Bashforth and applies one fourth-order Adams–Moulton correction. It gives fourth-order global accuracy on smooth problems and provides a local error indicator after startup.

## 2. When to use

Use a uniform grid for a smooth nonstiff IVP and measure enough steps to amortize startup. Supply $f(t,y)$ and either start from $y_0$ or provide four accurate slopes on the same grid. Compare cost per achieved accuracy with `rk4`. ABM43 uses two new evaluations per step after startup, whereas classical RK4 uses four.

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

| Situation | Use instead |
|---|---|
| Short run, inexpensive slope, or frequent restarts | `rk4` on a fixed grid. |
| Variable steps or changing order | CVODE Adams or LSODA in its nonstiff Adams mode. `dormand-prince-rk45` also fits a general nonstiff adaptive IVP. These solvers have their own error controllers. |
| Stiff decay | `bdf2` for fixed steps or `radau-iia-5` for adaptive steps. |
| Long-term geometry is the target | `stormer-verlet` for separable mechanics or `gauss-legendre-4` for a canonical nonseparable Hamiltonian. |

## 4. Algorithm

Store $F_j=f(t_j,y_j)$ at accepted states. With initial value alone, take three `rk4` steps at the same $h$. Use the usual RK4 stages at fractions $(0,1/2,1/2,1)$ with weights $(1,2,2,1)/6$. Evaluate $F_j$ at the accepted endpoint of each RK4 step so it is available as the first stage of the next step and for the Adams history.

### Adams–Bashforth 4 (AB4) predictor

With $y=y_n$ and history $(F_n,F_{n-1},F_{n-2},F_{n-3})$ newest first, predict

$$P=y+\frac{h}{24}(55F_n-59F_{n-1}+37F_{n-2}-9F_{n-3}).$$

For standalone AB4, accept $P$ and cache its slope. This costs one new evaluation per step after startup. ABM43 uses the same prediction to feed the corrector.

### Adams–Moulton correction and Milne estimate

Evaluate $F_P=f(t_n+h,P)$. Apply one correction,

$$C=y+\frac{h}{24}(9F_P+19F_n-5F_{n-1}+F_{n-2}).$$

Evaluate and cache $F_C=f(t_n+h,C)$, move the history forward, and accept $C$. Use exactly one correction for this predictor–evaluate–correct–evaluate form. An implicit Adams–Moulton solve iterates the endpoint equation and is a different algorithm.

With exact input history, the leading exact-minus-predicted and exact-minus-corrected local error coefficients are respectively $251/720$ and $-19/720$, multiplying $h^5 y^{(5)}(t_n)$. Thus $(19/270)(P-C)$ estimates **exact minus corrected** local error. It is asymptotic and does not estimate accumulated global error. Omit the estimate for startup steps.

## 5. Parameters

The fixed nonzero $h$ must lie in the stability and accuracy range for your model. Refine at a common endpoint. When changing the fixed grid or crossing a discontinuity, rebuild the history on the new smooth segment. Repeated failure to resolve the error can indicate stiff dynamics even if the right-hand side is smooth.

## 6. Applying it to your code

Rotate a buffer of four full state derivatives after each accepted update. Preserve time tags, especially on nonautonomous problems. OrdinaryDiffEqAdamsBashforthMoulton v2.2.2 implements `ABM43` with the same steady-state pairing and one corrector. It uses two plain RK4 steps, then applies the Adams–Moulton correction once using an RK4 prediction on step three. The reference here takes three plain RK4 steps and begins the ABM recurrence on step four. Older OrdinaryDiffEq code could stay in the predictor startup branch, so check the version before relying on the two-evaluation cost. Add `adams-bashforth-moulton-4 v0.1.0, Hairer, Nørsett & Wanner (1993)`.

## 7. Verification

Export `step(fun, t, y, h, history) -> (C, F_C, estimate)` from `port_adapter.py`. The caller updates history with the returned corrected slope. You can also export `integrate(fun, t0, y0, h, n_steps)` yielding `(time, state, estimate)` on the fixed grid, including the initial state and up to three startup rows with `estimate=None`. For zero steps yield only the initial state without evaluating the RHS. The optional integration test expects the documented startup and slope reuse. Run `python <skill>/checks/check_port.py` from the adapter directory and show its output. Other languages can use `checks/cases.json`.

On your ODE, compare fixed-time error under refinement and count actual evaluations. For the local indicator, compare with a finer or exact one-step solution from the same accurate history. Check signed error conventions before using the indicator.

## 8. Failure signatures

| Symptom | Likely cause |
|---|---|
| First steady-state step jumps or order collapses | History is reversed, unevenly spaced, or seeded with an insufficiently accurate startup. |
| RHS count is higher than two per steady step | History slopes were recomputed or multiple corrections were applied. |
| High-frequency ringing or growth appears after refinement of the spatial model | The explicit stability limit of the time method is being exceeded. |
| Error indicator disagrees on a smooth test | Check its sign, the corrector coefficients, and which state supplied the cached slope. |

## 9. Files and commands

`reference/adams_bashforth_moulton_4.py` contains the predictor, corrected step and startup iterator. `uv run examples/forced.py` reports fixed-time error and evaluation count. `uv run verify/check_cases.py` checks order, Milne scaling, cost and broken ports. `uv run checks/make_cases.py` prints the fixture JSON.

## 10. Sources

- Hairer, Nørsett and Wanner cover Adams formulas and predictor–corrector methods. [Solving Ordinary Differential Equations I (1993)](https://doi.org/10.1007/978-3-540-78862-1)
- The exact OrdinaryDiffEq source and API are listed in `meta.yaml`.
