Midpoint, Heun and Runge–Kutta Methods

Improve slope estimates and understand what the advertised order assumes.

Builds on Euler’s Method and Local Slopes

The bigger question: How do we trust a numerical trajectory?

On this page

The idea

Higher-order methods sample more than one slope in a step. Midpoint predicts the middle state and uses its slope. Heun averages the initial slope with a predicted endpoint slope. Both are second order for smooth problems; they are distinct algorithms despite sometimes producing the same value.

Visual guide

VISUAL GUIDEMore accurate slope sampling follows the decay
For y′ = −y with step h = 1/2, Euler multiplies by 0.5 per step while midpoint multiplies by 0.625. The exact curve is e⁻ᵗ. Midpoint is closer here, but both methods still require an accuracy and stability check.000.750.2751.50.552.250.82531.1ty
  • Exact e⁻ᵗ
  • Euler
  • Midpoint
For y′ = −y with step h = 1/2, Euler multiplies by 0.5 per step while midpoint multiplies by 0.625. The exact curve is e⁻ᵗ. Midpoint is closer here, but both methods still require an accuracy and stability check.

Method and assumptions

Midpoint uses k1=f(tn,yn)k_1=f(t_n,y_n), k2=f(tn+h/2,yn+hk1/2)k_2=f(t_n+h/2,y_n+hk_1/2) and yn+1=yn+hk2y_{n+1}=y_n+hk_2. Classical RK4 samples at the start, twice at the middle and at the end, then combines slopes with weights 1,2,2,11,2,2,1 divided by 66. Its global error is order h4h^4 under suitable smoothness and stability assumptions.

Worked example: midpoint decay

For y′=−yy'=-y, y0=1,h=1/2y_0=1,h=1/2, k1=−1k_1=-1 and the predicted midpoint state is 3/43/4. Thus k2=−3/4k_2=-3/4 and y1=5/8=0.625y_1=5/8=0.625, closer to e−1/2≈0.6065e^{-1/2}\approx0.6065 than Euler’s 0.50.5.

PAUSE & THINKA quick check, not a grade

Try it yourself.

Choose an answer and explain your reasoning to yourself. Use a hint if you get stuck.

For a smooth problem in its asymptotic error regime, halving h in a second-order method changes global error by roughly…

Hint 1 · Find a starting point

Global error behaves like C h² in that regime.

Hint 2 · Take the next step

Replace h by h/2 and square the factor.

Show the reasoning

Answer: A factor of 1/4

C(h/2)²=(1/4)Ch². Stability and regularity are still required.

Before moving on: what would make one of the other answers wrong? Saying why is part of understanding.

Worked example: RK4 on the same step

For the same decay equation, RK4’s amplification polynomial is 1−h+h2/2−h3/6+h4/241-h+h^2/2-h^3/6+h^4/24. At h=1/2h=1/2 this gives 0.60677080.6067708, close to the exact 0.60653070.6065307. The improvement costs four slope evaluations instead of one.

Interpreting the result

Higher order does not remove stability limits or repair discontinuous forcing automatically. Split a step at known discontinuities. Adaptive methods estimate local error and adjust steps, but the requested tolerance is not an unconditional bound on every global error.

Practice

  1. How does a second-order global error typically change when hh halves?
  2. How does a fourth-order error typically change?
  3. Why compare computational cost as well as step count?
Show worked solutions
  1. It falls by about a factor of 44 in the asymptotic regime.
  2. By about a factor of 1616 under the same assumptions.
  3. Different methods evaluate the right side different numbers of times per step.

Further study

MIT OpenCourseWare: Differential Equations provides a full university course with additional lectures and exercises.

MAKE IT YOURS

Pause before the next idea.

Can you explain how the visualization connects to this lesson’s goal? If a step still feels uncertain, put this lesson on your review list and try the check again another day.

Optional marks, not a grade. Saved in this browser only. Open notebook →