The Mandelbrot and Julia Sets Applet

Introduction

Below is a Java applet which plots Mandelbrot and Julia sets. The top half is used to plot the Mandelbrot Set for f(z) = z2 – L, while the bottom half is used to plot the Julia sets for values of L selected from the Mandelbrot set plotted in the top panel. Note that, as the mouse pointer hovers over the panels used to display the graphs, it changes to a crosshair, and the text underneath the panel changes to indicate the point in the complex number plane upon which the crosshair is centered. Also note that, the tighter the field of view, the greater the number of decimal points used in specifying the coordinates.

In order to see the applet, you will need to download the Java Runtime Environment.  The JavaDoc documentation for the classes used by this applet, the source code, and the individual .class files are all available within fractals.jar. If you download fractals.jar, you may also run this program as a standalone java application by executing fractals.jar. In Windows, this means double-clicking on its icon. When running from a command-line prompt, that means typing the following:


java -jar fractals.jar

This launches the MandelbrotApp.class file within fractals.jar. For an introduction
on using .jar files, please see Using JAR Files: The Basics on Oracle’s Java site.


Your browser does not recognize this applet.

Instructions

You can choose from one of several actions to be taken when clicking on a point within one of the panes:

  • Center: Center view on the point on which the mouse is clicked.
  • Zoom in: Zoom in, or narrow field of view, on the point on which the mouse is clicked, magnifying by the specified zoom factor.
  • Zoom out: Zoom out, or widen the field of view, on the point on which the mouse is clicked, multiplying the length of the square field viewed by the specified zoom factor.
  • Plot Corresponding Julia Set:
    For the Mandelbrot Set graph only, plot the Julia set, in the Julia Set section, with the value of L equal to the logical coordinates of the point on which the mouse is clicked in the Mandelbrot Set graph.

There are two numeric values that can be adjusted for each graph:

  • Zoom factor: This is the amount by which the scale of the graph is to be multiplied or dividend when zooming in or out.
  • # iterations: This is the maximum number of iterations of the function that will be performed on each point, using the escape time algorithm, before assuming that a point is in the set. See my main Mandelbrot and Julia Set page for a basic explanation of the algorithm. Along with this item, there is a check box for choosing whether or not to Auto-Adjust # iterations, such that the number of iterations automatically increases when zooming in, and decreases when zooming out, subject to minimum and maximum value constraints.

Note that nothing is plotted in the Julia set window until either it is clicked on, or a point within the Mandelbrot Set window is clicked on when the Plot Corresponding Julia Set mouse action option is selected. If a point is not selected from the Mandelbrot Set for use as the value of L for the Julia Set, any graphs shown in the Julia Set window are for the default value of L, or 0, resulting in a circle of radius 1 centered at zero. This is not a terribly interesting graph!

Possible Future Enhancements

I apologize for the large size of the applet, but it does need to be large to plot somewhat viewable figures. I welcome any feedback on additions to the program to get an idea of how to prioritize them. Please feel free to contact me with requests for enhancements to this program – if you are not familiar enough with Java to add them yourself! Some possible enhancements that I can think of right off the bat are as follows:

  • the ability to change the color scheme
  • the option to plot the x and y axes
  • the ability to save the graphs to .jpg files
  • the ability to manually enter values for L for the Julia Set graph
  • the option to show the two graphs side-by-side, rather than one above the other
    – I figured it was more natural to scroll down the page than across
  • the ability to pass the desired window size (length in pixels) as a parameter

With the shift from using PCs to smartphones to view web pages, most of which do not support running a Java applet, my next goal is to adapt this program to do the computations on the server side as a Spring MVC web application. Such an application should work across more platforms and not require downloading a Java runtime environment, even if one is available for the platform on which you are viewing this page. I may also change to plotting sets for z2 + L, which seems to be the more conventional form for these sets, rather than doing the subtraction of L as I have here.

One thought on “The Mandelbrot and Julia Sets Applet

Leave a Reply