While the visual version is pretty intuitive to understand, it isn’t very quick or precise. There’s a more math-y way that fixes both problems, but it destroys some of the simplicity. I’ll skim through the basics, but feel free to skip ahead if you need to.
A more formal way to write our little algorithm is
Now we add the second dimension by introducing “complex” numbers. The name is a bit misleading, as we just need to make two simple changes: we introduce a special variable, i, and declare that multiplying it by itself results in -1.[130] In all other ways, we’re following elementary algebra. The second number of the pair, or the vertical part, is automatically multiplied by i, like
And with that, we can start working out the details.
Translating back into English, we have:
- Write two numbers at the top of a piece of paper.
- Multiply the leftmost of them by itself, subtract from that the rightmost number multiplied by itself, add the leftmost one back on, then write that result below the leftmost number.
- Now multiply the left and right numbers together, double that, then add the rightmost number; write this new number below the rightmost one.
- From now on, only consider the pair of numbers at the bottom of the column.
- Multiply the leftmost of that pair by itself, subtract the rightmost one multiplied by itself, add the leftmost number at the top of the column to the result, and write the eventual number below the left one in the bottom pair.
- Multiply that bottom pair together, double the result, and add the rightmost number in that pair. Complete a new bottom pair by writing this result to the right of the number you wrote down last step.
- Go to step four, until satisfied or bored.
Here’s a few examples of the two-dimensional version in action. Note that when the second number is zero, the first behaves exactly as it would if you were using the one-number method, which proves that we did our math correctly.
(0.250000, 0.100000) |
||
0.250000 x 0.250000 – 0.100000 x 0.100000 + 0.250000 = |
(0.302500, 0.150000) |
= 0.250000 x 0.100000 x 2 + 0.100000 |
0.302500 x 0.302500 – 0.150000 x 0.150000 + 0.250000 = |
(0.319006, 0.190750) |
= 0.302500 x 0.150000 x 2 + 0.100000 |
0.319006 x 0.319006 – 0.190750 x 0.190750 + 0.250000 = |
(0.315379, 0.221700) |
= 0.319006 x 0.190750 x 2 + 0.100000. |
0.315379 x 0.315379 – 0.221700 x 0.221700 + 0.250000 = |
(0.300313, 0.239839) |
= 0.315379 x 0.221700 x 2 + 0.100000 |
0.300313 x 0.300313 – 0.239839 x 0.239839 + 0.250000 = . . . |
(0.282665, 0.244053) . . . |
= 0.300313 x 0.239839 x 2 + 0.100000 . . |
(-1.750000, 0.000000) (1.312500, 0.000000) (-0.027343, 0.000000) (-1.749252, 0.000000) (1.309882, 0.000000) (-0.034209, 0.000000) (-1.748829, 0.000000) (1.308402, 0.000000) (-0.038084, 0.000000) (-1.748549, 0.000000) (1.307423, 0.000000) . . . |
(-0.500000, -0.500000) (-0.500000, 0.000000) (-0.250000, -0.500000) (-0.687500, -0.250000) (-0.089843, -0.156250) (-0.516342, -0.471924) (-0.456103, -0.012651) (-0.292130, -0.488459) (-0.653252, -0.214612) (-0.119320, -0.219608) (-0.533990, -0.447592) . . . |
(0.000000, 0.750000) (-0.562500, 0.750000) (-0.246093, -0.093750) (0.051772, 0.796142) (-0.631161, 0.832435) (-0.294583, -0.300801) (-0.003702, 0.927221) (-0.859725, 0.743134) (0.186878, -0.527781) (-0.243629, 0.552738) (-0.246164, 0.480673) . . . |
[130] That has to be handled pair-wise, so i times i times i is the same as -1 times i, so it equals -i and not -1.