Mandelbrot set generator

Please wait ...

This web page draws a Mandelbrot set. This is an exercise in JavaScript - practising what I learned on the excellent Open University Web Applications Development course.

The Mandelbrot set is essentially a plot of the rate at which the function z -> z*z + c diverges for different values of c, where z and c are both complex numbers. z is initialised to zero for each point. The black areas are where the function converges and coloured areas are where it diverges.

The program won't work with Internet Explorer because it doesn't support the Canvas drawing functions that I use, but Firefox and Safari both work well.

After the initial Mandelbrot set appears then you can use your mouse to draw a square on the pattern. On pressing 'Redraw' the program draws a zoomed-in plot of the area in the square. The most interesting patterns can be found at the edges of the black area. You can zoom and redraw indefinitely.

Each theme is a JavaScript function that maps the divergence rate to colours in a different way. I need to devise some better themes as I'm not happy with the ones on offer here. Coding the themes has been the most difficult part of the exercise as I found it hard to devise algorithms that make the plot look nice.

Enter size of plot in pixels - recommended value between 100 and 500.

Enter maximum number of iterations of z = z*z + c when testing for divergence.
A high number gives a more accurate drawing but will take longer than a low number.


Choose a colouring theme.