# Fractals with TensorFlow

## Introduction:

Last week, it occurred to me to experiment with Mandelbrot sequences with variable exponents and after a few experiments using TensorFlow-Fractals I made a couple mathematical observations which surprised me a little. My principal interest in fractals besides mathematical beauty is that their massively parallel nature makes them a good benchmark for GPUs. In fact, one of my projects in the near future will be to simulate Quaternion fractals on GPUs with TensorFlow [2].

Before continuing, I must say that from a mathematical perspective everything here is rather naive but my philosophy is that it’s always better to get started and add more layers of sophistication later.

## The Mandelbrot sequence:

Mandelbrot sets are defined in terms of the following quadratic sequence in the complex plane:

Using this sequence, the Mandelbrot is normally defined as follows:

Now, given that might be an oscillating sequence we need to resort to a few approximations in order to simulate Mandelbrot sets on a computer. Here’s a short list:

- Finite precision.
- Stopping criteria for divergence.
- Stopping criteria for the number of iterates.

To address these issues we use 32-bit floating point numbers, a pre-defined upper-bound on the modulus of and a limit on the number of iterations. With an upper-bound of 7.0 and a limit of 500 iterations, the reader should obtain an image similar to the following figure:

This is as much as I will say about Mandelbrot sets although if the reader is interested in learning more, I highly recommend the primer on Wolfram MathWorld.

## Generalised Mandelbrot sequences:

Things became interesting when I experimented with recursive equations of the form:

Using equation I obtained the following images for exponents of and :

In fact, I made the following observations:

- Using equation , the resulting structure has symmetries when and symmetries when .
- Using equation , the resulting structure has symmetries when and symmetries when .

So far I don’t have a good explanation for these results but I hope to discover the reason behind the symmetries of these fractal structures before the end of next week.

## What’s next:

Before investigating Quaternion Mandelbrot sets on GPUs, I would like to take a closer look at the following questions:

- Numerical stability as a function of and .
- Might there be better stopping criteria besides hard-coded bounds on the modulus of and the maximum number of iterates.
- Is the Mandelbrot set computable? (Note: this has been discussed on the CS stackexchange.)

These questions don’t quite fall under the category of intelligent behaviour but who knows? On the one hand, the Universe might just be a set of simple rules which are applied in a recursive manner. On the other hand, fractals provide researchers with an effective(and beautiful) way of benchmarking hardware and software performance.

Either way, the moral of the story is that playing with Mandelbrot sets is always an opportunity to learn something new about computation.

# References:

- Fractal Art Generation using GPUs. Mayfield et al. 2016.
- Ray Tracing Quaternion Julia Sets on the GPU. Keenan Crane. 2005.
- Non-computable Julia Sets. M. Braverman, M. Yampolsky. 2005.