Background
The Mandelbrot set has a simple definition that when visualized on the complex plane, results in high emergent complexity. As you can see in the animation on the right, you can zoom into any region — and if you choose a random region on the boundary, you are probably the first (and last) human to have ever seen it.The definition of the Mandelbrot set are all complex coordinates , where the derived sequence
(Recall how multiplication of complex numbers works, to understand why this doesn't trivially diverge for all values: complex multiplication is akin to a rotation that can result in a cycle.)
Implementation
When computing the Mandelbrot set, we approximate divergence negatively by the number of iterations we can take without the sequence diverging. Additionally we will bound the computation to some fixed number , and visualize the point (i.e. pixel) on the complex plane by picking a color from a color gradient (in our case grayscale) proportional to . All of this has already been implemented in the template.
Problems such as Mandelbrot are referred to
as embarrassingly
parallel
, since divergence can be approximated independently
for each point. Nevertheless, an efficient computation requires some
thought — do not just start a new process for each pixel, since
determining divergence takes much longer on some parts of the plane
than on others.