Jun 19, 2020

3D Lorenz attractor fun on a Friday





I got bored this afternoon. I had been reading two books lately: Ubiquity (how catastrophes happen) and Chaos, a book on the history of the topic.  I was 2/3 through the latter and I was curious if I could pull off a self-rolled version of some of the theory. In this case I picked one of the earliest examples, a Lorenz attractor. This was originally designed to model atmospheric convection.  The point turned out to be that chaotic processes can come from deterministic models and that initial conditions matter (butterfly effect). Here is the intro in Wikipedia:

The Lorenz system is a system of ordinary differential equations first studied by Edward Lorenz. It is notable for having chaotic solutions for certain parameter values and initial conditions. In particular, the Lorenz attractor is a set of chaotic solutions of the Lorenz system. In popular media the 'butterfly effect' stems from the real-world implications of the Lorenz attractor, i.e. that in any physical system, in the absence of perfect knowledge of the initial conditions (even the minuscule disturbance of the air due to a butterfly flapping its wings), our ability to predict its future course will always fail. This underscores that physical systems can be completely deterministic and yet still be inherently unpredictable even in the absence of quantum effects. The shape of the Lorenz attractor itself, when plotted graphically, may also be seen to resemble a butterfly. 
I have no doubt that retirement finance is a type of chaotic system but who knows? Actually Dirk Cotton knows; he's covered this before.  So, I probably won't go too far down this path. This was just play. On the other hand I've been tuned into chaotic system ideas and can now, I think, code basic differential equations of this type (the program is very very short, which is the point. A three dimensional interdependency of motion kicks out some wild stuff even when it's simple). So, a tool in the tool belt.  We'll see.

Basic R console
plot3D
a few lines of code
a starter set of parameters

I stopped the video where I did because it got trapped in the center of the 2nd attractor. It breaks out but video file sizes get big...  It keeps going and takes on the expected shape.

Postscript...

Here is 10,000 steps in time for the attractor process. If you can see it, the last 1000 steps are in red.





No comments:

Post a Comment