Mandelbulb: Three Dimensional Fractals

Searching For The Mandelbrot In Higher Dimensions

Mandelbulb: Three Dimensional Fractals
Original: https://www.setzeus.com/community-blog-posts/mandelbulb-three-dimensional-fractals

Previously, we covered the history & the basics of iterating complex numbers in hopes of generating fractals. Starting from scratch with Julia Sets, we worked our way through defining & plotting the eminent Mandelbrot Set — arriving at the ground-breaking heart of fractal geometry:

The Mandelbrot Set Is A Dictionary Of All Julia Sets

The Mandelbrot Set visually communicates how varying starting constants, iterated ad nauseam in the function Z² + C, converge to Julia Sets (beautiful, connected patterns) or “blow up” into Fatou Sets (dis-connected clusters). As seen below with the red arrows, selecting starting complex numbers inside the Mandelbrot Set, in the filled area, generates continuous Julia Sets; starting with complex numbers outside the set, in the rest of the white space, converges to disconnected Fatou Sets.

Original Article: https://www.setzeus.com/community-blog-posts/mandelbulb-three-dimensional-fractals

Our initial curiosity indeed satisfied, like many discoveries in math, the uncovered Mandelbrot Set only lead us to a new realm of questions; most importantly, perhaps, is that of the equivalent in different dimensions — do fractals exist in different number systems? And more specifically, what’s the 3D equivalent of the Mandelbrot Set?

Prologue

It appears that one Rudy Rucker beat me to the punch by roughly ~33 years. A brilliant mathematician, computer scientist & science fiction author, as well as one of the founders of the cyberpunk cultural movement, Rudy stayed on the cutting-edge of the STEM world. As a result, he was keenly aware of the Mandelbrot Set almost immediately after Benoit’s original publication. A creative, Rucker appreciated the Mandelbrot Set but his fiction imagination propelled him to the next step in the journey: the existence of a mathematically-equivalent 3D structure to the Mandelbrot Set.

Unfortunately, Rucker understood the computing limits of hardware (in the 80s) & knew that the billions of calculations required were likely painstakingly impossible. Limited by the technology of his time, Rucker did what he did best: he wrote about it. Rightfully, the very first authored evidence of the search for the Holy Grail in 3D came from Rucker, in 1987, in the form of a short story titled “As Above, So Below;” in it, he imagines the discovery of the Mandelbrot Set in 3D, giving it the name: Mandebulb.

Early Attempts

The crux of searching for a 3D-equivalent revolves around the uncertainty in the number system. The Mandelbrot set fits two dimensions because complex numbers have two components. Can we find a similar number system for three dimensions?

Number System Issue

The iterated Mandelbrot formula (Z² + C) involves two operations: adding & squaring complex numbers. Creating a n-component number where addition is possible is straight-forward; from linear algebra, this is simply referred to as a vector space. Component-wise addition will do the trick & seems like the logical choice.

However, complexity arises because the Mandelbrot formula also involves squaring a number, which requires a multiplication operator (a vector product) on the vector space. A vector space with a (bilinear) vector product is called an algebra over a field. To see why a three-dimensional number system might be problematic, let us try creating one.

We do this by starting with the complex numbers & introducing a third component, j. Next, we need to guarantee that certain properties of complex & real numbers also hold up in our new number system; since we require addition & multiplication, we specifically care about maintaining the associative (a∗(b+c)=(ab)+(ac)) & commutative property ((ab=ba)) intact.

We already know that the distributive property will hold while adding in a vector space, so we really only need to specify how the units of the three components multiply — we’ll illustrate this in a multiplication table. Both properties imply consistency when multiplying by one, which implies that a table of our number system must be symmetrical:

Credit To Mikael Hvidtfeldt Christensen For This Observation

For any functional number system, anything multiplied by 1 is still one, & if we now require the real & imaginary components to behave in a specific way, we only have three components left — the question marks in the matrix above.

