A Mandelbrot Explorer Program

Download mandelbrot.exe, mandelbrot.txt, and mandelbrots.jpg to the same directory prior to running mandelbrot.exe.

About 30 years ago, Dr. Benoit Mandelbrot, a mathematician at IBM, conceived the following algorithm for drawing a fractal:

For irow = 0 to ypixels
    AY = ybot + irow * da
    For icol = 0 To xpixels
        AX = xleft + da * icol
        X = AX
        Y = AY
        For n = 0 To 255
            X2 = X * X
            Y2 = Y * Y
            If (X2 + Y2) > 4# Then Exit For
            XY = X * Y
            X = X2 - Y2 + AX
            Y = 2# * XY + AY
    Next n
    '(code for painting the pixel a color that is 
    ' functionally dependent on the value of n) 
  Next icol
Next irow

The above code is used for the generation of the Mandelbrot figure. Each pixel has a location X and Y. The "value" of that location is a complex number, X + jY. In a loop, we complex multiply the number by itself to get a new X and Y, with the original input number added to it. This process repeats until some upper limit is reached, or whenever the magnitude of the number exceeds 2.0. The number of times the loop is executed determines the value of the Mandelbrot figure for that pixel. Coloring the pixels according to their final n value from the loop, gives rise to the Mandelbrot figure, the complexity of which must be explored and seen to be appreciated.

The figure is symmetrical about the X axis. Its main body of stability (no limit on n) is cardioid shaped. Tangent to it in the minus X direction is a circle of stability. More negative in X is a line of stability extending out to X = -2.0. These main structures have all sorts of growths on them, and when highly magnified, can yield interesting pictures.

In principle, details can be seen at any magnification, but the highest useful magnification is limited by the mathematical precision of the computing program. If double precision numbers are used, the magnification limit may be as high as one trillion or more.

Mandelbrot.exe is a program designed for easy exploration of the Mandelbrot figure. Its window consists of the display screen, three windows which display screen center values of X and Y, and magnification. It also has a "Run Demos" button for running built-in figures.

When the program is first executed, the X , Y, and Magnification values are preset for an overall view of the Mandelbrot figure. To view this figure, click on the Magnification window and just key "Enter" when the Dialog Box for magnification appears.

Once the initial figure is plotted, the user has many options on further use of the program. Pushing "Run Demos" allows selection other figures. Most of them look best at the default magnification displayed on the pop-up screen. To select the default magnification, just click OK or press the "Enter" key without entering a number. Clicking on the magnification display allows replotting at a different magnification and/or at a different location, if a different location has been selected by either (1) clicking on the X and Y displays and entering new values, or (2) by clicking on the plot itself to select the region of interest.

Using a mouse click on the display screen is easiest way to explore. Plotting the initial figure at a magnification of 0.33 allows all of the Mandelbrot figure to be seen. From there, one can click on the region to be explored, and click on the magnification display to select a higher magnification. Computation of the new figure begins when the desired magnification is entered. Repeated use of the mouse and magnification selection process allows the user to go wherever the explorer wants at whatever magnification is desired. If a location and magnification result in a figure that one should want to revisit at some future time, it is necessary to write down the X, Y, and magnification numbers to enter manually later.

The "stability" of a pixel in the figure is determined by the number of iterations completed before the complex number becomes larger than 2. Complete stability and no stability are both colored white. White "bugs" and dots are stable regions. As stability becomes greater, the color progresses through the spectrum from red to violet.

To save a picture, press "Alt + PrintScrn", then open a graphics program, such as Paint, or MSWord and select Paste. Once the program window appears, you can edit it as you choose. Save the result as a jpg type file. 

This program was written and  contributed by Bob McClure. <Bobhelenmcclure at aol  dot com>