# Lorenz Attractor

> Edward Lorenz's model of convection, integrated live in 3D: the orbit never repeats, yet it stays on a butterfly-shaped attractor.

In 1963 the meteorologist Edward Lorenz reduced a model of convection in the atmosphere to three equations: $x' = \sigma(y - x)$, $y' = x(\rho - z) - y$, $z' = xy - \beta z$. With his values $\sigma = 10$, $\rho = 28$ and $\beta = 8/3$ the solutions never settle and never repeat, and two solutions that start very close together soon follow completely different paths. This sensitivity is the "butterfly effect", and the shape the solutions trace, two wings around two unstable centres, is the Lorenz attractor.

This document computes a solution step by step. The state is the list $S = [x, y, z]$. An action runs every 30 ms and takes one fourth-order Runge–Kutta step of size $h$: it evaluates the derivative $K_1$ at $S$, $K_2$ and $K_3$ at two midpoints, and $K_4$ at the end of the step, and moves $S$ to $S_n = S + \frac{h}{6}(K_1 + 2K_2 + 2K_3 + K_4)$. The action also appends each new state to the lists $P$, $Q$, $R$, which draw the last 600 states as a trail.

Edit $\rho$ to see other behaviours: below about $24$ the orbit, after some time, spirals into one of the two centres, and from about $24.74$ upward it stays on the chaotic attractor. The second action restarts from $(1, 1, 1)$ with an empty trail, so you can watch the orbit settle onto the attractor.

After a Desmos graph by Fabrice Neyret.

- [Open the interactive version](https://graph-paper.io/showcase/en/lorenz-attractor)
- [Learn more on Wikipedia](https://en.wikipedia.org/wiki/Lorenz_system)
