Simulating Chaotic Dynamical Systems & N-Body Orbits with Runge-Kutta Methods
Deterministic physical systems can exhibit profound sensitivity to initial conditions—a property formally classified as mathematical chaos. From turbulent fluid convection and double pendulums to gravitational -body celestial mechanics, non-linear ordinary differential equations (ODEs) lack closed-form analytical solutions. This paper analyzes numerical discretization schemes, derives Fourth-Order Runge-Kutta (RK4) integrators, evaluates Hamiltonian energy conservation, and calculates Lyapunov horizons.
1. The Lorenz Attractor: Mathematical Formulation
In 1963, meteorologist Edward Lorenz derived a simplified system of three coupled non-linear ordinary differential equations modeling atmospheric thermal convection:
\frac{dx}{dt} &= \sigma (y - x) \\ \frac{dy}{dt} &= x (\rho - z) - y \\ \frac{dz}{dt} &= x y - \beta z \end{aligned}$$ With canonical parameters $\sigma = 10$, $\rho = 28$, $\beta = 8/3$. --- ## 2. Fourth-Order Runge-Kutta (RK4) Scheme To integrate $\frac{d\mathbf{y}}{dt} = \mathbf{f}(t, \mathbf{y})$ with step size $h$: $$\mathbf{y}_{n+1} = \mathbf{y}_n + \frac{h}{6}(k_1 + 2k_2 + 2k_3 + k_4)$$ Where: $$\begin{aligned} k_1 &= \mathbf{f}(t_n, \mathbf{y}_n) \\ k_2 &= \mathbf{f}\left(t_n + \frac{h}{2}, \mathbf{y}_n + \frac{h}{2}k_1\right) \\ k_3 &= \mathbf{f}\left(t_n + \frac{h}{2}, \mathbf{y}_n + \frac{h}{2}k_2\right) \\ k_4 &= \mathbf{f}(t_n + h, \mathbf{y}_n + h k_3) \end{aligned}$$ ```cpp Vector3D rk4_integrate_step(const Vector3D& s, double dt, double sigma, double rho, double beta) { Vector3D k1 = lorenz_derivatives(s, sigma, rho, beta); Vector3D k2 = lorenz_derivatives(s + k1 * (dt * 0.5), sigma, rho, beta); Vector3D k3 = lorenz_derivatives(s + k2 * (dt * 0.5), sigma, rho, beta); Vector3D k4 = lorenz_derivatives(s + k3 * dt, sigma, rho, beta); return s + (k1 + k2 * 2.0 + k3 * 2.0 + k4) * (dt / 6.0); } ``` --- ## 3. References & Academic Citations 1. **Lorenz, E. N. (1963).** *Deterministic Nonperiodic Flow.* Journal of the Atmospheric Sciences, 20(2), 130–141. 2. **Hairer, E., et al. (1993).** *Solving Ordinary Differential Equations I: Nonstiff Problems.* Springer-Verlag. 3. **Strogatz, S. H. (2018).** *Nonlinear Dynamics and Chaos.* CRC Press.