After reading the wonderful Chaos (James Gleik), I was inspired to pick up a copy of The Computational Beauty of Nature (Gary Flake) and explore chaotic computation for myself! My tool of choice was Processing, a simplified yet powerful programming language built on Java.

I began this endeavor by exploring the Mandelbrot set with Zlata over the MIT Spark weekend. In the wee hours of Sunday morning, the first grainy images of the Mandelbrot set came into view. Uplifted by this success, we toiled tirelessly to create a full color, zoomable, and downright *awesome* fractal generator.

## View Demo

Adding color was one of the toughest challenges we encountered. The standard RGB color notation is great for most purposes, but it really does fall short for generating the *spectrum*. In order to more easily generate a smooth color spectrum, we switched the project to HSL color and were able to simply scale the “H” (hue) property with each point’s iteration count.

Another interesting problem which still exists as a “bug” in the demo applet above is the lower limit imposed by the floating point datatype. As you zoom in farther and farther, the coordinates shrink down to absurdly small and precise values. Eventually, the measly floating point becomes imprecise, and the display seems pixelated. An easy fix would be switching all datatypes to doubles or bignums, but that would just take too much effort. It works!

Next I tackled the Lorenz Attractor. One of many such “strange attractors” that visualize the changes in a dynamic system by plotting the system’s state in “system space.” In the case of the Lorenz Attractor, fluid convection is represented in 3-space by the following set of equations:

`From hypertextbook.com:`

dx/dt = σ(y − x)

dy/dt = ρx − y − xz

dz/dt = xy − βz

As stated above, “x” is the convective flow, “y” is the horizontal temperature distribution, and “z” is the vertical temperature distribution of the system. Curiously, the orbit of point (x,y,z) over time will not “settle down” or form a repetitious cycle given certain critical values for σ, ρ, and β. Instead, the orbit forms a magnificent, infinitely complex object known as a strange attractor.