The starting z value of each square is (0, 0). When the absolute value of z, for a given point, is greater than or equal to 2, that point (and its corresponding square) is said to have escaped the Mandelbrot set. When that happens, you will color the square according to the number of iterations of the formula you have applied to that point. {“smallUrl”:“https://www. wikihow. com/images/thumb/f/f8/217503-5a. jpg/v4-460px-217503-5a. jpg”,“bigUrl”:"/images/thumb/f/f8/217503-5a. jpg/aid217503-v4-728px-217503-5a. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} Choose the colors you will use for pass 1, pass 2, and pass 3. Let’s assume red, green, and blue, respectively, for purposes of this article. {“smallUrl”:“https://www. wikihow. com/images/thumb/4/46/217503-5b. jpg/v4-460px-217503-5b. jpg”,“bigUrl”:"/images/thumb/4/46/217503-5b. jpg/aid217503-v4-728px-217503-5b. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} Calculate the value of z for the top-left corner of the tic-tac-toe board, assuming a starting z value of 0+0i or (0, 0) (see Tips for a better understanding of these representations). We are using the formula z = z2 + c as outlined in the first step. You will quickly see that, in this case, z2+c is simply c, since zero squared is still zero. And what is c for this square? (-2, 2). {“smallUrl”:“https://www. wikihow. com/images/thumb/a/ab/217503-5C. jpg/v4-460px-217503-5C. jpg”,“bigUrl”:"/images/thumb/a/ab/217503-5C. jpg/aid217503-v4-728px-217503-5C. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} Determine the absolute value of this point; the absolute value of a complex number (a, b) is the square root of a2 + b2. Now, since we’ll be comparing this to a known value: 2, we can avoid taking square roots by comparing a2 + b2 to 22, which we know equals 4. In this calculation, a = -2 and b = 2. {“smallUrl”:“https://www. wikihow. com/images/thumb/c/c9/217503-5D. jpg/v4-460px-217503-5D. jpg”,“bigUrl”:"/images/thumb/c/c9/217503-5D. jpg/aid217503-v4-728px-217503-5D. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} ([-2]2 + 22) = (4 + 4) = 8, which is greater than 4. It has escaped the Mandelbrot set after the first calculation, since its absolute value is greater than 2. Color it with the pencil you chose for pass 1. {“smallUrl”:“https://www. wikihow. com/images/thumb/c/cd/217503-5e. jpg/v4-460px-217503-5e. jpg”,“bigUrl”:"/images/thumb/c/cd/217503-5e. jpg/aid217503-v4-728px-217503-5e. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} {“smallUrl”:“https://www. wikihow. com/images/0/0e/Mandelbrot_set_419. jpg”,“bigUrl”:"/images/thumb/0/0e/Mandelbrot_set_419. jpg/166px-Mandelbrot_set_419. jpg",“smallWidth”:460,“smallHeight”:460,“bigWidth”:166,“bigHeight”:166,“licensing”:"<div class="mw-parser-output">

Screenshot of table originally created by <a href="/User:Jcomeau_ictx" title="User:Jcomeau_ictx">John Comeau</a>\n</p>

Image by: Uploader
\nLicense: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by/3. 0/">Creative Commons</a>\n</p></div>"} Do the same for each square on the board, except for the center square, which will not escape the Mandelbrot set by the 3rd pass (nor will it ever escape). So you’ve only used two colors: the pass 1 color for all the outer squares, and the pass 3 color for the middle square.

([-2]2 + 22) = (4 + 4) = 8, which is greater than 4.

([-2]2 + 22) = (4 + 4) = 8, which is greater than 4.

