Mathematics / Runge-Kutta Fourth-Order (RK4)
FREE TO EXPLORE
LABORATORY 32 · MATHEMATICS

Runge-Kutta Fourth-Order (RK4) lab report

A worked runge-kutta fourth-order (rk4) lab report with iteration data tables, logarithmic graphs, calculations, uncertainty and conclusions.

WORKED EXAMPLE · BENCHMARK OBSERVATIONS

A complete example laboratory report.

Simulated demonstration data.

This report illustrates formal numerical analysis, iteration tracking, and convergence rate extraction. Replace its observations with your own computational telemetry when preparing a practical submission.

Student: __________________Student ID: __________________Course: __________________Date: __________________Partner: __________________Instructor: __________________

1. Title and aim

Classical Fourth-Order Runge-Kutta (RK4) Integration & Convergence. Implement the classical four-stage Runge-Kutta (RK4) algorithm for nonlinear dynamical systems, analyze the Butcher tableau, evaluate the four intermediate slope evaluations k₁, k₂, k₃, k₄, and verify the fourth-order O(h⁴) global truncation error convergence.

2. Abstract

Six computational trials were executed across standardized inputs Step = 1.0 to Step = 6.0 for Classical Fourth-Order Runge-Kutta (RK4) Integration & Convergence. An ordinary least-squares regression yielded an empirical RK4 Convergence Order (α) of 4.000 order (difference from theoretical reference = 0.0000%). The empirical telemetry conclusively validates the theoretical model and complexity scaling with R² = 1.000000.

3. Apparatus and fixed settings

4. Theory and graph choice

The classical fourth-order Runge-Kutta method (RK4) is arguably the most celebrated and widely utilized algorithm in numerical ordinary differential equations. Developed at the turn of the twentieth century by German mathematicians Carl Runge and Wilhelm Kutta, the method achieved a major mathematical breakthrough: matching the accuracy of a fourth-order Taylor series expansion using four strategic function evaluations per step, completely bypassing the intractable analytical differentiation of nonlinear vector fields. RK4 occupies a unique mathematical sweet spot: below order 5, the number of required stages equals the order (s = p = 4), but the Butcher order barrier proves that order 5 requires 6 stages. In this laboratory, we implement the classical RK4 algorithm, analyze intermediate stage slopes, examine the Butcher tableau, and verify fourth-order O(h⁴) convergence.

ln(E_max) = α · ln(h) + ln(C)

The mathematical regression linearizes the relationship into the form y = mx + b. Here, the independent variable x represents Logarithmic Time Step ln(h), and the dependent variable y represents Logarithmic Global Error ln(E_max). The slope m directly extracts RK4 Convergence Order (α), while the intercept b accounts for residual baseline offsets.

5. Method

  1. Set up dy/dt = y cos(t) with y(0) = 1.0 on t ∈ [0, π], verifying the exact solution y(t) = exp(sin(t)).
  2. Assign step sizes h = 0.20 / 2^{k-1} across refinement levels k = 1 to 6 (h ∈ [0.20, 0.10, 0.05, 0.025, 0.0125, 0.00625]).
  3. At each time step, compute initial slope k₁, two midpoint trial slopes k₂ and k₃, and endpoint trial slope k₄.
  4. Advance state vector via y_{n+1} = y_n + (h/6) [k₁ + 2k₂ + 2k₃ + k₄] and update time t_{n+1} = t_n + h.
  5. Sample trajectory across all time nodes and record maximum absolute error E_max = ||y(t_n) - y_n||_∞.
  6. Plot ln(E_max) versus ln(h) and compute the linear regression gradient to confirm α = 4.000 with R² = 1.000000.

6. Observations and calculation table

All iterative observations use strictly controlled 64-bit IEEE 754 precision buffers. Residuals are computed relative to the ordinary least-squares regression line.

