4.8.25 · D5Numerical Methods

Question bank — Adaptive step-size — RK45, error control

2,195 words10 min readBack to topic

Before the traps, a one-line memory refresh so the notation below is never used cold:

Recall The symbols used on this page

= step size · = estimated local error · = the budget · = order of the controlled result (4 for RK45) · = slope samples (function evaluations) · = safety factor · = clamps on how much may change.


What the constant actually is

Every trap below leans on the model . Students treat as a mystery letter, so let us pin it down first — with a picture.

Figure — Adaptive step-size — RK45, error control

The figure plots against on log axes. Because , taking logs gives a straight line of slope ; the height of that line (its intercept) is . A curvy region simply lifts the whole line up — same slope, larger — so a smaller is needed to duck under the tolerance dashed line.


The step controller as a picture

Figure — Adaptive step-size — RK45, error control

True or false — justify

Each item: decide true/false, then give the one-sentence reason. The reason is the answer.

The error estimate costs two extra function evaluations.
False. Both and are weighted sums of the same stages , so the estimate reuses every expensive -call and adds only a cheap dot product.
For RK45 the step-update exponent is because the accepted result is 4th-order.
False. The local error per step of an order- method scales like , so the exponent that inverts it is , not .
If a step is rejected you should still advance but with the new smaller .
False. A rejection means is untrustworthy; you must stay at the same and recompute the step with the smaller .
Making the tolerance smaller (stricter) tends to make the chosen steps smaller.
True. Since , forcing with a smaller requires a smaller , so the solver takes more, tinier steps.
The safety factor exists to make the solver run faster.
False. aims the predicted error slightly under tol; because is itself only an estimate, this makes the retried step likely to pass on the first try — reliability, not raw speed.
Using absolute tolerance alone is always fine.
False. If grows large, a fixed becomes an impossibly strict relative demand; mixing in lets the budget scale with the solution size.
Growing by the raw factor is always safe.
False. The error model is only trusted locally; a huge jump could land where the model was never valid, so the clamp (≈5) caps the growth.
estimates the error of the 5th-order answer that we actually advance with.
False. estimates the error of the 4th-order result; using it while advancing with (local extrapolation) is deliberately conservative — we bound the worse answer.
Two RK methods of different order must share the same number of stages to be an embedded pair.
True. "Embedded" means they share the identical stage vector ; different weight rows act on the same samples, which is exactly what makes the error estimate free.
If exactly, the raw update factor equals and stays the same.
True. ; the safety factor then nudges it slightly below 1, so shrinks a hair to stay safe.
The constant is a fixed number you can look up once for RK45.
False. contains the solution's own high derivatives at the current point, so it changes every step — large in curvy regions, small in flat ones; that variability is the whole reason for re-estimating error each step.
A negative step size is always a bug.
False. Integrating backwards in time (from a later to an earlier one) uses deliberately; the controller then works on , keeping the magnitude under the clamps while preserving the sign/direction.

Spot the error

Each line contains a flawed statement or reasoning step. Name what is wrong.

"The step passed since ."
The inequality is backwards: a step is accepted only when . Here exceeds tol, so it must be rejected.
"After rejecting, we recompute with ."
The ratio is upside-down. It must be ; since on a rejection, that gives a factor and correctly shrinks .
"The order-4 method's local error is ."
Off by one power: the local (per-step) error of an order- method is ; the figure describes the global error accumulated over many steps.
"We can drop the clamp ; only matters."
Both clamps matter. prevents from collapsing too violently after a bad step, avoiding needless stalling on a single hard point.
"Because is more accurate, measures its error."
The difference measures the 4th-order error, not the 5th's; the sign of the subtraction is irrelevant because we take a norm, but the interpretation (whose error it is) is the trap.
"To halve the error, halve the step size."
Halving cuts the local error by , not by 2, because local error . Step and error are far from linearly related.
"An embedded pair needs a separate set of -evaluations for each order."
No — sharing across both orders is the entire point; separate evaluations would defeat the "free estimate" advantage.
"When integrating backwards we should flip the accept test to ."
Wrong — the accept test always compares magnitudes ; only 's sign flips for backward integration, not the error logic.

