MandelSwarm ( Requires Java )
created by JJ Ventrella (

Watch two thousand particles swarm towards the boundary of the
Mandelbrot Set. After they settle into place, notice how some particles
migrate out and launch themselves off of the tendrils of the Set.

(1) Click into the window to "Activate" it.
(2) Drag the mouse cursor to move particles around
(3) Use the arrow keys and the + and - keys to change the view
(4) Use the Enter key to reset the particles

Use the "Home" key (on the keypad) to reset to original view
Remember: after shifting or zooming, hit the ENTER key to
reset the particles, as many of them may have fallen out of view.
How Does it Work?
A particle system of 2000 bits is animated. Each particle, as it moves along, continually projects two rays: one slightly to the left, and the other slightly to the right of its direction of travel. The particle then asks itself which ray is aimed in a direction closer to the boundary of the Set. Whichever ray is the closest determines a force applied to the particle in that direction. This causes the particle to be continuously turning towards the boundary of the Set as it moves along.

The equation for the Mandelbrot Set tests the magnitude of Z, a complex number, to determine whether a given point in the complex plane is inside or outside of the Set. If this value exceeds 2, all iterations from then on will rapidly diverge towards infinity. All values outside of the Set, after iterations are stopped, will range from 2 to infinity (with points closest to the boundary closest to 2). If the value does not exceed 2 after the maximum number of iterations, its final value will lie within the range of 0 and 2.

Every time a particle projects its two rays, it calculates the magnitude of Z at the ends of each ray to determine which is closest to 2. The length of the ray is proportional to its distance to the boundary, with lengths being shorter near the boundary - thus, the resulting velocitiy of the particle is smaller when it is near the boundary. However, since a particle can often overshoot across one of the Mandelbrot Set's tendrils, it may end up weaving itself along the general arc of the tendril, sometimes falling off the end, where it encounters a strong gradient - this is presumed to be what causes the curious launching effect.