May 18, 2007

Limit set visualization

I finally got a free moment to return to programming some more of the visualizations from the Indra's Pearls book. An example image can be seen below.

limit set

Just four relatively simple functions are used to generate this image. The image is drawn on the complex plane (roughly the lower left corner is -30-30i and the upper right corner is 30+30i). The image drawn shows what happens when you take any number and plug it into one of the functions and then repeatedly plug the result into one of the functions. If you do that enough times, eventually the values will lie somewhere along the shape drawn in the picture. We call the shape drawn the limit set of the functions.

The four functions that define the image were not chosen at random. They must posses certain properties in order to product such a well ordered limit set. The functions used for this pictures were created using "grandma's recipe" in chapter eight of the book. (Specifically using a trace for a and b of 1.91+.05i and the trace ab value from the quadratic equation where the minus sign is in front of the square root.)

This image required over 30 million points to be calculated and plotted. Even on a speedy computer, this takes a while. I was able to use some of the multi-threading techniques found in Advanced Mac OS X Programming to prevent the UI from locking up. Debugging multi-threaded apps is not fun especially when XCode likes to dump you into assembly code with little indication as to what error has occurred. Nevertheless, i did finally get it to work as i intended.

There are still some improvements i would like to make. The above image tooke just over 20 minutes to draw. Currently i only have one worker thread and i could see some improvement if i could make at least one more. The Advanced Mac OS X Programming book also has information in using distributed objects to have two machines doing work on the same data at the same time. It would be nice if both my laptop and desktop could share the work of drawing the image.

Posted by Matthew at May 18, 2007 03:42 PM
Comments