The full Manim animation (73.6 s). It shows the Lorenz equations, then two trajectories that start 10⁻⁵ apart. A rotating camera follows them until they end up on opposite lobes of the attractor.

Lorenz Attractor in Manim

Numerical learning exercise

My first Manim animation. I made it to see deterministic chaos for myself. Two trajectories of the Lorenz system start \(10^{-5}\) apart and end up completely different, with LaTeX equations and a rotating 3-D camera. A companion Plotly Dash dashboard lets you change the parameters live.

Methods & tools
Python · Manim Community · fourth-order Runge–Kutta · Plotly Dash · MP4 export
Project breakdown

WhatSensitivity to initial conditions

The Lorenz system is the textbook example of deterministic chaos. It has three coupled equations and no randomness anywhere, but still no long-term predictability. Lorenz derived it in 1963 as a drastically truncated model of convection. For anyone who works with turbulent flows, it is the simplest place to watch a fully deterministic flow forget where it started.

\[\dot x=\sigma(y-x),\qquad \dot y=x(\rho-z)-y,\qquad \dot z=xy-\beta z\]

The classic parameters are \(\sigma=10,\ \rho=28,\ \beta=8/3\). Here \(x\) is roughly the strength of the convective roll, and \(y\) and \(z\) are the horizontal and vertical temperature variations.

HowTwo trajectories, one tiny difference

I integrated both trajectories with fourth-order Runge–Kutta, from initial states that differ only by \(\Delta x_0=10^{-5}\) (cyan and orange in the animation). Manim renders the equations, then follows both curves with a rotating camera and a running clock. You see the moment when they separate.

The largest Lyapunov exponent sets how fast they separate. Small separations grow exponentially until they reach the size of the attractor itself.

\[\lVert\delta\mathbf x(t)\rVert\approx\lVert\delta\mathbf x_0\rVert\,e^{\lambda_1 t},\qquad \lambda_1\approx0.9,\qquad t_{\mathrm{sep}}\sim\frac{1}{\lambda_1}\ln\frac{L}{\lVert\delta\mathbf x_0\rVert}\]

With \(\lVert\delta\mathbf x_0\rVert=10^{-5}\) and an attractor size \(L\) of order 10, the two runs separate after roughly \(\ln(10^6)/0.9\approx15\) time units. Better integration does not change that by much.

ResultsPlaying with the parameters

Video 1 — Export from the companion Plotly Dash dashboard: the butterfly attractor traced in 3-D.

For the first part of the run, the two curves lie on top of each other. Then, quite suddenly, they separate and end up circling opposite lobes. The dashboard makes the other half of the story easy to explore. Below \(\rho\approx24.7\), trajectories settle onto a fixed point. Above it, the same equations produce the butterfly.