Mathematical Rules of Thumb, illustrated reader · Chapter 22

22Ordinary Differential Equations

Choosing and Checking Time Integrators

5 demonstrations follow the chapter's rules. Choose a value, watch the figure and the numbers change, and check your prediction. Every choice is precomputed from the notebook calculations.

Ask the chapter skill

“Help me use Chapter 22 for my question. Choose a rule, check its assumptions, and show how the result changes when an input changes.”

Use math-thumb-ode from the companion's skill package. The demonstrations below also work on their own.

Examples use constructed inputs or the book's own values, disclosed in each panel. A picture illustrates a rule; its assumptions set its scope.

1Demonstration 1 of 5

Solve a decay problem and watch the stability limit

Is a stable sign-changing trajectory an accurate decay solution?

Compare a computed trajectory with exact exponential decay, including an unstable step.

y′=−10y,yn+1=(1−10h)yn y\prime=-10y,\quad y_{n+1}=(1-10h)y_n

Euler step h (s). Initial y=1; explicit Euler; normalized decay rate 10/s. Stability alone does not establish accuracy.

Predict first. Is a stable sign-changing trajectory an accurate decay solution?

Choose an example

Solve a decay problem and watch the stability limit. Euler multiplies the state by -0.5 per step. The factor is negative, so the stable trajectory oscillates in sign; stability does not guarantee accuracy.
Euler step h (s): 0.15
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Step (s)
0.15
Amplification factor
-0.5
Stable (|factor| ≤ 1)
True
Last simulated time
1.05
Last absolute error
0.00784004

Euler multiplies the state by -0.5 per step. The factor is negative, so the stable trajectory oscillates in sign; stability does not guarantee accuracy.

Use the idea

Use rule 22.3.1 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

Initial y=1; explicit Euler; normalized decay rate 10/s. Stability alone does not establish accuracy.

Check your understanding: Is a stable sign-changing trajectory an accurate decay solution?
Not necessarily. Stability bounds amplification, while the exact solution stays positive and smooth.

Book source: Rule 22.3.1: Check explicit Euler against the stability disk. Demonstration C22-D01. Worked illustration.

2Demonstration 2 of 5

Verify RK4 by step halving

What error reduction does fourth order predict?

Run the RK4 update to a common endpoint and measure error against the exact solution.

y′=−y,y(1)=e−1,E(h)=O(h4) y\prime=-y,\quad y(1)=e^{-1},\quad E(h)=O(h^4)

RK4 step h. Smooth scalar decay, exact common endpoint, floating-point accuracy limits at very fine steps.

Predict first. What error reduction does fourth order predict?

Choose an example

Verify RK4 by step halving. These trajectories solve y′=−y, y(0)=1 to t=1. Halving h approaches a factor-of-sixteen global error reduction. Roundoff eventually limits such a trend.
RK4 step h: 0.125
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Selected step
0.125
Endpoint absolute error
8.30751e-07
Coarser / selected error
17.7649

These trajectories solve y′=−y, y(0)=1 to t=1. Halving h approaches a factor-of-sixteen global error reduction. Roundoff eventually limits such a trend.

Use the idea

Use rule 22.3.2 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

Smooth scalar decay, exact common endpoint, floating-point accuracy limits at very fine steps.

Check your understanding: What error reduction does fourth order predict?
A factor approaching sixteen when h is halved in the asymptotic regime.

Book source: Rule 22.3.2: Expect RK4 global error to fall by sixteen on step halving. Demonstration C22-D02. Worked illustration.

3Demonstration 3 of 5

Check an oscillator through its energy

Does bounded energy error prove an accurate phase?

Compare explicit and symplectic Euler over forty time units. Energy drift exposes behavior not captured by a local residual.

q′=p,p′=−q,H=12(q2+p2) q\prime=p,\quad p\prime=-q,\quad H=\tfrac12(q^2+p^2)

Integrator step h. Normalized harmonic oscillator; symplectic Euler does not exactly preserve original energy or certify phase accuracy.

Predict first. Does bounded energy error prove an accurate phase?

Choose an example

Check an oscillator through its energy. The normalized oscillator q′=p, p′=−q has exact energy .5. Explicit Euler gains energy every step and ends at 26.76, about 54 times too much. Symplectic Euler stays within 0.026 of .5. That bounded error is why long orbit and molecule runs use symplectic methods. It still does not prove the timing (phase) is right.
Integrator step h: 0.1
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Step
0.1
Explicit final energy
26.7621
Symplectic final energy
0.526307

The normalized oscillator q′=p, p′=−q has exact energy .5. Explicit Euler gains energy every step and ends at 26.76, about 54 times too much. Symplectic Euler stays within 0.026 of .5. That bounded error is why long orbit and molecule runs use symplectic methods. It still does not prove the timing (phase) is right.

