hpdz.net

High-Precision Deep Zoom

Technical Info - Math

The Mathematics of The Mandelbrot Set

I might someday write a detailed description of the mathematics of the Mandelbrot set, but there are so many out there I don't think I can add much to the state of the art on this subject (see the external links page). I will briefly describe it here just so anyone who isn't familiar with it doesn't have to look around to find out more about it.

The Mandelbrot set is just a set of points defined by a property they all share -- they are the points on a plane that remain bounded when a particular function is applied to them over and over. The plane is called the complex number plane, and I'll explain more about that in a moment. The function is z = z2 + c, which is applied repeatedly to the point to see what it will do. Points which lead to sequences that remain bounded after infinite number of repetitions of the function are in the set; those which diverge to infinity are not in the set.

Complex numbers

Now, how do you apply a function to a point in a plane? Well, the plane is actually a representation of what are called complex numbers. These are numbers that have two components to them, so-called "real" and "imaginary" parts. The "imaginary" part is named after the number i, which represents the square root of -1. If you think about it for a moment, the square root of -1 can't really exist because the square of any number, positive or negative, is positive. Still, you can work with this entity as if it were a number, and mathematicians have defined a whole world of arithmetic around them. In a sense, these "imaginary" numbers are just as "real" as the real numbers like 1 and pi and 2/3 (or, you could also say the real numbers are just as imaginary -- can we ever actually experience a number like pi, with an infinity of digits that never repeat?). Complex numbers have a real part and an imaginary part, and so they are two-dimensional, which is why they are represented on a plane rather than on a line like the "real" numbers.

Arithmetic, like addition, multiplication, and division, is defined for these numbers, and even exponentiation, logarithms, and trigonometric functions can be defined. In fact, any function you can define with real numbers can also be defined for complex numbers. It's even possible to perform calculus on functions of complex numbers, taking their derivatives and integrals. Complex numbers are used extensively in physics and engineering, even for solving real-world problems like how a bell's sound changes with time or how a radio wave passes through a thick sheet of metal.

Complex numbers also have a magnitude, or size, or absolute value, which is a single real number value. It is defined to be the distance of the point in the complex plane from the origin (0,0), or the square root of the sum of the squares of the real and imaginary parts, just like when calculating the length of the hypotenuse of a right triangle given its two other sides.

Calculating the Mandelbrot set

Getting back to how the Mandelbrot set is calculated on a computer, the first step in applying the z = z2 + c function to a point is to set c equal to that point as a complex number, and set z=0. Then you apply the function repeatedly, plugging the result from each iteration into z for the next iteration. So, starting with point c, and our initial starting value z0=0, we calculate z1 = z02 + c = c. Then we plug z1 back into the equation and get z2 = z12 + c = c2 + c. Next is z3 = z22 + c = (c2+c)2 + c, etc. After an infinite number of such iterations, the magnitude of the output of the function will either diverge or it will stay bounded on the complex number plane. Of course, on a real computer, you can't iterate the function an infinite number of times. All programs that draw the Mandelbrot set establish a cutoff number of counts. If the point is still bounded after reaching that cutoff, it is assumed to be in the set, although this is an approximation.

Coloring

Colors are determined by taking the number of counts for points that escape the circle of radius 2 and associating a color with the count value. A point that escapes after only 5 iterations might be assigned black, while a point that stays bounded until 150 iterations might be assigned blue, and one that stays bounded up to 300 iterations might be colored white. Defining the exact colors and the relationship between count numbers and colors is a major part of the art of generating these videos.

How deep is "DEEP"?

What exactly is meant by "deep zoom"? How deep is this?