Unfortunately, it’s obvious that our toy system above fails to be associative (i.e. it is not always true, that a∗(bc)=(ab)∗c); this can be seen by looking at the equation i∗(ij)=(ii)∗jix=−j, which can not be satisfied no matter how we choose x.

4D Quaternion — 1982

The above highlights the biggest obstacle to creating a consistent number system in three-dimensions: there simply is no natural choice. The very first breakthrough, however, that logically circumvented the issues laid out here leveraged a decades-old-theorem: Hurwitz’s Theorem. The Wiki definition is, as usual, a convoluted mishmash of technical terms optimized for complexity:

The theorem states that if the quadratic form defines a homomorphism into the positive real numbers on the non-zero part of the algebra, then the algebra must be isomorphic to the real numbers, the complex numbers, the quaternions, or the octonions.

The above simply translates to: for our number system to have certain operations (multiplication/division), they have to be in one of four mathematical spaces: the real numbers (1D), the complex numbers (2D), the quaternions (4D) and the octonions (8D).

But no 3D systems.

So, based on this theory first published posthumously in the early 1920s, one Alan Norton attempted to find the 3D-Mandelbrot equivalent using a Quaternion (4D) number system. Published in 1982, his paper showed a Quaternion Julia Set made entirely possible by displaying a 3D “slice” of the 4D space — here is an example of a Quaternion Julia fractal:

4D Quaternion Julia Set

Naturally, to visualize a 4D object, you have to make some kind of dimensional reduction; the most common approach is to make a 3D cross-section, by simply keeping one of the four components at a fixed value. Unfortunately, while the 4D Julia Set above is certainly captivating, keeping one of the four components at a fixed value while searching for the 4D Mandelbrot creates 2nd-order problems; by forcing a component to stay fixed, any Quaternion Mandelbrot created is automatically symmetrical across at least one axis:

Enter The Mandelbulb

For the next ~20 years, few variations were proposed with very little to show for it. And so the search for the 3D Mandelbrot Set slumbered until 2007 when one amateur mathematician by the name of Daniel White provided an insightful shift in the frame of reference.

A New Hope — 2007

White’s insight, his contribution, was to interpret the definition of the Mandelbrot geometrically — this made working in the 3D much more practical. Instead of rotating around a circle (complex multiplication), as in the normal 2D Mandelbrot, he instead rotated around phi & theta in 3-dimensional spherical coordinates (x,y,z).

Recall that the Mandelbrot Set highlights the escape behavior of starting with varying complex constants & iterating through Z² + C; White aimed to replicate this geometrical, boundary-limit relationship. Same as the Mandelbrot, conceptually, White imagined squaring a hyper-complex point (z) to arrive at a new point, then add the remaining constant ( c ). In reality, it’s a bit more involved since simply squaring (z) provides the magnitude, or the distance to the new point; however, this is still missing the direction. In what direction is this new point placed before we add C?

In November 2007, Daniel White famously posted the following formula for the first time on the fractalforums.com website:

Below, we’re going to provide a visual that’ll hopefully aid the intuition behind White’s approach. Afterward, we’re going to step through the logic of the code above — working through the why in the formula above. Remember, we’re trying to fit a set of hyper-complex numbers in the function Z² + C .Starting from a first-principle basis, let’s diagram a 3D plane & select a random point that we’ll leave as (x,y,z):

Published On — https://www.setzeus.com/

double r = sqrt (x*x + y*y + z*z);
double yAng = atan2 (sqrt(x*x + y*y), z);
doubnt zAng = atan2 (y , x);

The opening line above (r), is simply the distance formula in 3D; in fractal world, it’s the first step in the original formula: Z². Another way of looking at this is that r is the magnitude of our vector, it’s the distance between our old point & our new point. However, as previewed above, this leaves us with a lack of direction — we don’t know in what direction this new point lies.

This is why the next two lines focus on extracting out angles. yAng maps to phiin the diagram above, it’s the height angle; zAng maps to theta, as the angle between the x & y direction.

