# Mandelbulb

A 4K UHD 3D Mandelbulb video
A ray-traced image of the 3D Mandelbulb for the iteration vv8 + c

The Mandelbulb is a three-dimensional fractal, constructed for the first time in 1997 by Jules Ruis and in 2009 further developed by Daniel White and Paul Nylander using spherical coordinates.

A canonical 3-dimensional Mandelbrot set does not exist, since there is no 3-dimensional analogue of the 2-dimensional space of complex numbers. It is possible to construct Mandelbrot sets in 4 dimensions using quaternions and bicomplex numbers.

Ruis's formula for the "nth power" of the vector ${\displaystyle \mathbf {v} =\langle x,y,z\rangle }$ in 3 is to see at http://www.fractal.org/Formula-Mandelbulb.pdf

The exponentiation term can be defined by: {x,y,z} ^n = (r^n) { cos(n*φ) * cos(n*θ), sin(n*φ) * cos(n*θ), sin(n*θ)} where r = sqrt (x^2 + y^2 + z^2) and r1 = sqrt (x^2 + y^2)

As we define θ as the angle in z-r1-space and φ as the angle in x-y-space then θ = atan2 (z, r1) so θ = atan2 (z, sqrt (x^2 + y^2)) and φ = atan2 (y, x)

The addition term in z -> z^n + c is similar to standard complex addition, and is simply defined by: (x,y,z} + {a,b,c) = {x+a, y+b, z+c} The rest of the algorithm is similar to the 2D Mandelbrot!

Summary Formula 3D Mandelbulb, Juliusbulb and Juliabulb

r = sqrt (x^2 + y^2 + z^2)

