Mandelbrot set

Mandelbrot set

In practical implementation is every point of equation iterately evaluated and at the time, when |zn| > 2, it's apparent, that equation will diverge for specific point (and in graphical viewin' this value n, for which point exceed this value, will convert to color). When overrun won't came after advanced election of iterations, point is figured out as part of Mandelbrot's set. Adjustment of this boundary affect final image. For too low value, some points will be mistakenly marked up as part of set, but high count of iterations will require longer evaluation time. It's possible to accelerate calculation by fast point's detection, which are apparent part of set, because they are into main parts - circle and cardioids.

In evaluation we will come out from formula z(n+1) = z(n)^2+c. To this part of formula z(n+1) we will feed x - real component and y - imaginary component. Then in z(n)^2 we will get from x number equal x*x-y*y and from y number equal 2*x*y. To variable c in formula we will feed variables a and b. Final formula after feed will seem like this: (x,y) = (x*x-y*y,2*x*y) + (a,b). This formula is used in

while((zz<300) && (Math.sqrt(x*x+y*y)<2)) { zz++; xx=x*x-y*y+a; y=2*x*y+b; x=xx; }

where we are tryin' to count variable zz, that will define, in which part of fractal we are a so which color point will be repainted. Following cycle

for(int s=1;s<600;s++) { b=i2; for(int z=1;z<600;z++) { . . . } }

assure whole area arrive, where we are repainting fractal and former cycle will assure color counting for every single point.

Graphic interface description and handling:

Handling is dual. Either by scrollbars or by mouse. General horizontal / vertical movement and zooming is handled by coefficients, that are feeded by variables a and b (movement) and by variable ds (zoomimg). There are descriptions for what purpouse is it, near every scrollbar. Movement is also able to use by mouse, so that we are holding left mouse button and synchronize moving. Zooming is implemented by right mouse button click. If we want previous largeness, then we are moving scrollbar. There are button new on the area, which we use to innovation of fractal position and zoom will be set to the default value at the same time with save of our filter and extension. Scrollbar with name "resolution" realize choice of resolution in which fractal will be repainted. Next for users, there are checkboxes, by which we are able to chose active color filter. Repainting of same color scale is assured by using of colors just from same part of color spectrum.


Applet mandelbrot. Author: Kunsky Július a Janis Pavol

Source code