4.8.25 · D1Numerical Methods

Foundations — Adaptive step-size — RK45, error control

2,591 words12 min readBack to topic

This page is the toolbox. Before you can read the parent note, you must own every symbol it throws at you. We build each one from nothing — plain words, then a picture, then why the topic needs it — in an order where each tool rests on the previous.


1. What a differential equation even says

So is a sentence: "At every point , here is the direction to head." It does not hand you the curve; it hands you an arrow at every point, and you must walk along the arrows to trace the curve.

Figure — Adaptive step-size — RK45, error control

Why the topic needs this. RK45 is a machine for walking along those arrows accurately. Every symbol later (, , ) is about taking one good step in the arrow field. If you don't see the field, nothing else lands.

Recall Check: what does

give you? returns... ::: the slope (steepness) of the solution at the point — not the solution itself.


2. The step size — the length of one hop

Why "little"? The arrow field can bend. If you follow one straight arrow for a huge distance you drift off the true curve. A short hop stays close to the truth — but short hops are slow. This tug-of-war (accuracy vs speed) is the entire reason adaptive methods exist.

Figure — Adaptive step-size — RK45, error control

3. The slope samples — peeking before you leap

A crude method uses one slope (the arrow at the start) for the whole hop. A Runge–Kutta method is smarter: it peeks at several arrows inside the interval and blends them.

The Greek (sigma) just means add them all up: up to the sample before .

Figure — Adaptive step-size — RK45, error control

Why the topic needs . These samples are the expensive part — every is a call to . The whole "free error estimate" trick works precisely because RK45 reuses the same for two different answers. You cannot appreciate "free" until you know is what costs money.

Recall Check: why is

and not ? Because each slope sample is built from the ones already computed — an explicit chain, so a sample never depends on itself.


4. Weighted sums — blending the peeks into one answer

Once you have all the peeked slopes (there are of them), you combine them into a single "effective slope" using weights , then take the hop:

Why a weighted average and not just the first arrow? Averaging several arrows across the step cancels out the curving error much better — this is what makes RK "high order" instead of crude. The exact come from Dormand–Prince (RK45 used by scipy solve_ivp).


5. The second weight row — two answers from ONE set of peeks

Here is the piece the whole topic pivots on, so we build it slowly.

You have the peeked slopes . To finish a step you blend them with a weight row . But nothing forces you to use only one weight row. The very same slopes can be blended a second time with a different set of weights, which we write (read "b-i-star" — a second, separate list of blend numbers).

Figure — Adaptive step-size — RK45, error control

Why the topic needs . Without a second weight row you would have to run a whole separate method (fresh, expensive ) just to estimate error. The star-row is the trick that makes RK45 cheap: same peeks, second blend, instant error ruler.

Recall Check: what is different between

and ? Only the weight row: vs — the slope samples are identical, which is why the estimate is nearly free.


6. Order — how fast the error shrinks

Reading . RK45 controls the step off the order-4 answer , so and the exponent is . Halving then shrinks the error by times. That steep power is why small steps buy so much accuracy, and why the update formula uses a fifth root.

Figure — Adaptive step-size — RK45, error control

This power law comes straight from Taylor Series Expansion: the first term the method fails to cancel is proportional to . See Order of a Numerical Method and Local vs Global Truncation Error for where is pinned down.


7. The error estimate — one number saying "how wrong"

Because (order 5) is far more accurate than (order 4), their gap is essentially the whole error of the weaker one — a free ruler, exactly as pictured in Section 5.


8. Tolerance — the error budget you allow

Why both? If becomes huge, a tiny fixed becomes an impossible demand; the term rescues you by scaling the budget. If passes through zero, keeps the budget from collapsing to nothing. The accept/reject decision is simply the comparison .

Recall Check: why not use

alone? Because when grows large a fixed absolute floor is impossibly strict — the relative term lets the budget scale with the solution.


9. Putting the symbols together — the vocabulary the topic assumes

Symbol Plain meaning Picture
slope-recipe at every point arrow field
length of one hop in horizontal gap
where we currently stand a dot on the curve
-th peeked slope small arrows inside the step
higher-order (order 5) blend weights recipe for the accurate average
lower-order (order 4) blend weights, same recipe for the second average
the two answers from the two rows two landing dots
order (error shrink rate) steepness of the error curve
estimated step error gap between the two answers
error budget the line you must stay under

Everything in the parent's boxed formula is now a symbol you've built: a hop length, an error budget, an estimate (from two weight rows), and an order.


Prerequisite map

Slope field y prime = f

One hop of length h

Slope samples k i

High order blend b i k i

Low order blend b i star k i

Error estimate epsilon

Taylor series

Order p and error h to the p plus 1

Tolerance tol

Adaptive step control RK45


Equipment checklist

I can state what returns
The slope of the solution at the point — an arrow, not the curve.
I can say what is and the trade-off in choosing it
The length of one hop in ; small = accurate but slow, large = fast but risks flying off bends.
I know what and mean
The time we currently stand at and the solution's height there ( counts steps).
I can read
"Add up the earlier slope samples, each scaled by " — a chain where each peek uses previous peeks.
I know what a slope sample is and why it's expensive
An evaluation of inside the step; each one is a costly function call, so RK45 reuses them.
I can explain the difference between and
Two weight rows over the SAME : gives the order-5 answer, the order-4 answer.
I can say what and are
The two hops built from the two weight rows; the superscripts label the order, not powers.
I can explain why two answers give a free error estimate
The accurate stands in for the truth, so is essentially the error of , and the costly are reused.
I can explain what "order " measures
How fast the local error shrinks with : error .
I know why the local exponent is , not
Local (per-step) error scales as ; the global error scales as .
I can state what estimates and where it comes from
The size of the step's error, from .
I can write and read
A per-step error budget mixing a fixed floor and a solution-scaled part.
I can decide accept vs reject
Accept the hop if , else reject and retry with smaller .

Connections

  • 4.8.25 Adaptive step-size — RK45, error control (Hinglish) — the parent topic these foundations feed.
  • Runge–Kutta Methods (RK4) — where the stages and weights come from.
  • Taylor Series Expansion — the origin of the error law.
  • Order of a Numerical Method — pins down the in the exponent.
  • Local vs Global Truncation Error — why per-step error is .
  • Dormand–Prince (RK45 used by scipy solve_ivp) — the actual table.
  • Stiff ODEs and Stability — when even adaptive explicit steps struggle.