The article that spawned a life-long interest in the Mandelbrot Set and Chaos Theory in general:
Been trying to replicate that cover art ever since first seeing it — some of the images to the left are from the same region of the set.
The Algorithm
- Calculate one complex number c that is assumed to represent the pixel:
- add n × gap to acorner to obtain the real part ac of c;
- add m X gap to bcorner to obtain the imaginary part bc of c.
- Set a complex variable z (which has parts az and bz) equal to 0 + Oi.
Set an integer variable called count equal to O. - Carry out the following three steps repeatedly, until either the size of z exceeds 2
or the size of count exceeds 1,000, whichever comes first:
- z ← z
+ c - count ← count + 1
- size ← size of z
- z ← z
- Assign a color to pic(m, n) according to the value reached by count at the end of step 3. Display the color of the corresponding pixel on the screen.
The second serious program I recall writing was one to calculate and display the Mandelbrot Set. After reading the cover story in the August 1985 Scientific American, I was immediately enthralled by the idea that a relatively simple equation could generate such intricate and eerily lifelike forms. I have been hooked on Chaos theory and fractal math ever since.
The first iteration of the program was written in the c programming language. Back then, my c-compiler was on two 5¼” floppy disks ☛, and the source code was on a third floppy. Oh, and the editor was on yet another floppy.
My computer had only a single floppy drive so the development cycle proceeded as follows:
- Insert the floppy with the editor on it, and enter the command to launch the editor.
- Insert the floppy with the source code files and edit them in the editor.
- Insert the first compiler floppy and begin compiling. This step involved several floppy "switches" — the compiler would chug along for a while then ask for the source disk, or the second compiler disk several times! The compile took about ten minutes! (Of course this was a big improvement from having to walk a stack of punch cards to the computer center...)
- Finally, it was time to run the program.
Back then, using DOS, the computer could not multitask — It could only run one program at a time. Also, RAM was measured in kilobytes, not gigabytes, and the Mandelbrot set program is very computationally intensive. So in order to get a decent image the computer would literally need to run for days on end: One day my cat sat on the keyboard destroying several hours of work!
For the next version of the program, it became necessary to learn assembly language in order to directly program the video adapter for the best images. Does anybody know assembler anymore?
These days none of this is necessary. But there was a certain discipline that one developed in that environment. When it takes ten minutes to compile something, you ensure that you have all your ducks in a row before you start the compile. Also, one developed a strong awareness of time/space considerations and an overall appreciation for elegant code which has been largely lost to newer generations of developers.
Images of Chaos
These are images generated by the most recent iteration of my ever-evolving program to calculate the Mandelbrot Set.
Learn More
- Benoit Mandelbrot
- James Gleick's, CHAOS, Making a New Science is a wonderful read: Highly recommended if you want to find out more about this fascinating subject.
- The Mandelbrot Set - The only video you need to see!
- DIY Fractals: Exploring the Mandelbrot Set on a Personal Computer
- Eck — Explore the Mandelbrot Set
- Using Web Workers
- The Chaos Game
So What Was Your First Serious Program??
The original Atari computer had four sound generators; so it could play a melody and a three part harmony simultaneously!!
I wrote code and meticulously transcribed sheet music into a my own digital format, so that the computer would play the songs!
As with Mandelbrot, I am still actively involved with creating music software which has evolved to use the MIDI standard, which lately is even becoming a reality in the browser with HTML5. So exciting!