Interactive Mandelbrot and Julia sets

I always had a fascination with fractal geometry, and with the Mandelbrot set and Julia sets in particular.

Recently, I decided to learn JavaScript, and this gave a nice opportunity for a little return to my old obsession.

Below is a small interactive demonstration of the Mandelbrot set and its relation to Julia sets for different values of c.

For a primer on the math, please visit Wikipedia: Mandelbrot set and Julia set.

The top graph shows the Mandelbrot set. Use shift+scroll for zooming in and out. Clicking a spot causes the lower graph to display the Julia set corresponding to that value of c. Clicking the lower graph draws the orbit starting at the clicked point.

I find that this gives a nice intuition about how Julia sets work. Note in particular how some Julia sets give rise to orbits which converge towards a fixed cycle instead of just a single point. The order of the cycle is associated with the bulb on the Mandelbrot set from which c was picked.