newX = (r*r) * sin( yAng*2 + 0.5*pi ) * cos(zAng*2 +pi);
newY = (r*r) * sin( yAng*2 + 0.5*pi ) * sin(zAng*2 +pi);
newZ = (r*r) * cos( yAng*2 + 0.5*pi );

The lines that follow are much more abstract, subjective & I admittedly struggled to prove them from scratch; it seems that each line is meant to reproduce the dynamics of the Mandelbrot iteration in the 2d complex plane, specifically doubling the angle. Why these specific trigonometry identities with the half-PI offset? Again, not entirely sure, though the variance is consistent with the mechanics of a 3D number system we explored above; this implies that there are likely entire families of 3D fractals, depending on your choices of angle coefficient and offset, worth combing through.

The rest of the code is, thankfully, straight-forward as it consists of adding the constant (x,y,z) to the new point (xNew, yNew, zNew); this is simple addition to arrive at the final point that we’ll then use as an input for the next iteration.

Rather than relying on complicated mathematics, White approached the problem geometrically, as seen above. In theory, this approach might generate the elusive 3D Mandelbrot; & yet, despite the fanfare, when it was finally rendered, the initial results were drastically disappointing:

Found On Daniel White’s Personal Site

Seen above, the outputs from White’s approach boringly resemble the Mandelbrot Set with an added axis. Much like the quest in 2D, it’s really difficult to judge exactly what it is we’re looking for, which means it’s tough to judge what’s right. However, thankfully, certain clues provide context to what’s wrong. Reasonably, we’d expect a 3D-Mandelbrot to consist of both extreme detail & symmetry in multiple directions. As White himself says:

Although the second one looks somewhat impressive, & has the appearance of a 3D Mandelbulb very roughly, we would expect the real deal to have a level of detail far exceeding it. Perhaps we should expect an ‘apple core’ shape with spheres surrounding the perimeter, and further spheres surrounding those, similar to the way that circles surround circles in the 2D Mandelbrot. Zooming in reveals interesting detail, but I didn’t find a great deal beyond the usual chaos.

And so another name was inscribed to the short-history of the Mandelbulb; White indeed had the right formula, he, however, wasn’t searching in the right dimension.

Beyond The Binomial — 2009

The formula originally used in the fractal geometry, the crux of Mandelbrot, Julia, & Fatou sets, is defined as Z² + C. We, (the math community), carried the assumption that this exact, same formula would result in similar parallels across different number systems; confident in White’s logic yet frustrated by the disappointing outputs, another enthusiast, by the name of Paul Nylander, decided to experiment by raising Z to different powers.

After multiple attempts & painfully-slow renders, Nylander & White finallystumbled across what is today known as The Mandelbulb; for no obvious, objective reason, other than the pair believe this is the closest to the equivalent of a Mandelbrot Set, the formula for The Mandelbulb is: Z⁸ + C.

Many Thanks To Tom Beddard

In Closing

We finally arrived at arguably the greatest break-through in fractal geometry since Benoit Mandelbrot first published his set in 1980: The Mandelbulb. Generated in the 3rd-dimension with the updated formula (z⁸ + c), it indeed does hold many of the properties exhibited in the Mandelbrot Set & expected in its 3D equivalent. It’s incontrovertibly visually captivating & extremely detailed; as many videos show, it also contains infinite complexity as one zooms in, much like the Mandelbrot Set.

And while it’s undeniably worthy of praise & celebration from the fractal community, there is still great skepticism that this is the Holy Grail; in fact, even White admits that this is very likely just another step in the long journey:

There are still ‘whipped cream’ sections, where there isn’t detail. If the real thing does exist — and I’m not saying 100% that it does — one would expect even more variety than we are currently seeing.

And so the search for the equivalent Mandelbrot Set in 3D continues in the dark, a puzzle without a finished picture as a clue. Fortunately, the lengths between leaps in progress have shortened, as the next breakthrough was right around the corner in the form of a box…