This image is an approximation of the Mandelbrot set mapped to pixels in a bitmap.
To create the image we first create a Cartesian plane with the x-axis running from -1.5 to 2.0 and the y-axis running from -i to i and then
map the coordinate plan to a 300 x 300 pixel grid. This means that the upper and left most pixel represents the complex number
(-1.5, i) and the lower and right most pixel represents (2, -i).
We then take each complex number that is mapped to a pixel and test it to see if we think it might be a member of the Mandelbrot
Set. If we guess that the number is in the set we paint it white. If we believe the number does not belong in the set we paint it
black. The test we use is to take the number square it and then add the original number back to the result and square it again. This is repeated
for a set number of times or until one of the coefficients exceeds a certain boundary.
Use 'a' to represent the real part of the complex number and 'b' to represent the coefficient of the imaginary part.
Step 1. Make a copy of (a, b) and call it (c, d)
Step 2. Square (c, d) and store the result back in (c, d)
Step 3. Test that -1000 < c < 1000 and that -1000 < d < 1000.
If the test fails we assume that the number is not in the set and quit. Otherwise continue.
Step 4. Add (a, b) to (c, d) and store the result in (c, d).
Step 5. Test that we have performed the steps 1000 times. If the test passes we quit and assume the number is a part of the set.
Otherwise we repeat the steps starting at step 2.
The algorithm expressed in Java code.
boolean isInMandelbrotSet(double real, double imaginary)
{