Eric Weeks
- personal pages - softwareMANDEL.CSource code for the simplest C & BASIC programs to do the Mandelbrot set |
weeks@physics.emory.edu |
This program creates PPM output. For example, the way to use the program is:
mandel > picture.ppm
Click here for information about making PPM-format pictures.
NEW! Click here to download mandel.bas, a quickbasic program I wrote to make a Mandelbrot set.
What is the Mandelbrot set? You can find a better explanation almost anywhere else on the web, so I'll keep it short. Z and C are complex numbers. Iterate Z' = Z^2 + C for a while. If Z gets large, C's not in the set. If Z stays small, C is in the set. Graph in the complex plane the values of C for which Z stays small.
WHY DID I WRITE THIS PROGRAM? Well, you can get better versions of this program anywhere. I recommend "fractint" as a good universal fractal generator program; it runs on PC's and is public domain. I wrote my program to provide the simplest possible source code that does the Mandelbrot set, partially for amusement. I suppose a simpler version would be to write it in awk, or QuickBASIC. The first Mandelbrot program I wrote was in Applesoft BASIC, in fact.
But mainly why I wrote this program was that I found it amusing that a graduate-level class in the physics department once assigned this for homework ("Make the Mandelbrot set"). I wasn't taking this class, I just thought it was a funny homework assignment. It was really intended to get the students to write a program, and this sort of program is as good as any other.
I should point out that while I say on my software page this is the world's simplest Mandelbrot Set program, I'm not actually trying to compete for this, so I don't mind if you write a simpler version, or if many simpler versions exist. If you've got a simpler version, let me know and I'll put in a link to your web page.