Skip to content
FoundationSource checked

Runge-Kutta Method

Approximates differential equations by sampling several slopes per step.

Quick Facts

Compact metadata for implementation and discovery.

Category
Simulation
Difficulty
Intermediate
Family
Numerical Integration
Tier
Foundation
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
4
Code example
Not ready
Visualization
Ready
Aliases
RK4

Overview

Runge-Kutta methods combine multiple derivative estimates to produce a more accurate state update.

Core Concepts

slope samplingweighted averagetime stepintegration accuracysimulated stateintegral approximationnumeric approximationnumerical integration

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(t)

Average

O(t)

Worst

O(t)

Space

O(1)

When to Use

  • Use it when ordinary differential equations need more accuracy than Euler integration.
  • Use fourth-order Runge-Kutta for a common balance of accuracy and cost.
  • Use adaptive variants when step size should respond to local error.

When Not to Use

  • Avoid fixed-step methods when the system has rapidly changing error behavior.
  • Avoid it when derivative evaluations are too expensive for the chosen order.
  • Avoid assuming higher order fixes a poor model or unstable time step.

What It Does

  • Samples slopes within a time step
  • Combines slope estimates into one update

Use Cases

  • Accurate physics simulation
  • Solving ordinary differential equations
  • Engineering models

Inputs

  • Current state
  • Derivative function
  • Time step

Outputs

  • Next state

Key Formulas (1)

RK4 update

ynext = y + dt · (k1 + 2·k2 + 2·k3 + k4) / 6
y_next = y + dt * (k1 + 2*k2 + 2*k3 + k4) / 6

Combines four slope estimates into one higher-accuracy step.

Pseudocode

  1. 1.Evaluate the derivative at the start of the step
  2. 2.Estimate intermediate states
  3. 3.Evaluate derivatives at those intermediate states
  4. 4.Combine the derivative estimates with weights
  5. 5.Update the state

Canonical Example

Input
dy/dt = y, y(0) = 1, step from t = 0 to t = 0.1
Output
an approximation near e^0.1
Explanation
A fourth-order Runge-Kutta step combines several slope estimates across the interval.

Implementation Notes

  • Keep each intermediate state separate from the original state until the final weighted update.
  • Document the specific Runge-Kutta tableau or formula being implemented.
  • Test on differential equations with known analytical solutions.

Common Pitfalls

  • Combining intermediate slopes with the wrong weights.
  • Updating the state before all intermediate derivative estimates are computed.
  • Using a fixed step size without checking error on difficult systems.

Interactive Mechanism Walkthrough

Iterative Convergence & State Trajectory

Show several slope samples combining into a curved step.

Runge-Kutta Method mechanism walkthrough step 1 of 5x₀x₁x₂x*
Step 1 of 5: Evaluate the derivative at the start of the step
multi-slope-step

Notes

Runge-Kutta names a family of methods; order, step-size policy, and coefficients define the specific algorithm.

Sources (1)

What each reference supports for this entry.

Numerical Recipes

Book

Numerical methods reference covering Runge-Kutta methods for ordinary differential equations.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Alternative toEuler Integration

Runge-Kutta methods use multiple derivative estimates for higher accuracy.

Runge-Kutta-Fehlberg is an adaptive Runge-Kutta method.

Tags

SimulationNumerical IntegrationNumerical Methods