# math notes

Contents

## Mandelbulb math

[2019-06-28] The Mandelbulb is a 3D analogue of regular Mandelbrot sets of polynomials of the form zn + c. This requires a 3D extension of complex numbers, in particular the complex product.

The basic idea of Daniel White and Paul Nylander is ingenious in its simplicity. It begins with the polar coordinate form of complex multiplication:

```(r1, φ1)(r2, φ2) = (r1*r2, φ1 + φ2)
```
The natural 3D analogue of polar coordinates are spherical coordinates. They are likewise defined by the distance from the origin, but now there are two angles to specify the direction. The analogous multiplication then becomes
```(r1, φ1, θ1)(r2, φ2, θ2) = (r1*r2, φ1 + φ2, θ1 + θ2)
```
That's all there is to it! Division follows as straightforwardly as with complex numbers, so rational functions are easily defined. The same goes for roots, with similar multiplicity caveats as in the complex plane. Addition and subtraction are defined in the "Cartesian" sense using the raw xyz coordinates.

### Not just for Mandelbulbs!

So what's new here? For some reason, everyone just wants Mandelbrot sets, and the new math was only created to 3Dify those, by generalizing the complex power of a single number. White's page even argues how boring other 3D fractals are in comparison to the unending variety found in Mandelbrot sets. There is some merit to this, considering that a single Mandelbrot set "contains" all possible Julia sets of the respective function.

Still, such a narrow focus misses an enormously wider potential of new mathematics and art. It's a bit like inventing fluid mechanics and only using it for bullets. Or using Fourier transforms to solve differential equations and nothing else; as Cambridge physicist Michael Hobson put it, this is akin to using Mona Lisa as a wrapper for fish and chips.

### Discoveries and problems

I started to explore Julia bulbs in late 2018, and I soon realized the math would also work with rational functions and roots. I also experimented with potential problems and found the following two issues:

• The distributive law does not always hold
• The multiplicative inverse is not unique
Some problems were bound to be found. It can be proved that complex numbers are the dimensionally largest field — there can be no field constructed from R3. Intuitively, one issue can be seen with the vector cross product: a×b = -b×a, which is closely related to the handedness of 3D and higher spaces. Interestingly, Mandelbulb math is fully commutative, while the problems lie elsewhere. (One can easily imagine trivial product definitions such as a*b = 1 for all a, b which are obviously commutative but will not work in a wider algebra.)

Spherical coordinates in general have a number of caveats, and these explain a part of the problems with Mandelbulb math. For example, crossing a pole makes φ jump by π, so the mapping between Cartesian and spherical coordinates is not continuous. Gimbal lock is another issue around the poles: with θ at 0 or π, φ is undefined, so moving away from the pole in a controlled direction needs some thought.

The periodicity and non-injectivity of trigonometric functions also accounts for some of the issues. Generally, things are fine and well-defined when working within the spherical coords, but back-and-forth conversions cause issues. The Cartesian→spherical mapping is not always unique.

For pure mathematicians, Mandelbulb math might not be very fruitful. But for mathematical artists, it can be a wonderful tool. There are of course other ways to define higher-dimensional algebras; one I have tested in passing is Bicomplex numbers.

## Domain colouring in 3D

Domain colouring is a relatively traditional technique for visualizing complex numbers, for example using

```hue = φ/2π
saturation = r
value = 1
```
which corresponds to the complex plane mapped onto the colour wheel. There is an infinite variety of other mappings, so going 3D is not going to make it any simpler. For example, the extra angle θ can be used to vary any of the HSV colour coordinates.

Simpler alternatives can take the RGB components straight from the xyz coordinates, for example

```(r, g, b) = (1 + x, 1 + y, 1 + z)
```
a variant of which was used to find this two-faced quadratic Mandelbulb.

## Tricomplex / face-centred complex construct

[2019-07-11] On July 3rd, 2019 I came up with another way to extend complex math into 3D: do a given complex transformation in each of the xy, yz and zx planes, and add the results together. Applying this to the classic Mandelbrot set of z2 + c produced this wonderful rose-like form. Getting such a nice surprise felt like a good sign, so I continue to explore the method further. I named the form Tricomplex Rose, partly influenced by the prominent 3-fold symmetry, thus naming the entire approach.

Given f: R2→R2 and z ∈ R3, w = tricomplex(f)(z) can be compactly defined by using GLSL, as it allows simple access to each of the xy, yz and zx planes:

```    vec3 w = vec3(0.0);
w.xy += f(z.xy);
w.yz += f(z.yz);
w.zx += f(z.zx);
```
There is nothing particularly complex-analytic here, any 2D function can be used. For example, this 2D IFS was turned into 3D using the Tricomplex approach. While it preserved some of the main features, it gained some interesting deformations as it went from a perfect circle into a not-so-perfect sphere.

### Caveats

In general, triplicating a transformation this way does not preserve its algebraic properties. For example, inverting transformations becomes harder, as the 3 intermediate results are folded into each other.

Unlike Mandelbulb math, the Tricomplex approach is not an algebraic system. It is merely a way to construct 3D transformations out of 2D ones, intended for artistic rather than scientific purposes.

All 2D functions can be triplicated, but some are more tricomplex than others. For example, the complex cube does not make well-contained Julia sets this way. It has more symmetry than complex square to begin with, and more terms cancel each other out in the sum.

### Nomenclature

Using "Tricomplex" for this scheme is somewhat a misnomer. Bicomplex numbers are a full 4D system formed of two 2D complex planes, and tricomplex numbers are the next step in the same series of Multicomplex numbers. So my 3D scheme pales in comparison to actual triply complex systems. It is also not strictly connected to complex-analytic (holomorphic) transformations. But it is not really a number system, either, as noted above.

Nevertheless, this is a 3D system particularly useful with complex transformations. Many 2D functions can be easily generalized to any dimensionality, but complex numbers are very much a 2D-only system. So any way of extending some complex ideas into 3D is welcome.

I might also call this "face-centred complex" in analogy with cubic crystal systems. This gives a more concrete visualization, by considering the faces of the cube as complex planes. The fcc lattice also has the same 3-fold symmetry about the body diagonals. The only downside with this name is its length.

### Background

This was almost an accidental discovery, a by-product of sorts. I was looking for a 3D fractal with a simple Cartesian definition, for easier calculation of surface normals via differentiation. The results, my first fractal art with exact reflective lighting, are the Julia sets of the Tricomplex Rose.