## Introducing Fractals

### Benoit B. Mandelbrot and The fractal geometry of nature

Shapes in nature can not be described in terms of Euclidean geometry.

“I coined fractal from the Latin adjective fractus. The corresponding Latin verb frangere means “to break:” to create irregular fragments.”

**Fractals** described many of the irregular and fragmented patterns around us.

### Personal notes and interpretations on fractal geometry:

#### Procedural construction

Vi Hart, doodling in Math class and creation of fractals. Those videos are the best source to get intuition on procedural construction.

Instead of defining a shape just at once, like a triangle.

Define steps. At each step, you apply a rule/relationship.

```
Step 0: triangle.
Step 1: find mid-points of triangle/s at step 0, connect them.
Step 2: find mid-points of trangle/s at step 1, connect them.
...
Step K: find mid-point of triangle/s at step k-1, connect them.
...
```

And keep on repeating that.

It can be concluded that building a fractal object may be expressed as a procedure of composing over itself.

#### Understanding dimension on this example:

We are used to relate the dimension of an object to the notion of length, area and volume.

In Euclidean geometry, a triangle is a 2D figure. But what about a Sierpiensky triangle?

Lets try to estimate the area at each step of the procedure:

```
Step 0: A0 = A (where A denotes for area of triangle)
Step 1: A1 = A0 - 1/4 * A = 3/4 * A
Step 2: A2 = A1 - 3 * 1/16 * A = (3/4 -3/16) * A = 9/16 * A
Step 3: A3 = A2 - 9 * 1/64 * A = (9/16 - 9/64) * A = 27/64 * A
...
Ak = (3/4)^k * A
...
```

When k grows bigger, the area gets closer to 0. So the Serpiensky triangle it has just too many holes to live in a 2-Dimensional world. But is obvioulsy grater than 1-Dimension.

What is its **real dimension**? It is a number d that satisfies (scaling factor)^d = (self-similar piece). To understand fractional dimensions I suggest watching this

## Mandelbrot set

Is the set of all numbers in the complex plane [1] that remain bounded under repeated iterations of the equation:

`f(z) = z ^ 2 + c`

This means that we also have a procedural way of defining it. Given c in complex plane:

At each step apply f.

```
Step 0: z
Step 1: z ^ 2 + c
Step 2: (z ^ 2 + c)^ 2 + c
Step 3: ((z ^ 2 + c)^ 2 + c) ^ 2 + c
...
Step K: f_k-1(z) ^ 2 + c
...
```

And if the modulus of the complex number at step K tends to infinity, then that point is not in the set.

### Exploring it with shaders

Computing an approximation of the Mandelbrot set allows you to explore the beauty that happens in the boundary. In this example I used the distance estimator function using the potential complex function. More information on the distance estimation method

### Potential function: arriving at the colors of the neighbourhood of the set

Historical background: In 1983, discovered by A. Douady and J. Hubbard.

The main idea is to manke an analogy to electrostatics and think that the surface of the set is charged with a high voltage, let’s suppose 1000 volts, and placed in the cross section of a metal cylinder.

The cylinder is placed inside an aluminiun bar with potential 0. This creates an electric field in the region between the cylinder and the bar. The field lines are known as external rays of M. And restricting our attention to the plane perpendicular to the axis of the cylinder, the electric potential defines equipotential lines arround our Mandelbrot set.

Along the equipotential lines, the voltage is contstant. The red line is the equipotential line with voltage 1. And its shape is far from the Mandelbrot set. The perpendicular lines, are the field lines, known as external rays.

And why do we care about equipotential lines?

Because the potential for each z is given by the escape time, which is defined as the first n that f_n(z) ( iterating n-times over f(z) ) has modulus greater than a fixed value R. And essentially this is the condition of belonging or not to the Mandelbrot set.

So equipotential lines are also lines of equal escape time towards infinity.

### What about the potential function?

It is define by the following formula:

`G(z) = lim(k->inf) log(|zk|)/2^k`

where zk := step-k of iterating f.

### Understanding the formula

#### Analytics functions for resolving two dimensional electrastatics

It is well known that analytic functions f: C-+C are a powerful tool for solving problems of two-dimensional electrostatics. The Cauchy-Riemann differential equations imply that Ref and Imf are both solutions to Laplace’s equation V 2 F=0, and that the two families of curves Ref=const and Imf=const in- tersect each other orthogonally. Therefore, if u = Ref, say, describes the sur- face of a charged conductor, the lines Re f= const are equipotential lines and Imf= const the corresponding field lines.

Consider the following example, where the unit circle is charged.

As there existis a conformal map between the unit circle and the segment [-2,2] in the real numbers. The equipotential lines and vectors fields are preserved.

A potential problem is solved when a conformal mapping has been found which transforms it to a known problem.

Doudy-Houbbard proved that there exists a conformal map from {C}-{Mc} -> {C}-{D}. Where C is the complex plane, Mc is the complement of the Mandelbrot Set, and D is the disk.

So the potential can be approximated by `log(|phi(x)|)`

where phi stands for the conformal map.

##### Understanding of the 2^k factor:

Let’s consider c=0 and start from a potential function: (0) `G(z) = log(|z|)`

(1) `G(z1)=log(|z^2|)`

which is the same `G(z1)=2*log(|z|)`

So for `G(zk)=2^k*log(|z|)`

which is the same as `G(zk)/2^k=log(|z|)=G(z)`

### Walking around the code this example

It uses `d(z) = |G(z)|/|G'(z)|`

as distance estimator function.
Because the potential function can be approximated by its Taylor polynomial.

We set the “voltage” of the Mandelbrot surface.

Replacing by the definition of potential function: `d(z) = log(|zn|)*|zn|/|z'n|`

### New fractals sets

As the potential function is independent of the polnomial I am using to iterate over. You can try using other functions to generate new frctals sets :)