UNIHIVE

Study Hub UNIPORT MTH 492

MTH 492 · Numerical Methods

Runge-Kutta methods

The classical fourth-order Runge-Kutta method, a worked step, and step-size control.

Our notes

1 min read

The idea

Runge-Kutta (RK) methods take a weighted average of several slopes inside one step, to match the Taylor series of the true solution to higher order, without needing derivatives of f.

The classical RK4

  1. k₁ = f(xₙ, yₙ)
  2. k₂ = f(xₙ + h/2, yₙ + (h/2)k₁)
  3. k₃ = f(xₙ + h/2, yₙ + (h/2)k₂)
  4. k₄ = f(xₙ + h, yₙ + h k₃)
  5. yₙ₊₁ = yₙ + (h/6)(k₁ + 2k₂ + 2k₃ + k₄)

Local error O(h⁵), global error O(h⁴). It is the workhorse for smooth, non-stiff problems.

Worked example

y′ = x + y, y(0) = 1, h = 0.1 (exact y(0.1) = 1.1103418).

  1. k₁ = 0 + 1 = 1
  2. k₂ = f(0.05, 1 + 0.05 × 1) = 0.05 + 1.05 = 1.1
  3. k₃ = f(0.05, 1 + 0.05 × 1.1) = 0.05 + 1.055 = 1.105
  4. k₄ = f(0.1, 1 + 0.1 × 1.105) = 0.1 + 1.1105 = 1.2105
  5. y₁ = 1 + (0.1/6)(1 + 2.2 + 2.21 + 1.2105) = 1 + (0.1/6)(6.6205) = 1.1103417

Error: about 1.7 × 10⁻⁷, against 0.0103 for Euler.

Why it works (sketch)

Expanding k₂, k₃, k₄ in Taylor series about (xₙ, yₙ) and choosing the weights 1, 2, 2, 1 (over 6) makes the result agree with y(xₙ + h) up to the h⁴ term. Many other RK formulas exist (RK2 midpoint, Ralston, RK-Fehlberg); they differ in the weights.

Choosing the step: error estimation

  • Step doubling: do one step of 2h and two of h; the difference estimates the error (for RK4, error ≈ difference/15).
  • Embedded pairs (RK-Fehlberg 4(5), Dormand-Prince): two formulas of orders 4 and 5 sharing the same k values. Their difference estimates the error, and the step is enlarged or cut automatically. This is how library solvers (such as MATLAB's ode45 or SciPy's solve_ivp) work.

Multistep methods (for comparison)

Adams-Bashforth and Adams-Moulton use several past points instead of extra slopes: cheaper per step, but they need a starter (often RK4) and are harder to change step with.

Exams usually ask

  • Carry out one or two RK4 steps with full working.
  • Derive a second-order RK method.
  • Explain step-size control.

Common mistake

Using h instead of h/2 inside k₂ and k₃. They are evaluated at the midpoint.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All MTH 492 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.