Interactive Fractals
This is a game based on the fractals invented by Benoit Mandelbrot.
Extensive floating point computations are optimized using the Floating
Point Coprocessor inside the Intel processor. You can interactively
explore the rich and complex landscape of the Mandelbrot set with your
mouse. You can zoom-in and zoom-out at will, and also change the
coloring of the display. It is another tutorial on F#, and you get the complete
source code. It is distributed on a CD. Shipping is included.
Mandelbrot fractals are based on the iterative computation of a complex
number z=(x,y), starting at z0=(x0,y0):
(xn+1,yn+1) = (x0,y0) + (xn,yn)2
The real part is:
xn+1 = x0 + xn2 - yn2
The imaginary part is:
yn+1 = y0 + 2xn*yn
When (xn,yn) is outside of the circle of radius 2.0, it diverges quickly.
Iteration is stopped when (xn,yn) is outside this circle, or when it repeats
127 times. Each point (x,y) has a unique repeat code n between 0 and 127
associated with it. Assigning a color base on n of this point and plotting all
the points in color produces a Mandelbrot fractal.
The Interactive Fractals are intended to be a tutorial on F#, a FORTH
programming language system for Windows. F# is basically a 32-bit integer
FORTH system without any support to floating point numbers and floating
point functions. However, inside every PC, the Intel microprocessor
includes a Floating Point Unit (FPU), which is a wonderful math
coprocessor capable of performing most of the transcendental functions
with 80 bits of precision. In fact, the Intel FPU is actually a FORTH math
processor, since all the floating point operations are performed on a
floating point number stack.
Intel FPU is a classic FORTH math engine with 8 levels of parameter stack.
Minimizing stack level used in computation tends to optimize the
computation. The computation in this Interactive Fractals is is fully
optimized FPU machine instructions to produce the fractal images.
We you bring up the Interactive Fractals, you see the initial fractal in a
Canvas window as show below. Left clicking the mouse will allow you to
navigate through the rich and complex landscape of the Mandelbrot set.
Under the fractal is a line of buttons with texts, allowing you to zoom in or
zoom out, to select a number of fractal examples, and to change their
colors. Left chick on any of these buttons will actuate the corresponding
function. The buttons at the two ends are "Zoom In" and "Zoom Out". Left
click on them will cause the current display to be expanded or compressed
by a factor of 2. Left click on any point on the fractal will move this point to
the center of display. Subsequently left clicking the "Zoom In" or "Zoom
Out" buttons will expand or compress this fractal around this central point.


Offete Enterprises