Table 1. Six simulated observations; x and y represent transformed mathematical metrics.
No.Time Step Setting (k) (step)RK4 Global Error ||y - y_num||_∞ (error)Logarithmic Time Step ln(h)Logarithmic Global Error ln(E_max)Fitted yResidual
11.00.000357-1.6094-7.9376-7.93760.0000
22.02.2e-05-2.3026-10.7104-10.71040.0000
33.01e-06-2.9957-13.4828-13.48280.0000
44.00.0-3.6889-16.2556-16.25560.0000
55.00.0-4.3820-19.0280-19.02800.0000
66.00.0-5.0752-21.8008-21.80080.0000

Download the sample observations (CSV) ↓

7. Worked calculation for one observation

For step k = 1.0: Logarithmic mesh coordinate x = ln(h) = -1.6094. Logarithmic error y = ln(E) = α · ln(h) + ln(C) = -7.9376. Empirical error: 0.000357.

8. Graph, gradient and final calculation

-23.88-5.49-19.37-4.42-14.87-3.34-10.36-2.27-5.86-1.19Logarithmic Time Step ln(h)Logarithmic Global Error ln(E_max)

Circular markers represent empirical computational observations. The solid line represents the ordinary least-squares linear fit.

x̄ = -3.34230; ȳ = -14.86920
Σ(x − x̄)² = 8.40810
Σ(x − x̄)(y − ȳ) = 33.63240
m = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)² = 4.00000000
b = ȳ − mx̄ = -1.50000000
ln(E) = 4.0000 · ln(h) + -1.5000 ⟹ α = 4.000 (theoretical α = 4.0)

9. Uncertainty and comparison

Percentage difference = |estimate − theoretical value| / |theoretical value| × 100 = 0.0000%.

For n = 6 observations, Σresidual² = 0.00000; s² = Σresidual²/(n − 2). Gradient standard error = √[s²/Σ(x − x̄)²] = 0.00000. Intercept standard error = √[s²(1/n + x̄²/Σ(x − x̄)²)] = 0.00000.

Propagating the fit parameters yields a fit standard error of 1.0000e-04 order, with an ideal coefficient of determination R² = 1.000000.

In computational mathematics and numerical analysis, errors arise from algorithmic discretization, finite precision IEEE 754 floating-point arithmetic (machine epsilon ε_mach ≈ 2.22 × 10⁻¹⁶ for 64-bit double precision), and condition number propagation. The ordinary least-squares fit across n = 6 standardized observations provides standard errors for the gradient and intercept. Because the mathematical recurrence is evaluated with high numerical precision, the residual sum of squares is vanishingly small, yielding a coefficient of determination R² ≥ 0.999999 and confirming the theoretical mathematical model.

10. Result and discussion

RK4 Convergence Order (α) = 4.000 order
Theoretical reference value: 4.000 order

The empirical benchmark observations provide rigorous quantitative verification of Classical Fourth-Order Runge-Kutta (RK4) Integration & Convergence. In numerical analysis, scientific computing, and computational mathematics, algorithms are characterized by their asymptotic operational scaling, stability, and convergence rates. Across all six observations, the empirical slope m = 4.0000 confirms the theoretical model with near-zero residual variance. Furthermore, comparison with alternative algorithmic paradigms underscores critical trade-offs between memory footprint, condition number sensitivity, and operational throughput. The algorithm's behavior confirms the mathematical predictions established by numerical analysis literature.

11. Precautions and limitations

RK4 is an explicit algorithm: on stiff problems with rapid decay modes, it requires impractically small time steps to maintain stability. The simulation executes classical RK4 for time steps h = 0.20 / 2^{k-1} on the nonlinear test IVP y' = y cos(t). The maximum trajectory error is measured against the exact analytic solution exp(sin(t)). The logarithmic regression ln(E) = α·ln(h) + ln(C) extracts the asymptotic order α = 4.000 with R² = 1.000000.

12. Conclusion

This computational laboratory investigation quantitatively verified the mathematical formulation and asymptotic scaling of Classical Fourth-Order Runge-Kutta (RK4) Integration & Convergence. Through rigorous tracking across six observation points, we confirmed an empirical RK4 Convergence Order (α) of 4.000 order matching the theoretical reference 4.000 order within 0.0000% error. The investigation demonstrates why this method serves as an indispensable tool in modern computational science.