Visualizing chaos

 Visualization, Math

Some time ago, I came across an animation that beautifully showed how chaotic systems diverge because of slight differences in initial conditions. Here is the original visualization:

Note: The animation appears to be from reddit, but I discovered
it through this blog post by Jake VanderPlas.

It is so satisfying! Now, obviously, I wanted to replicate it using another chaotic system: A Lorenz attractor.

Lorenz equations

To replicate the idea of the animation, all the attractors are going to be defined by the same three differential equations. The equations will describe the movement through time of the variables , , and , given some parameters , , and : \[ \begin{align} \frac{dx}{dt} &= \sigma(y - x)\\
\frac{dy}{dt} &= x(\rho - z) - y\\
\frac{dz}{dt} &= xy - \beta z \end{align} \] For my animation, I will use , , and .

The only difference between the attractors is going to be a slight perturbation in their initial conditions (I will refer to the initial conditions as , , and ).
Arbitrarily, for each attractor, I will increasingly move their coordinates by : \[ \begin{align} \text{System 0: }& x_0, y_0, z_0\\
\text{System 1: }& x_0 + \epsilon, y_0 + \epsilon, z_0 + \epsilon\\
\text{System 2: }& x_0 + 2\epsilon, y_0 + 2\epsilon, z_0 + 2\epsilon\\
\text{System n: }& x_0 + n\epsilon, y_0 + n\epsilon, z_0 + n\epsilon\\
\end{align} \]

In my case, I will be using .


Here is the final product of the equations. Surprisingly (or unsurprisingly?), the beginning of the animation looks extremely similar to the pendulum visualization.
Has it already diverged? Click anywhere to begin a new animation.


You can find all the code here .
You can also play with the code directly on a web editor: Visualizing chaos.