The first element, (-2, 1) is greater than 2 (because (-2)2 + 12 turns out to be 5) so let’s paint that one red, as it escapes the Mandelbrot set on the first pass. {“smallUrl”:“https://www. wikihow. com/images/thumb/f/f9/217503-7a. jpg/v4-460px-217503-7a. jpg”,“bigUrl”:"/images/thumb/f/f9/217503-7a. jpg/aid217503-v4-728px-217503-7a. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} The second element, (-1. 5, 1) turns out not to be greater than 2. Applying the formula for absolute value, x2+y2, with x = -1. 5 and y = 1: {“smallUrl”:“https://www. wikihow. com/images/thumb/f/f5/217503-7b. jpg/v4-460px-217503-7b. jpg”,“bigUrl”:"/images/thumb/f/f5/217503-7b. jpg/aid217503-v4-728px-217503-7b. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} (-1. 5)2 = 2. 25 12 = 1 2. 25 + 1 = 3. 25, less than 4, so the square root is less than 2. So we move on to our second pass, calculating z2+c using the shortcut (x2-y2, 2xy) for z2 (see Tips for how this shortcut is derived), still with x = -1. 5 and y = 1: {“smallUrl”:“https://www. wikihow. com/images/thumb/8/89/217503-7c. jpg/v4-460px-217503-7c. jpg”,“bigUrl”:"/images/thumb/8/89/217503-7c. jpg/aid217503-v4-728px-217503-7c. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} (-1. 5)2 - 12 becomes 2. 25 - 1, which becomes 1. 25; 2xy, since x is -1. 5 and y is 1, becomes 2(-1. 5), which yields -3. 0; This gives us a z2 of (1. 25, -3) Now add c for this cell (add x to x, y to y) yielding (-0. 25, -2) Let’s test if its absolute value is now greater than 2:. Calculate x2 + y2: {“smallUrl”:“https://www. wikihow. com/images/thumb/6/6d/217503-7d. jpg/v4-460px-217503-7d. jpg”,“bigUrl”:"/images/thumb/6/6d/217503-7d. jpg/aid217503-v4-728px-217503-7d. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} (-. 25)2 = . 0625 -22 = 4 . 0625 + 4 = 4. 0625, the square root of which is greater than 2, thus it has escaped after the second iteration: our first green! As you become familiar with the calculations, you’ll sometimes be able to tell which ones escape the Mandelbrot set just by glancing at the numbers. In this example, the y component has a magnitude of 2, which when squared and added to the squared value of the other number, will be greater than 4. Any number greater than 4 will have a square root greater than 2. See the Tips below for a more detailed explanation. The third element, with a c value of (-1, 1) does not escape the first pass: since both 1 and -1 when squared is 1, x2+y2 is 2. So we calculate z2+c, using the shortcut (x2-y2, 2xy) for z2: {“smallUrl”:“https://www. wikihow. com/images/thumb/d/d7/217503-7e. jpg/v4-460px-217503-7e. jpg”,“bigUrl”:"/images/thumb/d/d7/217503-7e. jpg/aid217503-v4-728px-217503-7e. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} (-1)2-12 becomes 1-1, which is 0; 2xy is then 2(-1) = -2; z2 = (0, -2) adding c we get (0, -2) + (-1, 1) = (-1, -1) That’s still the same absolute value as before (the square root of two, about 1. 41); continuing with a third iteration: {“smallUrl”:“https://www. wikihow. com/images/thumb/f/fa/217503-7f. jpg/v4-460px-217503-7f. jpg”,“bigUrl”:"/images/thumb/f/fa/217503-7f. jpg/aid217503-v4-728px-217503-7f. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} ([-1]2)-([-1]2) becomes 1-1, which is 0 (yet again). . . but now 2xy is 2(-1)(-1), which is positive 2, yielding a z2 value of (0, 2) adding c we get (0, 2) + (-1, 1) = (-1, 3), which has an a2 + b2 of 10, much greater than 4. Thus this one also escapes. Color the cell in with your third color, blue, and move on to the next one, since we have completed three iterations with this point. {“smallUrl”:“https://www. wikihow. com/images/thumb/2/27/217503-7g. jpg/v4-460px-217503-7g. jpg”,“bigUrl”:"/images/thumb/2/27/217503-7g. jpg/aid217503-v4-728px-217503-7g. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">

License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by-nc-sa/3. 0/">Creative Commons</a>
\n</p>

<br />\n</p></div>"} The fact that we’re using only three colors becomes apparent as a problem here, since something that escapes after only 3 iterations is colored the same as (0, 0) which never escapes; obviously we still won’t see anything close to the Mandelbrot “bug” at this level of detail.

{“smallUrl”:“https://www. wikihow. com/images/8/85/Mandelgen_81_81_0_0_1_rgb_fast_533. jpg”,“bigUrl”:"/images/thumb/8/85/Mandelgen_81_81_0_0_1_rgb_fast_533. jpg/81px-Mandelgen_81_81_0_0_1_rgb_fast_533. jpg",“smallWidth”:460,“smallHeight”:460,“bigWidth”:81,“bigHeight”:81,“licensing”:"<div class="mw-parser-output">

public domain from John Comeau\n</p>

Image by: Uploader
\nLicense: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by/3. 0/">Creative Commons</a>\n</p></div>"}Increasing the number of cells; this has 81 cells per side. Note the similarity to the 9 by 9 matrix above, but the much smoother edges on the circle and oval. {“smallUrl”:“https://www. wikihow. com/images/f/fc/Mandelgen_81_81_0_0_1_rgb2black_fast_797. jpg”,“bigUrl”:"/images/thumb/f/fc/Mandelgen_81_81_0_0_1_rgb2black_fast_797. jpg/81px-Mandelgen_81_81_0_0_1_rgb2black_fast_797. jpg",“smallWidth”:460,“smallHeight”:460,“bigWidth”:81,“bigHeight”:81,“licensing”:"<div class="mw-parser-output">

public domain from John Comeau\n</p>

Image by: Uploader
\nLicense: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons. org/licenses/by/3. 0/">Creative Commons</a>\n</p></div>"}Increasing the number of colors (iterations); this has 256 shades each of red, green, and blue for a total of 768 colors compared to 3. Note that you can now see the outline of the well-known Mandelbrot “lake” (or “bug”, depending on how you look at it). The downside is the amount of time it takes; if you can calculate each iteration in 10 seconds, that’s about 2 hours for each cell in, or close to, the Mandelbrot lake. Though that’s a relatively small part of the 81 by 81 matrix, it would still probably take a year to complete it, even if you worked on it for several hours each day. This is where the silicon type of computer comes in handy.