Use the idea

Use rule 22.1.3 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

Normalized harmonic oscillator; symplectic Euler does not exactly preserve original energy or certify phase accuracy.

Check your understanding: Does bounded energy error prove an accurate phase?
No. An integrator can track energy while accumulating a significant timing or phase error.

Book source: Rule 22.1.3: Use symplectic integrators for long Hamiltonian trajectories. Demonstration C22-D03. Worked illustration.

4Demonstration 4 of 5

Watch stiffness force tiny explicit steps

Why does explicit Euler blow up at λ=1000 when the solution is smooth?

The true solution just follows cos t, yet explicit Euler fails as λ grows. Implicit Euler takes the same step safely.

y′=−λ(y−cos⁡t),h<2/λfor explicit Euler y\prime=-\lambda(y-\cos t),\quad h<2/\lambda\ \text{for explicit Euler}

Decay rate λ (1/s). y(0)=0, step h=0.025 s, t from 0 to 2 s. Explicit curve clipped at ±3 for display.

Predict first. Why does explicit Euler blow up at λ=1000 when the solution is smooth?

Choose an example

Watch stiffness force tiny explicit steps. The solution just follows cos t, which a step of 0.025 s resolves easily. Explicit Euler, though, needs h below 2/λ=0.0333 s to stay stable. At λ=60 the step is stable but the factor -0.5 is negative, so explicit Euler overshoots and zigzags around the true curve for the first few steps, until repeated factors of −0.5 die out; implicit Euler does not.
Decay rate λ (1/s): 60
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Decay rate λ (1/s)
60
Step h (s)
0.025
Explicit factor 1−hλ
-0.5
Explicit stable step limit 2/λ (s)
0.0333333
Explicit steps needed on [0,2]
60
Explicit max error
0.723242
Implicit max error
0.176946

The solution just follows cos t, which a step of 0.025 s resolves easily. Explicit Euler, though, needs h below 2/λ=0.0333 s to stay stable. At λ=60 the step is stable but the factor -0.5 is negative, so explicit Euler overshoots and zigzags around the true curve for the first few steps, until repeated factors of −0.5 die out; implicit Euler does not.

Use the idea

Use rule 22.1.1 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

y(0)=0, step h=0.025 s, t from 0 to 2 s. Explicit curve clipped at ±3 for display.

Check your understanding: Why does explicit Euler blow up at λ=1000 when the solution is smooth?
Its stability limit is h<2/λ=0.002 s. Stability, not accuracy, forces about a thousand steps.

Book source: Rule 22.1.1: Suspect stiffness when stability, not accuracy, dictates tiny steps. Demonstration C22-D04. Worked illustration.

5Demonstration 5 of 5

Count steps per period before trusting an oscillation

RK4 is fourth order. Is 4 steps per period enough?

Integrate q′=p, p′=−q with RK4 for ten periods and look at the last two. Too few steps per period lose amplitude and timing.

h≲TminNp,Np≈10 to 20 h\lesssim\frac{T_{min}}{N_p},\quad N_p\approx10\text{ to }20

RK4 steps per period. Harmonic oscillator, period 2π, q(0)=1, p(0)=0; fixed step RK4.

Predict first. RK4 is fourth order. Is 4 steps per period enough?

Choose an example

Count steps per period before trusting an oscillation. With 10 steps per period, after 10 periods RK4 keeps 96.02% of the amplitude and is 4.03° off in phase. That is usable for a few periods, but the errors grow every cycle, so long runs need more steps. Count steps per shortest period before trusting any oscillation.
RK4 steps per period: 10
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Steps per period
10
Step h
0.628319
Amplitude after 10 periods
0.960178
Amplitude loss (%)
3.98218
Phase error after 10 periods (degrees)
-4.03473

With 10 steps per period, after 10 periods RK4 keeps 96.02% of the amplitude and is 4.03° off in phase. That is usable for a few periods, but the errors grow every cycle, so long runs need more steps. Count steps per shortest period before trusting any oscillation.

Use the idea

Use rule 22.1.5 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

Harmonic oscillator, period 2π, q(0)=1, p(0)=0; fixed step RK4.

Check your understanding: RK4 is fourth order. Is 4 steps per period enough?
No. After ten periods it keeps only about 4% of the amplitude. Order only helps once the step resolves the motion.

Book source: Rule 22.1.5: Resolve oscillations with several steps per shortest period. Demonstration C22-D05. Worked illustration.

Bring the idea to a question of your own

Choose the relationship that answers your question, check its conditions, and compare the result with the accuracy or decision threshold you need.

The chapter skill can adapt these calculations to your inputs. It should name the assumptions, explain what the result supports, and say what still needs evidence. The chapter workbook adds a lab and three exercises with answers.