Why questions

Answer each in one or two reasoning sentences.

Why compute two solutions per step instead of one very accurate one?
A single number gives no self-knowledge of its own error; the difference of two orders is a cheap, on-the-fly error meter that drives the step control.
Why does the constant never appear in the final step-update formula?
We write and then divide the two equations, cancelling the unknown and leaving only the ratio of step sizes.
Why is the local error, not the global error, what the controller regulates?
The controller can only observe one step at a time; it keeps each step's local error under budget, trusting that many controlled local errors keep the global error acceptable.
Why does the exponent depend on rather than ?
Because the quantity being driven to tol is the leading local error term ; inverting a power relation requires the root .
Why must an explicit adaptive method like RK45 still struggle on stiff ODEs?
Stability, not accuracy, forces tiny steps there; the controller keeps shrinking to stay stable even where the solution is smooth, so adaptivity cannot rescue an unstable explicit scheme. See Stiff ODEs and Stability.
Why is the leading error term proportional to a single power of at all?
It comes from the first uncancelled term of the Taylor Series Expansion of the true vs numerical step; all lower-order terms are matched by design, leaving one dominant term.
Why aim the predicted error below tol rather than exactly at it?
is an estimate with its own uncertainty; targeting exactly tol risks the actual error landing above budget, forcing a wasteful re-rejection.
Why does the solver need an explicit abort rule and not just keep shrinking ?
If a genuine singularity or stiffness keeps forcing rejections, marches toward zero and would underflow to a value where in floating point — no progress is possible, so the solver must stop and report failure rather than loop forever.

Edge cases

Boundary and degenerate scenarios the topic invites.

(the two orders agree to machine precision) — what does the formula do?
The ratio , so the raw growth factor blows up; the clamp (≈5) catches it and grows by at most 5×, keeping the step safe.
near a solution zero-crossing — which tolerance term saves you?
The relative part collapses toward zero there, so provides the floor and the budget never becomes zero (which would demand impossible perfection).
The solution is a straight line (, no curvature) — what happens to ?
The higher-order terms vanish, so makes stay tiny every step, and the controller repeatedly hits the clamp, growing as fast as it is allowed.
Two rejections in a row at the same — is the algorithm broken?
No; each rejection shrinks further (bounded below by per attempt) until the predicted error finally fits under tol, then the step is accepted and advances.
keeps hitting and shrinking toward zero — when must the solver give up?
When falls below a floor (e.g. or is indistinguishable from in floating point), further shrinking cannot make progress, so the solver aborts and reports "step size too small" rather than looping forever.
Integrating backwards from to — what changes in the controller?
The sign of becomes negative to move time leftwards, but the controller regulates : the accept test , the clamps , and the update factor all act on the magnitude, so the direction is preserved throughout.
A single ultra-sharp spike in an otherwise flat solution — how does adaptivity respond?
The local jumps at the spike, so it races through the flat region ( small, big steps), then automatically brakes to tiny steps across the spike where is huge, spending its function evaluations where the curvature actually demands them.
What if were set to exactly ?
The controller would aim to hit tol precisely; because under-predicts sometimes, more steps would land just over budget and get rejected, wasting work — hence .

Connections

  • Adaptive step-size — RK45, error control — the parent note these traps drill.
  • Order of a Numerical Method — fixes the that sets the exponent.
  • Local vs Global Truncation Error — the local/global distinction behind half these traps.
  • Taylor Series Expansion — source of the leading term and the constant .
  • Stiff ODEs and Stability — why adaptivity alone cannot cure stiffness.
  • Dormand–Prince (RK45 used by scipy solve_ivp) — the real embedded-pair coefficients.