8.7 Numerical Methods IV: Adams–Bashforth/Adams–Moulton
Every method so far (Euler, Heun, RK4) is a one-step method: to compute it uses only , and then forgets everything that happened before. That is wasteful. After a few steps we already know the slopes , , … at several earlier points, and those numbers carry real information about how the solution is bending. Multistep methods reuse them. In this section we study the most popular one, the fourth-order Adams–Bashforth/Adams–Moulton predictor–corrector, which we shall call ABAM for short. It reaches the same order as RK4 with only two new evaluations of per step instead of four, and it gives an estimate of its own error almost for free.
We keep the notation of Sections 8.5 and 8.6: , , nodes , exact values and approximations . In addition we abbreviate the computed slopes as
The idea: integrate an interpolating polynomial
Once more we start from the exact relation
Along the solution, the integrand is a function of alone, and we know (approximately) its values at earlier nodes. So we do what one always does with a function known only at a few points: replace it by the polynomial that passes through those values, and integrate the polynomial exactly. This idea goes back to the astronomer John Couch Adams in the nineteenth century.
A warm-up: the two-step formula
Use the last two slopes. The straight line through and is
Integrate it over the next step:
This gives the two-step Adams–Bashforth formula . Notice that it needs only one new slope per step, ; the other was computed during the previous step. The polynomial is used outside the interval where its data lie (we extrapolate from into ), which is why such formulas are slightly less accurate than their cost suggests.
Four points: the Adams–Bashforth predictor
For fourth order we interpolate the four most recent slopes by a cubic and integrate it over , as in Figure 8.7.1. It is convenient to measure position in steps, , so that the four nodes sit at and the step runs from to . The cubic is then a combination of the four Lagrange polynomials, for example
for the node (it equals at and at the other three nodes). Since , the weight of is . The other three weights are computed the same way (Exercise 1), and together they give the following formula.
This formula is explicit: everything on the right is already known. In the ABAM method it serves as the predictor.
Including the new point: the Adams–Moulton corrector
The extrapolation can be avoided if we interpolate on nodes that surround the step: and . Integrating that cubic over gives the Adams–Moulton formula
which is more accurate, but implicit: contains the unknown. We met exactly the same situation with the trapezoid rule in Section 8.5, and we use exactly the same remedy: evaluate at the predicted value.
Suppose and the slopes are known. Then
Each step costs two evaluations of , however many earlier slopes it uses.
Getting started
The formulas need four previous values, but an initial-value problem supplies only one, . So a multistep method cannot start itself. We compute with a one-step method, and only then switch to ABAM for .
Which one-step method? The starting values feed into every later step, so they must be at least as accurate as the method that follows. The natural partner of a fourth-order multistep method is the fourth-order RK4.
Do not start ABAM with Euler's method "because it is only three steps". The errors of three Euler steps are carried along forever and ruin the fourth-order accuracy. For the test problem below, starting with Euler makes the error at shrink only by a factor of about when is halved (second-order behaviour) instead of approaching .
- Compute by RK4 with the step .
- Compute and store the slopes .
- Predict with Adams–Bashforth, then evaluate .
- Correct with Adams–Moulton to get , then evaluate .
- Optionally estimate the error by (see below). Shift the stored slopes by one and repeat from step 3.
A complete worked step
We use the test problem of the previous two sections, , , with exact solution . As before, the calculation keeps full precision and the displayed numbers are rounded to six decimals.
Use ABAM with to approximate and for , . Estimate the error of each corrected value and compare with the true error.
Solution
- Starting values. RK4 with (Example 8.6.1) gives
- Stored slopes :
- Predict . First the bracket: Then
- Evaluate at the prediction. .
- Correct.
- Error estimate. The corrector changed the prediction by . The estimate derived below is The true error is : the estimate has the right sign and size. (The predictor alone was off by , ten times more.)
- Next step. Store and repeat with : The estimate is ; the true error is .
The solver below runs the whole method, RK4 start included, and lists the predicted value, the corrected value and the error estimate of every step. Try and compare with the RK4 solver of Section 8.6, or type in an equation of your own.
Accuracy and the built-in error estimate
The local truncation errors of the two formulas can be found by Taylor expansion, just as for the one-step methods. Assume the solution has a continuous fifth derivative. If all the values used on the right-hand side are exact, then
for some points , in . Both are , so both formulas are fourth order. The corrector's constant, , is more than ten times smaller than the predictor's, .
Suppose is smooth enough that the solution has a continuous fifth derivative on , and the starting values have errors (for example, they are computed by RK4). Then the ABAM predictor–corrector method has global error on .
For our test problem the error at falls by factors , , , as is halved from to : the ratio approaches , as it should for a fourth-order method, though more slowly than for RK4.
Estimating the error from the predictor and corrector
Here is the most useful by-product of a predictor–corrector pair. Over one step changes little, so let us treat as one number, . Then
Subtract the first relation from the second; the unknown exact value cancels:
Substituting back into the Adams–Moulton error gives the estimate
The difference between predictor and corrector costs nothing to compute, and . So: the local error of a step is about of the change made by the corrector. Programs use this in two ways.
- Step-size control. If the estimate exceeds the tolerance, the step is rejected and is reduced (and new starting values are computed); if it is far below the tolerance, may be increased.
- Modifier. Adding the estimate to the corrected value, , usually gives a more accurate number. In Example 8.7.1 this turns into , cutting the error from to . Whether the modified value is then used to continue the computation is a design choice; the basic method of Definition 8.7.2 does not.
Remember that the estimate concerns the error committed in one step. The global error, which accumulates over many steps, is typically larger.
Solve , on with , both by ABAM (with RK4 starting values) and by RK4. Compare accuracy and cost.
Solution
- Results. Up to both methods coincide (ABAM uses the RK4 values). After that:
The "estimate" column is , the local error of each single step; the global error is roughly the sum of these.ABAM ABAM error estimate RK4 error 0.4 1.468175 0.5 1.601278 0.6 1.737880 0.7 1.876246 0.8 2.014457 0.9 2.150394 1.0 2.281715 - Cost. RK4: steps evaluations. ABAM: for the three RK4 starting steps, for , then for each of the remaining steps, in total.
- Equal cost. With the same step, ABAM is about times less accurate, but cheaper. Spend the saving on a smaller step: ABAM with needs evaluations and gives an error of at , four times better than RK4's for slightly more work. Over longer intervals the cost of the start becomes negligible and ABAM needs only about half as many evaluations as RK4.
For , (exact solution ), RK4 with gives the starting values , , . Compute by ABAM, estimate its error, and decide whether is adequate if we want an error per step below .
Solution
- Slopes : , , , .
- Predict. , so
- Evaluate and correct. . Then and
- Estimate. , so the estimated error is . (The true error is ; the estimate gives the right order of magnitude.)
- Decision. The estimate is times the tolerance, so the step should be rejected. The local error behaves like , so we need to shrink by a factor of about : halving the step to (and recomputing the starting values) is the natural choice.
Advantages and drawbacks
- Cheap per step. Two evaluations of per step for fourth order, against four for RK4. This matters when is expensive, for example when each evaluation requires solving another problem.
- Error estimate for free. The predictor–corrector difference monitors the accuracy at every step, with no extra evaluations. (For RK4 one must use step doubling or a special embedded formula.)
- Not self-starting. It needs three starting values from another method.
- Changing is awkward. The formulas assume equally spaced past values; after a change of step size, new "past" values must be produced (by RK4, or by interpolation).
- More memory and bookkeeping. Several past slopes must be stored and shifted.
- Smaller stability range. For rapidly decaying solutions, ABAM tolerates a smaller step than RK4 before the numbers blow up (stability is discussed in Section 8.8).
Summary
- Adams formulas integrate a polynomial that interpolates earlier slopes. Adams–Bashforth (explicit) extrapolates; Adams–Moulton (implicit) interpolates and is more accurate.
- ABAM predicts with and corrects with .
- It is fourth order, needs RK4 (or equivalent) starting values, and costs two -evaluations per step.
- The local error is estimated by .
Exercises
- With , the Lagrange polynomials for the nodes are , , . Compute for and confirm the Adams–Bashforth coefficients.
Answer
, , , . - Derive the two-point Adams–Moulton formula by integrating the straight line through and over . Which method do you get if you predict with Euler's formula and correct with it?
Answer
, the trapezoid rule. Euler predictor + this corrector is Heun's method (Section 8.5). - Check that the coefficients of each formula add up to . Why must this be so?
Answer
and . For (constant) every and the step must be exactly . - For , (solution ), take the exact starting values at and apply the Adams–Bashforth formula with . Show that exactly, and explain why.
Answer
, , , ; . The slope is a cubic, so the interpolating cubic is exact. - For , , RK4 with gives , , . Compute and by ABAM and compare with .
Answer
, ; exact (error ). Estimate: . - For , , the RK4 starting values with are , , . Compute by ABAM and compare with .
Answer
, (error ; estimate ). - In some ABAM step the predictor gives and the corrector . Estimate the local error. If the tolerance per step is , should the step be accepted? By roughly what factor does the local error drop if is halved?
Answer
: reject. Halving divides the local error by about , giving roughly . - How many evaluations of do RK4 and ABAM (with an RK4 start) need to go from to with ?
Answer
steps. RK4: . ABAM: , little more than half. - Apply the modifier to the second step of Example 8.7.1: compute and its error.
Answer
; error instead of . - Explain in a few sentences why ABAM, unlike RK4, would be a poor choice if you had to change the step size very often (for example, at every step).
Answer
ABAM needs four equally spaced past values. After every change of these must be regenerated (by RK4 or interpolation), which costs extra evaluations and destroys the saving that made the method attractive. RK4 uses only the current point, so can change freely.