This page derives the general theory of explicit Runge-Kutta methods for solving initial value problems.
LaTeX Reference
This section corresponds to Section 6.1 of nm_final_project.tex.
The Problem¶
Given an initial value problem:
We seek a numerical approximation \(y_n \approx y(t_n)\) at discrete times.
Step 1: Euler's Method (First Order)¶
Derivation¶
Taylor expand \(y(t + h)\):
Truncating after the first derivative:
Properties¶
- Order: 1 (local error \(\mathcal{O}(h^2)\), global error \(\mathcal{O}(h)\))
- Stages: 1
- Evaluations per step: 1
Insufficient for Apogee
First-order methods require extremely small time steps for acceptable accuracy.
Step 2: General Runge-Kutta Form¶
Structure¶
An \(s\)-stage explicit RK method has the form:
Where the stages are:
Butcher Tableau¶
The coefficients are organized in a Butcher tableau:
Consistency Condition¶
For consistency, the node values must satisfy:
Step 3: Classical 4th Order RK¶
The "RK4" method:
Algorithm¶
Properties¶
- Order: 4
- Stages: 4
- Evaluations per step: 4
Step 4: Embedded Methods for Error Estimation¶
The Idea¶
Use two formulas of different orders:
- Higher order \(\hat{y}_{n+1}\) (order \(p\)) for stepping
- Lower order \(y_{n+1}\) (order \(p-1\)) for error estimate
The local error estimate:
Butcher Tableau with Embedding¶
Step 5: Tsitouras 5(4) Method¶
The Apogee simulator uses the Tsit5 method from Tsitouras (2011).
Properties¶
| Property | Value |
|---|---|
| Stages | 7 |
| Order (main) | 5 |
| Order (embedded) | 4 |
| FSAL | Yes |
| Evaluations | 6 per step |
FSAL (First Same As Last): The last stage evaluation can be reused as the first stage of the next step.
Why Tsit5?¶
- Efficiency: 6 evaluations for 5th order (optimal)
- Robust error estimate: Good step size control
- Well-tested: Standard in scientific computing
Implementation¶
import diffrax
solver = diffrax.Tsit5()
Order Conditions¶
For an RK method to achieve order \(p\), the coefficients must satisfy algebraic conditions derived from Taylor series matching.
Order 1¶
Order 2¶
Order 3¶
Higher Orders¶
Order 4 requires 4 conditions, order 5 requires 9, etc. The conditions become increasingly complex.
Comparison of Methods¶
| Method | Order | Stages | Evaluations | Use Case |
|---|---|---|---|---|
| Euler | 1 | 1 | 1 | Toy problems |
| RK4 | 4 | 4 | 4 | Fixed step |
| Tsit5 | 5(4) | 7 | 6 | Adaptive |
| DP5 | 5(4) | 7 | 6 | Alternative to Tsit5 |
| RK8(7) | 8(7) | 13 | 13 | High accuracy |
References¶
-
Hairer, E., Nørsett, S.P., & Wanner, G. (1993). Solving Ordinary Differential Equations I: Nonstiff Problems. Springer. Chapter II - "Runge-Kutta and Extrapolation Methods".
-
Tsitouras, Ch. (2011). "Runge-Kutta pairs of order 5(4) satisfying only the first column simplifying assumption." Computers & Mathematics with Applications, 62, 770-775. DOI: 10.1016/j.camwa.2011.06.002
-
Butcher, J.C. (2016). Numerical Methods for Ordinary Differential Equations. Wiley. Chapter 3.
Next Steps¶
- Adaptive Stepping - Step size control
- Shooting Method - Where ODE solving is used