4.8.22 · D3Numerical Methods

Worked examples — ODE solvers — Euler's method (derivation, global error)

2,604 words12 min readBack to topic

Before any numbers, one reminder of what every symbol means, so nothing is used unexplained:


The scenario matrix

Every problem this topic can throw is one (or a blend) of these cells. The table lists the cell, what makes it distinct, and which example below covers it.

Cell What makes it special Covered by
A. Growing solution, positive slope , climbs, errors are one-sided (undershoot) Example 1
B. Decaying solution, negative slope , falls toward a floor Example 2
C. Step-halving / order check verify global error empirically Example 3
D. Degenerate: slope at a point ⇒ a flat step, unchanged for that step Example 4
E. Limiting / unstable: too large $ 1+h\lambda
F. Autonomous non-linear depends on only, but non-linearly Example 6
G. Real-world word problem translate physics → IVP → Euler Example 7
H. Exam twist: back-solve for or given the answer, find an input Example 8

We now walk every cell. Throughout, the derivation and error law come from the parent topic and rest on the Taylor Series Expansion.


Example 1 — Cell A: growing solution, positive slope

The figure below plots our three orange Euler points against the teal true curve. Notice that the orange polyline sits under the teal curve at every , and the plum arrow at measures the gap — this is the accumulated undershoot the forecast predicted. Because the true curve bends upward, straight tangent steps can only cut the corner and fall short.

Figure — ODE solvers — Euler's method (derivation, global error)

Example 2 — Cell B: decaying solution, negative slope


Example 3 — Cell C: the order check (halve , halve the error)


Example 4 — Cell D: degenerate slope (a flat step)

The figure traces the two orange steps. The first segment slopes down (slope ); the second, drawn thick in plum, is perfectly horizontal because there — the visual proof that a zero slope produces a flat step with . Reading the picture left to right is the calculation.

Figure — ODE solvers — Euler's method (derivation, global error)

Example 5 — Cell E: too large ⇒ instability

The figure contrasts the smooth teal decay curve (heading gently to ) with the orange Euler points that leap . The plum annotation flags the culprit — a stability factor of size — and the orange zig-zag straddling the axis shows the tell-tale sign-flipping of an unstable run. When your numbers alternate sign and grow, this picture is what is happening.

Figure — ODE solvers — Euler's method (derivation, global error)

Example 6 — Cell F: autonomous non-linear


Example 7 — Cell G: real-world word problem


Example 8 — Cell H: exam twist (given the answer, find the input)


Recall Which cell was hardest — and why?

Cell E (instability). Every other cell only produces accuracy error, controlled by via the law. Cell E produces a qualitative failure: the numbers diverge from a truth that decays. The lesson: must satisfy both accuracy and stability constraints.


Quick self-test

Positive slope Euler estimate vs a convex true curve — above or below?
Below (tangents undercut a convex curve).
For , which keeps Euler stable?
Any with , i.e. .
What does a step with do to ?
Nothing — , a flat horizontal step.
Halving changes the global error by roughly what factor?
About (first-order, ).
Given and a known , how do you find ?
Solve the linear equation .

Connections

  • Parent topic — derivation & error law these examples exercise
  • Taylor Series Expansion — source of the local term each example inherits
  • Runge-Kutta Methods — would cut the errors seen above dramatically ()
  • Backward Euler & Implicit Methods — stays stable in Example 5 for any
  • Numerical Stability — the test used in Examples 2, 5, 7
  • Lipschitz Continuity — guarantees the error bound behind Example 3
  • Finite Difference Approximations — the forward-difference view of every step here

Case Map

positive

negative

zero

stable

too large

nonlinear

word problem

inverse

Euler update new = old + h times slope

sign of slope

Cell A growing undershoot

Cell B decaying

Cell D flat step y unchanged

size of h

accuracy error only order h

Cell E instability diverges

kind of f

Cell F y squared

Cell G cooling

Cell H solve for h