Iterating the function

Here's the function: z = z2 + c.

The value z that comes out of one iteration gets plugged into the z2 bit for the next iteration. Two widely known fractal objects are the Mandelbrot Set and its cousins the Julia Sets. They are both generated from the same function above. The terms z and c resolve to four entities in the calculation: A, B, C, D. (Note: c and C are not the same entity.) Here is the heart of the calculation for a Mandelbrot picture:

  A2 = A1*A1 - B1*B1 + C

  B2 = 2*A1*B1 + D

  If (A2*A2 + B2*B2) > 4 Then Exit

A2 and B2 go back into the next round of the calculation (in place of A1 and B1) if (A2*A2 + B2*B2)<4.

That's what we call an iteration - we keep stuffing the value back in until we meet some escape condition. We do this for each spot on the screen. As you zoom in on the edge of the Set, you'll need to set a higher and higher iteration maximum to see any detail. A very high value will show the shape of the Set, but with the disadvantage of utter chaos on the inner bands. A low value will be dull and boring, but an intermediate value may show some magnificent features. Here are two examples of the same region with different iteration levels.

Number of maximum iterations= 101.        Number of maximum iterations= 201. Picture at 101 iterations    Picture at 201 iterations

As you can see, increasing the iteration maximum can increase the detail computed for the picture. It's up to you to judge what value is best for the picture you're after.

 

 previous   next