θ = atan2 (z, sqrt(x^2 + y^2)

φ = atan2 (y, x)

newx = (r^n) * cos(n*φ) * cos(n*θ)

newy = (r^n) * sin(n*φ) * cos(n*θ)

newz = (r^n) * sin(n*θ)

where n is the order of the 3D Mandelbulb, Juliusbulb/Juliabulb.

Other formulae come from identities parametrising the sum of squares to give a power of the sum of squares, such as

${\displaystyle (x^{2}-y^{2}-z^{2})^{2}+(2xz)^{2}+(2xy)^{2}=(x^{2}+y^{2}+z^{2})^{2},}$

which we can think of as a way to square a triplet of numbers so that the modulus is squared. So this gives, for example,

${\displaystyle x\to x^{2}-y^{2}-z^{2}+x_{0},}$
${\displaystyle y\to 2xz+y_{0},}$
${\displaystyle z\to 2xy+z_{0}}$

or various other permutations. This "quadratic" formula can be applied several times to get many power-2 formulae.

## Cubic formula

Cubic fractal

Other formulae come from identities parametrising the sum of squares to give a power of the sum of squares, such as

${\displaystyle (x^{3}-3xy^{2}-3xz^{2})^{2}+(y^{3}-3yx^{2}+yz^{2})^{2}+(z^{3}-3zx^{2}+zy^{2})^{2}=(x^{2}+y^{2}+z^{2})^{3},}$

which we can think of as a way to cube a triplet of numbers so that the modulus is cubed. So this gives, for example,

${\displaystyle x\to x^{3}-3x(y^{2}+z^{2})+x_{0}}$
${\displaystyle y\to -y^{3}+3yx^{2}-yz^{2}+y_{0}}$
${\displaystyle z\to z^{3}-3zx^{2}+zy^{2}+z_{0}}$

or other permutations.

This reduces to the complex fractal ${\displaystyle w\to w^{3}+w_{0}}$ when z = 0 and ${\displaystyle w\to {\overline {w}}^{3}+w_{0}}$ when y = 0.

There are several ways to combine two such "cubic" transforms to get a power-9 transform, which has slightly more structure.

## Quintic formula

Quintic Mandelbulb
Quintic Mandelbulb with C = 2

Another way to create Mandelbulbs with cubic symmetry is by taking the complex iteration formula ${\displaystyle z\to z^{4m+1}+z_{0}}$ for some integer m and adding terms to make it symmetrical in 3 dimensions but keeping the cross-sections to be the same 2-dimensional fractal. (The 4 comes from the fact that ${\displaystyle i^{4}=1}$.) For example, take the case of ${\displaystyle z\to z^{5}+z_{0}}$. In two dimensions, where ${\displaystyle z=x+iy}$, this is

${\displaystyle x\to x^{5}-10x^{3}y^{2}+5xy^{4}+x_{0},}$
${\displaystyle y\to y^{5}-10y^{3}x^{2}+5yx^{4}+y_{0}.}$

This can be then extended to three dimensions to give

${\displaystyle x\to x^{5}-10x^{3}(y^{2}+Ayz+z^{2})+5x(y^{4}+By^{3}z+Cy^{2}z^{2}+Byz^{3}+z^{4})+Dx^{2}yz(y+z)+x_{0},}$
${\displaystyle y\to y^{5}-10y^{3}(z^{2}+Axz+x^{2})+5y(z^{4}+Bz^{3}x+Cz^{2}x^{2}+Bzx^{3}+x^{4})+Dy^{2}zx(z+x)+y_{0},}$
${\displaystyle z\to z^{5}-10z^{3}(x^{2}+Axy+y^{2})+5z(x^{4}+Bx^{3}y+Cx^{2}y^{2}+Bxy^{3}+y^{4})+Dz^{2}xy(x+y)+z_{0}}$

for arbitrary constants A, B, C and D, which give different Mandelbulbs (usually set to 0). The case ${\displaystyle z\to z^{9}}$ gives a Mandelbulb most similar to the first example, where n = 9. A more pleasing result for the fifth power is obtained by basing it on the formula ${\displaystyle z\to -z^{5}+z_{0}}$.

Fractal based on z → −z5

## Power-nine formula

Fractal with z9 Mandelbrot cross-sections

This fractal has cross-sections of the power-9 Mandelbrot fractal. It has 32 small bulbs sprouting from the main sphere. It is defined by, for example,

${\displaystyle x\to x^{9}-36x^{7}(y^{2}+z^{2})+126x^{5}(y^{2}+z^{2})^{2}-84x^{3}(y^{2}+z^{2})^{3}+9x(y^{2}+z^{2})^{4}+x_{0},}$
${\displaystyle y\to y^{9}-36y^{7}(z^{2}+x^{2})+126y^{5}(z^{2}+x^{2})^{2}-84y^{3}(z^{2}+x^{2})^{3}+9y(z^{2}+x^{2})^{4}+y_{0},}$
${\displaystyle z\to z^{9}-36z^{7}(x^{2}+y^{2})+126z^{5}(x^{2}+y^{2})^{2}-84z^{3}(x^{2}+y^{2})^{3}+9z(x^{2}+y^{2})^{4}+z_{0}.}$

These formula can be written in a shorter way:

${\displaystyle x\to {\frac {1}{2}}\left(x+i{\sqrt {y^{2}+z^{2}}}\right)^{9}+{\frac {1}{2}}\left(x-i{\sqrt {y^{2}+z^{2}}}\right)^{9}+x_{0}}$

and equivalently for the other coordinates.

Power-nine fractal detail

## Spherical formula

A perfect spherical formula can be defined as a formula

${\displaystyle (x,y,z)\to {\big (}f(x,y,z)+x_{0},g(x,y,z)+y_{0},h(x,y,z)+z_{0}{\big )},}$

where

${\displaystyle (x^{2}+y^{2}+z^{2})^{n}=f(x,y,z)^{2}+g(x,y,z)^{2}+h(x,y,z)^{2},}$

where f, g and h are nth-power rational trinomials and n is an integer. The cubic fractal above is an example.