Originally, I'm sure the word "deep" was applied to any image of the Mandelbrot set that is sized so small that hardware-based floating-point processors lack sufficient precision to render the images of the set. I think that definition still applies, and, surprisingly, the format and precision of the floating-point math hardware has not changed much in 30 years. It's become much faster, but the basic number of digits is the same, around 14-15, depending on how many pixels you want your image to have. So, in this sense, the term "deep" zoom has not changed at all -- it's anything smaller than a size of about 1e-14 or 1e-15. Beyond this and the native hardware floating point math won't work, and you have to write your own (or buy someone else's) floating-point math functions. This is a reasonable definition of "deep" zooming.

Still, there's deep, and then there's DEEP.

Really deep zooms involve magnifications of the set that truly boggle the mind. One site (fractal-animation.net) likes to refer to these animated zooms as "Universe" videos, and with good reason. Most of us who generate these animations start to think about things like how big the final image in the animation is compared to the first frame (the one usually with the whole set): is it the size of the earth, the solar system, the galaxy, etc. The ratios of sizes get astronomically large -- literally -- very very quickly.

Here are some sizes of various things (in meters) to get an idea of the scales involved (the E notation means a certain number of zeros; for example, 1E6 is one million, or 1 followed by 6 zeros; 1E3 is one thousand, and 1E-4 is 0.0001, or 1 with the decimal point shifted left 4 places).

Sizes (in meters) of various things
Size of a human1.5-2.0 (meters)
Diameter of earth6.37e6 (6.37 million)
Size of a typical human cell10e-6 to 50e-6
Distance from sun to earth149,597,870,691 (1.5e11)
One light year9.46e15
Diameter of our galaxy100,000 light years = 9.5e20
Size of universe100 billion light years (estimated)=9.5e26
Size of an atom30-500 picometers = 30-500e-12
Size of a proton1.6e-15
Planck length1.6e-35

Taking a quick glance at the more familiar quantities in this table, we see that the ratio of the size of a human cell relative to the size of the earth is about 1.6E-12, or 0.0000000000016. The size of a small atom (they're all small, but some are smaller than others) relative to the size of the earth's orbit around the sun is about 2e-22. That means it would take 22 digits of precision to work with something that small. The physical entities involved make 22 digits sounds like a lot, but...

Here are the first 22 digits of pi: 3.141592653589793238463

That is about what you need to calculate the radius of the earth's orbit accurate to within the size of an atom (if that calculation even makes any physical sense). Not that impressive, is it? But think about this--the sun is really stinking far away, and an atom is pretty darn small. Still, there it is, 22 digits of pi, in barely half a line of text. I can make an image zoomed into the Mandelbrot set to this level of magnification, at 3000x2400 pixels, in just a few minutes.

So let's move on to something bigger, and something smaller. The size of the galaxy is pretty well known, and the size of the universe has been estimated by astrophysicists. To calculate the circumference of the universe to within the accuracy of the size of a proton, we need to consider a ratio of 9.5E26 / 1.5E-15 = 6.3E41, or about 41 digits of precision.

Here is pi to 41 -- no -- to 45 digits, just to be sure we can be super-accurate:

3.14159265358979323846264338327950288419716940

That is 45 digits. Can you memorize this? It's easier than remembering 5 phone numbers (we have mandatory 10-digit dialing in Houston).

Moving on to still-smaller entities, we could consider the Planck length. The Planck length (named after the physicist Max Planck, an early pioneer in the development of quantum mechanics) is essentially the smallest length that makes any sense to talk about. Due to quantum effects, at lengths smaller than this, strange things start to happen. So in a way, the ratio of the size of the universe to the Planck length is the biggest ratio of physically meaningful sizes we know of. Now, the Planck length is seriously small, no kidding, something like a hundred billion billion times smaller than a proton. If a proton were the size of the galaxy, the Planck length would be about the size of an atom. That is seriously small. Are you having a hard time grasping this? You're not alone. That's why we just look at the numbers and don't try to think too much about them; at least we can manage them as abstractions. Numerically, that ratio is darn close to 6E61. Sixty-one digits. That is the ratio of the size of the UNIVERSE to the size of something hundreds of billions of billions of times smaller than a proton.

Here is pi to sixty-one digits:

3.141592653589793238462643383279502884197169399375105820974945

Are you impressed? Blown away? Stunned? Did seeing 61 digits of pi change your religion? Probably not. Sixty-one digits just is (are?) not that impressive. So here is pi to a thousand digits:

3.14159265358979323846264338327950288419716939937510

5820974944592307816406286208998628034825342117067982

1480865132823066470938446095505822317253594081284811

1745028410270193852110555964462294895493038196442881

0975665933446128475648233786783165271201909145648566

9234603486104543266482133936072602491412737245870066

0631558817488152092096282925409171536436789259036001

1330530548820466521384146951941511609433057270365759

5919530921861173819326117931051185480744623799627495

6735188575272489122793818301194912983367336244065664

3086021394946395224737190702179860943702770539217176

2931767523846748184676694051320005681271452635608277

8577134275778960917363717872146844090122495343014654

9585371050792279689258923542019956112129021960864034

4181598136297747713099605187072113499999983729780499

5105973173281609631859502445945534690830264252230825

3344685035261931188171010003137838752886587533208381

4206171776691473035982534904287554687311595628638823

5378759375195778185778053217122680661300192787661119

5909216420199

You are probably still underwhelmed. In fact, I'll bet your first thought was, "That's a thousand? No way!" But yes, I promise, it's 1000 digits. Really. You can count them to convince yourself and you will still be underwhelmed.

That's because even though physics doesn't have much use for size ratios greater than about 61 digits, our instinctive reaction is that this 1000 digits is totally manageable. To a mathematician, this is nothing. In fact, calculating pi to bizarre numbers of digits is a bit of an esoteric passion for some people, and literally billions of digits are known. (Personally, I think they should be using their computers to calculate Mandelbrot animations...)

The best visually pleasing animated deep zooms into the Mandelbrot set (some of which are on this web site) magnify perhaps up to E100 or so. Some out there even go to E300 or even E1000 (although they tend to be terribly boring since the journey to those points is highly redundant -- see E100 and Centanimus, for example). Mathematically, compared to *infinity* this is nothing. These animations, compared to the totality of the Mandelbrot set, are no better than the 1000 digits of pi listed above compared to the billions of known digits, and still less compared to the infinity of digits that pi is composed of. And you can bet that the Mandelbrot set still has remarkable structure even at the tiniest distance scales, just like pi continues with billions of billions of random digits even after calculating billions of them.

So, when we say a "deep" zoom, we're really just scratching the surface. The term is more an expression of the limits of our technology (and also our budget...) in the face of the awesome magnitude of the infinite. It may boggle the mind to try to contemplate distance scales of E50 or E100 (and certainly E1000!!) but really, mathematically speaking, these sizes are no more impressive than the first few hundred digits of pi when compared to the full infinity of it, which makes the strings of hundreds billions of calculated digits break down and cry in their insignificance.


P.S. One other thing -- if you explore the Mandelbrot set enough, you will need to take a long break. I am convinced it is psychotic. There is a relentless repetitiveness to it that repeats itself again and again in slightly different ways that are slightly similar but slightly different again and again. It is relentless. Eventually, you will believe that it is psychotic because it keeps repeating itself. You will realize you've seen it all, that it's all the same everywhere, and that nothing more is to be extracted from it.

I've taken at least two year-long breaks over the past ten years, and I always come back and see it in a new light. Not so much the set itself (which really is psychotic) but the possibilities for coloring it, zooming in to it, creating interesting animations of it, etc. It is infinitely rich, and although it is infinitely repetitious, it has variety. It is a fantastic challenge, both technically and esthetically, to explore this thing and animate it.