# Fractaling

While I’m working on my next approach to the Riemann Zeta (and if anyone knows the answer already, please let me know), I’d like to write a little bit more about complex numbers.

If you look at real numbers, they behave very predictably when you square them, which is essentially the same as drawing a square with side “x”, and then looking at “y” as the area of that square. With one specific exception, real numbers are going to fall into two categories: 1) The squares are going to get really big fast; or, 2) they’re going to get small really fast. The exception is x=1, where x^2 doesn’t change. This may not be obvious from the graph, but I’ll come back to this point.

(Graph 1: y = x^2)

If we take the next step and cube the number (x*x*x = x^3), which gives us the volume of a cube with side “x”, we get an interesting effect – when x is negative, the volume is negative. Or rather, the result of taking x to the power of 3 is negative for negative x. Regardless, y gets bigger, or smaller, a lot faster than when we just squared x.

(Graph 2: y = x^3)

Just for amusement value, I’ll include the graph for x^4.

(Graph 3: y = x^4)

And x^5. The greater the exponent, the more the curve flattens towards 0 between x= -0.5 and 0.5, and the more the sides straighten out for x > |+/- 1.5|. The corners right around +/- 1 will remain rounded, though.

(Graph 4: y = x^5)

This leads into an obvious question – what happens if we use non-integer steps for the power of x? That is, what if we did something like y = a^x, where x could go from 1.672 to 4.898? The answer is, if “a” is 1, nothing; y is a flat line. If “a” is greater than 2, y gets bigger nonlinearly and if it’s between 0 and 1, it gets smaller nonlinearly. If “a” is negative, Excel will give a “not a number” error for trying to take a negative root.

(Graph 5: y = a^x, for a > 1 (a=2 in this case))

(Graph 6: y = a^x, for a < 1 (a=0.5 in this case))

The following graph shows this point a bit better. y = a^x, where x runs from 1 to 5, and the lines are for differing values of “a” (from 0.9 to 1.1) As “a” approaches 1, the line for y flattens out, while the farther away it gets from 1, the greater the effect x has as an exponent, causing y to grow or shrink exponentially.

(Graph 7: y = a^x, for differing values of “a” as x ranges from 1 to 5.)

Not really earth-shaking, but worth getting out of the way as quickly as possible. What this means is that, generally, exponents are continuous. A fractional exponent between 2 and 3 (such as 2.762) will fall on the curved line between 2^2 and 2^3 (2^2 < 2^2.762 < 2^3.) Sweeping x from 2.762 to 2.772 just causes y to smoothly flow along this line.

Now, what happens when we square a complex number? The above graphs could be said to be a special case for complex numbers “a + ib” where b = 0. So, let’s make “b” non-zero.

s^2 = (a +ib)^2 = a^2 + 2iab – b^2 = (a^2 – b^2) + i*(2ab)

We’re changing the magnitude of the point, while rotating it a certain amount around the origin. This leads to weird results. In the following chart, I have 5 lines. The bottom line is for “a” from 1 to 8, with “b”=0. For the second line, “b” = 1, and then incrementing “b” for the other lines. The graph itself is the result of (a +ib)^2. Increasing “b” causes the point (a+ib)^2 to rotate further, and the amount of rotation is nonlinear with respect to “a”.

(Graph 8: y = (a+in)^2))

Where the weirdness of the complex plane comes in is when we repeat the exercise from the real axis above – taking s^x powers for incrementally increasing x.

(Graph 9: (2 + i1.5) ^ x, for x = 1, 2, 3, 4, 5.)

In this graph, s = 2 + i1.5. The first point is for x = 1. The second point is for (2 + i1.5) * (2 + i1.5) (that is, x = 2). The other points are for x = 3, 4 and 5. What should be obvious is that for larger values of x, y rotates in a spiral, and the magnitude for y is going towards infinity. Yes, this is kind of like what happened for real numbers, but there’s a “spin” involved, and the real portion of x (“a”), swings both positive and negative.

You may be familiar with the butterfly effect, which states that a butterfly flapping its wings in China can cause a hurricane to blow in North America. The original butterfly effect was discovered by Edward Lorenz in 1961 when he was trying to run a weather forecasting simulation on a mainframe computer. According to one story, he didn’t have a way of automatically recording the numbers he was printing out, so at night he’d shut the simulation down, and in the morning he’d start it up again by typing in the values he wanted to simulate from. The problem was that his program had a little bit more precision than the printout displayed, and after a few minutes, the simulator would be generating dramatically different results than what he expected, for what he thought was the exact same starting values.

