home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Big Blue Disk 24
/
bbd24.zip
/
MAND.TXT
< prev
next >
Wrap
Text File
|
1988-07-21
|
7KB
|
111 lines
|A╔═══════════╗══════════════════════════════════════════════════════╔═══════════╗
|A║ ^0Brainware |A║════════════════ ^1Mandelbrot Microscope |A═══════════════║ ^0Brainware |A║
|A╚═══════════╝══════════════════════════════════════════════════════╚═══════════╝
^Cby
^CGary Ellexson
In his August 1985 Scientic American computer recreations column, A. K.
Dewdney introduced the 'Mandelbrot set' to the general public. The boundary of
this set of points is an example of a 'fractal' -- that is, an object of
fractional dimension. The set is named for Benoit B. Mandelbrot, who has
developed the field of fractal geometry. The boundary turns out not to be a
one-dimensional curve on the complex plane, but not a two-dimensional area
either. Its dimension is somewhere between one and two -- fractional.
The following description gets a bit technical, so non-mathematicians may
want to skip it and just view the pretty pictures this program generates. If
you care to try and understand this description, note that it deals with complex
numbers; these are numbers consisting of a "real" part (that's a normal positive
or negative number, like -32 or 3.141592654) and an "imaginary" part (a multiple
of i, the square root of -1). Think of the number line you were taught in
elementary school, stretching from left to right, and imagine a second line
intersecting the first at right angles denoting the imaginary numbers; if you
take one real and one imaginary number, they provide x and y coordinates of a
point on the plane which represents a complex number. You can use the Advanced
Algebra Toolbox program on this issue to see how complex numbers can be
manipulated by algebraic operations.
To define the Mandelbrot set, suppose C is a complex number and Z starts as
complex zero. Begin a process that puts Z equal to Z * Z + C. Continue to
substitute each new Z into the formula to get a progression of Z's. The
Mandelbrot set is the set of points C such that the magnitude of Z stays finite
even after an infinite number of iterations of the process of squaring and
adding shown above. It turns out that if the size of Z is 2 or greater, then Z
will go to infinity. This makes it possible to plot an approximation of the
Mandelbrot set without having to execute an infinite number of iterations of
the process. The interesting part is not plotting the set itself, but rather
attempting to plot its fractal boundary. Some points near the boundary flee to
infinity much quicker than other points. If points are colored differently
depending on the speed that they go to infinity, intricate patterns result.
The program uses a 200 by 200 pixel area of the color graphic screen to
display points near the boundary of the Mandelbrot set in different colors
depending on their 'escape velocity'. The program does at most 128 iterations
of the process for each pixel. If the result exceeds 2 at some point before the
maximum number of iterations, the number of iterations determines the color of
the point. If the result of the process is less than 2 after 128 iterations of
the process, then the point is considered to be a Mandelbrot point and is
colored black.
When you run the program you will see the entire Mandelbrot set in black
surrounded by a colored halo. There is a menu that allows you to show
previously stored displays, to magnify a part of the current display making a
new display, to store the current display as a disk file, to change the color
contours, or to leave the program. If you choose to make a new display, you will
see a black square appear in the upper left corner of the display window. You
can use the cursor keys to move the square within the display. The '+' and '-'
keys will make the square larger or smaller. To make a new image, move the
square to a place in the display that you would like to magnify. You should
adjust the boundaries of the square so that only a small part of the Mandelbrot
set is included, since more Mandelbrot points make it take longer to generate
the image. When you hit the 'Enter' key the program will begin to make a new
display. If you enter the magnification step by accident or do not want to wait
until an entire image is generated, then you can cancel out of the process by
striking the escape key. This will return you to the main screen and its
options with the last complete image displayed.
Plotting can take up to three hours, depending on how close the area is to
the Mandelbrot set. Most cases won't be nearly so bad; however, you should
consider getting a snack or something, or leaving the program running all night
unattended. 286 and 386 machines will get much better speed, of course. Turbo
speed should be used if it is available. The program does use an application
specific plotting routine that is faster than Pascal's plot procedure, but to do
a screen requires several million basic arithmetic operations. This makes the
program intrinsically slow.
After the new display is completed, you are returned to the main screen and
its options of saving the new display, loading a display, changing the contour
or leaving the program. If you choose to save the image as a file, you should
enter the file name and optionally, the path of the new file at the prompt. The
file will require 40018 bytes so make sure you have room on the destination
disk. (There isn't any room on BIG BLUE DISK to save image files; use your own
disk.) The program will warn you if there is insufficient room to store the
image. It will without warning write over any file named the same as the file
you entered. The file contains a list of the number of iterations required for
each of the 40,000 pixels. These numbers are stored as bytes representing
pixels in rows of 200 starting at the top. The file also contains the real
numbers representing the complex coordinates of the upper left corner of the
display and the length of the side of the square covered by the display.
The option to change the contour of the image allows you to view the image
with contour lines at greater or lesser intervals. In this option you are
presented with a choice of five display looks. Choose the display look by
typing the number to its left. The image will change when you hit the key. You
return to the main menu from this option by means of the escape key.
After execution of any other option, you are automatically returned to the
main display and its menu. In the loading and saving options hitting the enter
key at the prompt will return you to the main menu if you decide not to load or
save a file.
If you find the subject of fractals interesting, or just like interesting
graphic images of this sort, you might wish to check out the 3D Fractal
Landscapes program on issue #13 of BIG BLUE DISK. That issue is available from
us for $9.95.
To run this program outside the BIG BLUE DISK menu, type ^1MAND^0.
DISK FILES THIS PROGRAM USES:
^FMAND.COM
^FPICTURE0.DOT