ComplextSets Demo

your browser does not suport HTML5 Canvas.

Window: screen width =
Window: screen height =
Window: oversampling =
View: zoom =
View: shift_x =
View: shift_y =
Algorithm: iterations =
Algorithm: mode = Julia set
= Mandelbrot set
Algorithm: constant real =
Algorithm: constant imaginary =

This is a demonstration of ComplextSets from the SciSimulations JavaScript library. You can download the latest release of SciSimulations or browse all releases.

Instructions

For precise adjustment of the fractal generated us the setting under neath the window. To change settings on the in real time use the mouse and keyboard. Pressing the spacebar redraws the fractal with the current settings applied. To pan the fractal around click and drag, to zoom in or out press the + or - keys or either the keyboard or numberpad. To enlarge a specific area hold down the shift key while left clicking and dragging in the window. When the fractal has rendered you can lighten or darken the render by pressing the L or D key.

Theory

Complex numbers are the main mathematical idea behind julia and mandelbrot sets. Normally the square root of a negative number is not defined, but if the variable i=√(-1) then the square root of any negative number is √(-n)=√(n)*i this new number is called an imaginary number. All of the imaginary numbers now create a new number line that only intersects the real number line at zero because √(-0)=√(0). These two number lines define a two dimensional plane in space call the complex plane, and any complex number can be written as C=a+b*i where a is the component along the real number line and b is the component along the imaginary number line. Julia sets are calculated using the following equation Zn+1=Zn2+C, where Zn is a complex variable and C is a complex constant. To generate a julia set a constant is chosen for C, this will determine the shape of the generaed set and an initial Z value Z0 is chosen. Then the value for Zn+1 is calculated and put back in the equation again as Zn. As the number of iterations approaches infinity the value z either diverges to infinity or converges to a point. If this method is applied to every point on a section of the imaginary plane and the points are colored either black or white depending on weather the point diverged or converged, then the result is an image of a julia set in the complex plane.

The method and equation for calculating the mandelbrot set is similar to that of the julia set. The equation of the mandelbrot set is the same but the variable and constants are chosen in by a different method. The variable Z0 is always equal to zero and the constant C is equal to a point on a grid in the complex plane. The relation between the julia sets and the mandelbrot set is that if you calculated the result of only the center point 0+0*i for all of julia sets where the constant C is within a section on the complex plane, and graphed those point by the position of the constant C, then the result is an image of the mandelbrot set.

Approximations

Each point on the mandelbrot and julia sets require infinite recursion, to get around this the program simply approximates the set after a given number of iterations, and if the variable Zn+1 is within a given radius of the convergence point then it is colored as a linear gradient based on the distance to that point. The convergence point on a julia set is one of the two points that do not change after applying this equation Zn+1=Zn since the point does not change lets just call it Z. When the equation is solved for Z, the result is Z=0.5√(0.25-C), of these two point one is the initial point and every other point on the plane can be traced back to it. The other one is the convergence point and every other point on the graph will either diverge to infinity or converge to that point. the Convergence point of any julia set is the point Z=0.5-√(0.25-C).