Julia and Mandelbrot Sets

An applet to explore the Mandelbrot set

David E. Joyce
Jan, 2003.



Explanation

This is an applet to explore the Mandelbrot set. For an explanation of the the Mandelbrot set and its associated Julia sets, see the Introduction.

If your web browser doesn't work well with this applet, you can try the Julia and Mandelbrot Set Explorer which does much of the same thing that this applet does.

Controls

Click to expand. Mostly what you want to do is click your mouse on the part of the image you want expanded. Each time you click on a point, the part of the image around that point will be expanded. Wait until the image is completely redrawn before clicking the mouse again.

Lift button. Press the lift button to lift the applet off the web page into its own resizable window. Once the image is in its own window, you can make it as large as your whole computer desktop or shrink it to almost nothing. Note that it takes more time to produce a large image than a small one. If you want to put the image back on the web page for some reason, you can press the return button.

Scale factor. Initially, the scale factor is set at 2.0, so that part of the image near where you click will expand by a factor of 2, both horizontally and vertically. If you want it to scale by a different factor, you can set the scale factor to something else with the bar labelled scale that appears to the left of the image. If you make the scale factor less than 1.0, then the image will contract instead of expanding.

Resolution. If you've expanded the image many times, then the boundary of the Mandelbrot set (the black region) is not very crisp. That's because the basic algorithm stops after a number of iterations, called here the resolution of the image. You can increase the resolution to get a better image, but then the algorithm takes more time. You'll have decide how much more to increase the resolution as you blow up the image.

Redraw button. If you change the color resolution, you can see the effect by pressing the redraw button. The same portion of the plane will be drawn in the new colors. The redraw button doesn't expand or contract the image. You may also find the redraw button useful if you change some of the other parameters.

Reset button. The reset button will reset all the parameters back to their initial values, and you'll get the original image that you started with.

Color wrap. The color of a pixel is determined by how many iterations are needed to determine if the pixel lies outside the Mandelbrot set. A low number gives red, a medium number gives orange, yellow, or green, on through the spectrum, with high numbers giving cyan, blue, and magenta. After expanding the image many times, you may find that you only see shades of blue and magenta. If you set the color wrap to 2, then the colors go through the spectrum twice, giving a more colorful image. You can set the color wrap as high as 10.

Plane. As explained on the page Alternate Parameter Planes, you can select other paramter planes besides the usual µ plane.

Escape. The criterion for stopping iteration depends on the shape of a region in the plane, called the escape region. It's initially a circle which gives nice smooth boundaries between the shades of color. For more interesting boundaries, select one of the other shapes—square, strip, or half-plane. (You can see the escape region if you contract the image enough.)

Pattern. Another way to make the image more interesting is to vary the pattern. There is no pattern to begin with (the 'plain' pattern). Try some of the alternatives to see what they look like. The combination of feathered pattern and square escape is a good one.

About the applet

I'm supplying this information for those interested in programming their own applets. If you're not interested in programming, then skip this section.

The applet is written in five parts. There's the applet itself, MandelbrotApplet, that includes components for the user interface (buttons and bars). It also includes a ColorPlane (actually, a MandelbrotColorPlane) which holds the Mandelbrot set, and a ColorPlaneWindow, which is a window on that ColorPlane that is displayed in the applet.

The MandelbrotColorPlane is a subclass of the ColorPlane class. Besides being a ColorPlane that can be displayed in a ColorPlaneWindow, the MandelbrotColorPlane includes code to compute what colors go into the ColorPlane.

The Complex class includes methods for computing with complex numbers. It's used by MandelbrotColorPlane.


Jan 2003
David E. Joyce  
Department of Mathematics and Computer Science
Clark University
Worcester, MA 01610

The address of this file is http://aleph0.clarku.edu/~djoyce/julia/MandelbrotApplet.html