Skip to content
LearnMathora

Differential equations · 03 · How computers solve them · 8 min

Predicting step by step

Most real differential equations have no tidy formula solution. Computers don't mind: they take the law and march it forward in tiny time steps — slope, step, repeat — and the future appears, one slice at a time.

Build the intuition

Euler's method: slope, step, repeat

Stand at your current value. Ask the law for the slope there. Step forward a tiny Δt along that slope. You're somewhere new — ask again, step again. The crude version (Euler's method) is three lines of code; refined versions power every serious simulator, but the soul is identical.

yn+1=yn+f(yn)Δty_{n+1} = y_n + f(y_n) \cdot \Delta t

Smaller steps, truer curves

Each step pretends the slope holds constant for a moment — a small lie that accumulates. Halve the step size and the lie shrinks; in the limit of infinitely small steps you'd recover the exact solution. Recognize the move? It's Riemann-sum thinking from integrals, pointed at the future.

The cost of accuracy

A weather model stepping every minute computes 1,440 global updates per simulated day — accuracy is bought with computation. Choosing step sizes (and where to take smaller ones) is a real engineering craft called numerical analysis, and it decides what's simulable at all.

See it move

InteractiveArea accumulator
4
8
Distance covered from t = 0 to 4: 9.06 — the area under the speed curve. More slices hug the curve more closely.

Step-by-step prediction is accumulation: coarse slices give a rough total, finer slices converge to truth — same idea steering simulations.

A worked example

Forecast a cooling coffee by hand

  1. Law: T′ = −0.5(T − 20). Start: T = 90°. Step: Δt = 1 min.

  2. Minute 1: slope = −0.5(70) = −35°/min… T ≈ 90 − 35 = 55°. (Big step, big lie — the real value is ~62°.)

  3. Retry with Δt = 0.5: T ≈ 72.5 then ≈ 59.4 — already much closer.

  4. Three rows of arithmetic and you've done what supercomputers do, minus the supercomputer.

Out in the world

Game physics at 60 fps

Every falling crate and arcing grenade in a video game is an Euler-style update running each frame: velocity += gravity × Δt; position += velocity × Δt. Sixty differential-equation steps per second, per object — playable physics is numerical integration.

Common confusion, cleared

Numerical answers are second-class guesses.

They're controlled approximations with known error bounds — and for most real systems, the only solutions that exist. The Moon landings flew on numerical integration.

A simulation that ran fine is correct.

Too-large steps can produce stable-looking nonsense (or exploding values). Practitioners halve the step and check the answer barely moves — convergence testing, the simulator's seatbelt.

Recap

  • Slope, step, repeat: that's Euler's method — and all simulation, in spirit.
  • Smaller steps converge to the true curve (Riemann thinking, forward in time).
  • Accuracy costs computation; step size is the dial.