What was happening in the simulation was that Lorenz kept repeating the same operations over and over again, and very small differences would be compounded over time. And, they were complex numbers, which provide a kind of feedback. In other words, very small variations in the starting positions of equations using complex numbers can add up if you repeat an operation often enough.

This leads me to Mandelbrot. Benoit Mandelbrot pretty much created fractal science single-handedly. The classic Mandelbrot set uses a formula similar to:

C1 = C0 * C0

What we’re doing is taking a starting complex number and squaring it. The result then becomes the next value that we square again. With real numbers, starting from 2, the sequences would be: 2, 4, 16, 256, 65,536, etc. It gets big fast. What we’d want is to locate the value of “a” that is bounded. Or, what is the boundary number where y starts going to infinity? The answer is 1. If x is less than 1, y will go to 0. If x is 1, y will remain 1. If x is greater than 1, y will go to infinity. 2 is greater than 1 (for most values of 2), so yes, r1 = r0 * r0 is not bounded when we start with r0=2.

Notice that r1 = r0^2 has an interesting property. If we look at r0=2, then 2, 4, 16, 256, 65,536, etc., can be rewritten as 2^1, 2^2, 2^4, 2^8, 2^16…

Or, 2^2^0, 2^2^1, 2^2^2, 2^2^3…, or y = 2^2^x. So we could generalize the original fractal formula as y = r0^2^x, where x is an integer.

There was a hypothesis that stated that if the magnitude of complex number c0 >= 2, then c0 * c0 would go to infinity. So, if you drew a circle of radius 2 around the origin, any complex point inside that circle, when squared, would stay within, or close to, that radius. However, as soon as the point escaped the circle, squaring it again would cause the result to go to infinity very quickly.

What Mandlebrot did was to color code the points within the complex plane based on how many times that point could be squared before the resulting magnitude exceeded 2. Because many of the points never escape the circle, there’s a cutoff – repeat the process up to 50 times and if it doesn’t escape, color that point black and go to the next point. When you draw fractals on a computer screen, you’re essentially drawing the screen as a complex plane as “a + ib”, and each pixel is one increment of “a” or “b” within the complex space you’ve chosen (such as, from (-2,-2i) to (2, 2i) for a screen 1400 pixels by 1000 pixels. “a” has a step increment of (2 – (-2)) /1400 = 0.0029. “b” increments 4/1000 = 0.004).

Again, the formula is:

C1 = C0 * C0,
where each new value of C1 becomes the next value of C0, until the magnitude of C1 > 2, or you’ve repeated the process 50 times. Color each point on the complex plane based on how many times you repeated the formula before stopping.

In Graph 9, (a + ib) = (2 + i1.5), the magnitude is already 2.5, and I’d have stopped at “n” steps = 0. Instead, let’s try (0.9 + i0.435).

(Graph 10: Plot of Cn+1 = Cn^2)

This is much more cool. Every time we square Cn (starting with Cn0 = 0.9 + i0.435 and then making Cn the old Cn+1) it runs off in a different direction before eventually decaying to 0 + i0. The really cool parts are when Cn doesn’t decay, and just seems to stay in a holding pattern.

Now, compare Cn+1 = Cn*Cn to y = Cn0^2^x.

It’s really the same thing. We’re just stopping after each increment of x to see if the magnitude of y is greater than 2. When we color code that point for Cn0, “x” is the same as “n”, the number of times we repeated the squaring operation. If we stop at 50 and give up for that point, it’s like we have squared Cn0 2^50 times. That is, we’ve multiplied Cn0 by itself trillions and trillions of times, and either it’s gone to 0 already, or it just refuses to grow up. Yet, if we move to the next pixel on the screen so that Cn0 = a + 0.0029 + ib, the results are going to be completely different. This is the butterfly effect – small differences in starting value get compounded over time.

The reason the curve for Cn+1 = Cn^2 looks so chaotic is that we’re skipping points in the middle. As shown in graphs 8 and 9, the imaginary part of a complex number acts as a discrete phase shift when we multiply complex numbers together. Multiplying Cn0 by itself creates an expanding spiral. Cn0^x (where x is a real integer, 1, 2, 3, 4, 5, 6, 7, 8…) is a spiral of disconnected dots. Cn+1 = Cn^2 skips a LOT of the points inbetween, because x is effectively increasing as 2, 4, 16, 256, 65,536… The spiraling effect is made completely invisible.

Why mention any of this at all? Well, the Riemann Zeta function performs a kind of similar operation on each value of “n” within the summation 1/(n^(a+ib)). True, they’re not really the same operations, but the Zeta function is hard to visualize while the Mandlebrot fractal is easier. Besides, I really like fractals and I like talking about them. It gives me an excuse to make new art projects, so there.