# Mandelbrot

Basis is the iteration

$$z_{n+1} = z_n^2+c,\qquad \text{with } z_0,c\in\mathbb{C}$$

and for the Mandelbrot $$z_0=0$$.

The definition of the Mandelbrot (Ger.: almond bread) set is

$$\mathbb{M}:= \{c\in\mathbb{C}: (z_n)\text{ remains bounded}\}.$$

Generally the sequence $$(z_n)$$ can show the following behavior:

convergence
$$z_n\longrightarrow_{n\to\infty} z_\infty\in\mathbb{C}$$;
periodic behavior
$$z_{n+p}=z_n$$ for $$p>0$$ (period length) from $$n\ge N$$;
asymptotically periodic
$$z_n-o_n\longrightarrow_{n\to\infty}0$$ where $$o_{n+p}=o_n$$ the periodic orbit;
converging to a curve
$$\|z_n-C\|\longrightarrow_{n\to\infty}0$$ where $$C\colon(0,1)\to\mathbb{C}$$ is a 1-dimensional (smooth) and $$\|z-C\|:=\inf\{|z-C(t)|:t\in(0,1)\}$$ is the distance of a point from the curve.
divergent to infinity
$$|z_n|\longrightarrow_{n\to\infty} \infty$$;
chaotic behavior
None of the above.

One possibility to draw this is the escape algorithm. For this we decide on a rectangle in the complex plane as well as a rasterization and compute the first sequence elements for each point. We stop the computation once the absolute value of a sequence element exceeds a certain threshold. It can be shown that the sequence diverges to infinity once the threshold 2 is exceeded. This implies conversely that the whole Mandelbrot set is contained in a circle of radius 2. The maximum number of iterations for cirsp contours depends on the zoom level of the rendered area, but you can start with 256 iterations for an overview.

In abstract notation this looks about as follows:

 const double dx = Math.max((x1-x0)/width, (y1-y0)/height); const double dy = -dx; // square pixels double cy = y1; // top border of the image for (int py=0; py<height; py++, cy+=dy) { double cx = x0; // left border of the image for (int px=0; px<width; px++, cx+=dx) { int iter = 1; double x = cx, y = cy; for(; iter<maxIt; iter++) { double x2 = x*x, y2 = y*y; if (x2+y2>threshold) break; y = 2*x*y +cy; x = x2-y2 +cx; } if (iter<maxIt) drawPixel(px,py, toColor(iter)); else drawPixel(px,py, BLACK); } } 

The function Color toColor(double iter) should convert the abortion iteration into a color. One possibility is to map the iteration to a blue to red scale (and repeat that if maxIt exceeds the color resolution).

 Color toColor(double iter) { int i = (int)iter % 256; return new Color(i, 128, 255-i); } 

## Properties

The Mandelbrot itself is symmetric to the real axis. This can be seen from

$$\bar{z}_0 =0,\quad \bar{z}_{n+1} = \bar{z}_n^2 +\bar{c},$$

i.e. the sequences for $$c$$ and $$\bar{c}$$ are conjugate to each other.

## Filled-in Julia sets

Re c = , Im c = animated

Basis is the same iteration, but instead of $$z_0=0$$, we consider $$z_0\in\mathbb{C}$$ and keep the parameter $$c\in\mathbb{C}$$ fixed. Then again we are looking for the points where the sequence remains bounded

$$\mathbb{K}_c := \{z_0\in\mathbb{C}: (z_n)\text{ remains bounded}\}.$$

### Basic properties

Starting from $$z=z^2+c$$ it can be shown that none of the Julia sets is empty. But with $$|z_0|\gg1+|c|$$ it can also be shown that the Attractive basin of infinity (one of the Fatou components) $$\mathbb{F}_c(\infty):= \mathbb{C}\setminus\mathbb{K}_c$$ is non empty.

From $$z_1 = z_0^2+c = (-z_0)^2+c$$ it can be seen that the sequences for $$z_0$$ and $$-z_0$$ are the same (except for the initial element) and therefore the filled-in Julia sets are point symmetric to the origin.

As a pragmatic solution it can be shown that for $$|c|\le2$$ also $$(z_n)$$ escapes as soon as for one $$n\in\mathbb{N}$$ we have $$|z_n|>2$$.