Ever since I read James Gleick’s “Chaos: Making a New Science,”^{1} I have been obsessed with Lorenz attractors and chaotic systems in general. For a long time, I have wanted to find an excuse to visualize these behaviors extensively (there is such beauty in these systems!), but every time I kept just plotting a simple attractor, watching it for a couple of minutes, and moving to something else. However, some months ago, I came across the book “Sync: The Emerging Science of Spontaneous Order”^{2} by Steven Strogatz, and now I felt I had a great excuse!
I cannot introduce Lorenz equations without including this great quote to set the context.
One day in the winter of 1961, wanting to examine one sequence at greater length, Lorenz took a shortcut. Instead of starting the whole run over, he started midway through. To give the machine its initial conditions, he typed the numbers straight from the earlier printout. Then he walked down the hall to get away from the noise and drink a cup of coffee. When he returned an hour later, he saw something unexpected, something that planted the seed for a new science.
(Gleick, 1987, p. 16)
Unknowingly, Edward Lorenz had missed a few decimals when giving the inputs to the computer (caused by a mismatch between the precision of his computer and his printer). What he accidentally discovered was that, for the set of equations he was using, tiny changes in initial conditions lead to hugely different outcomes. He later worked with a simplified system with only three equations. This new system would also end up showing incredible sensitivity to initial conditions. The equations were just three first-order differential equations, which seem surprisingly simple given the fact that they display such complex and chaotic behavior. These findings were the starting point of modern chaos theory.
The equations 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}
\]
Using the parameters , , and , and plotting in the horizontal axis, in the vertical axis, and using as depth, we get our Lorenz attractor:
The behavior shown is truly chaotic. Even though the system is completely deterministic, without perfectly knowing the initial conditions, it is impossible to predict where the next point is going to be.
Here is what I found most interesting: Despite the untamed behavior of the attractors, we can easily synchronize two (or more) Lorenz attractors! Here is Steven Strogatz’s description of the process:
Take two copies of a chaotic system. Treat one as the driver; in applications to communications, it will function as the transmitter. The other system receives signals from the driver, but does not send any back. The communication is one-way. […] By analogy with the Lorenz equations, their names are , , and . Every night they perform onstage, playing off one another, each responding to the slightest cues of the other two. […] Now suppose that time stands still for a moment. The laws of the universe are suspended. In that terrifying instant, vanishes without a trace. In its place stands a new variable, called . It looks like but it is programmed to be oblivious to the local and . Instead, its behavior is determined remotely by its interplay with and , variables in a transmitter far away in another Lorenz system all part of an unseen driver. […] Soon all becomes right again. The , , trio glides in an utterly natural way, following through state space on the Lorenz attractor, the picture of chaotic grace. […] But what is so sinister here, and so eerie, is that and have now been turned into pods themselves. Unwittingly, they are now dancing in perfect sync with their own doppelgänger, and , variables they have never encountered.
(Strogatz, 2003, pp. 196-197)
Translating what the quote is describing into equations, we get:
We have one “receiver” system, composed of , , and :
\[
\begin{align}
\frac{dx}{dt} &= \sigma(y - x)\\
\frac{dy}{dt} &= x(\rho - z) - y\\
\frac{dz}{dt} &= xy - \beta z
\end{align}
\]
We have one “driver” system, composed of , , and :
\[
\begin{align}
\frac{dx’}{dt} &= \sigma(y’ - x’)\\
\frac{dy’}{dt} &= x’(\rho - z’) - y’\\
\frac{dz’}{dt} &= x’y’ - \beta z’
\end{align}
\]
In the first system, we replace with . We forget about entirely:
\[
\begin{align}
\frac{dy}{dt} &= x’(\rho - z) - y\\
\frac{dz}{dt} &= x’y - \beta z
\end{align}
\]
We keep updating , , and according to the second system (the “driver”), and , and according to the equations in point 3. The first system (the “receiver”) is now composed of , , and .
According to the quote, after a few iterations, we should see that the attractors start to synchronize. I wanted to visualize this by myself and play around with it, so I created a little script.
In the next demo, you can see two unsynchronized Lorenz attractors (the plot is showing on the horizontal axis and on the vertical axis). Just to show more easily the relationship between both, each new point generated in the first system (which is going to be the “driver”) is connected to the newest point generated in the second system (which is going to be the “receiver”).
When you click the demo, the script applies points 3 and 4 (from the list above). You will see that the line that joins them becomes vertical, showing that now governs . This makes the bottom attractor struggle to display its typical behavior (the classical “butterfly” shape), but after a few seconds, for each new point, starts to get closer to and starts to get closer to , until they are—in Steven Strogatz’s words—dancing in perfect sync with their own doppelgänger.
You can find all the code here .
You can also play with the code directly on a web editor: 3D attractor / Sync attractors.