# Pictures of Julia and Mandelbrot Sets/The Mandelbrot set

In appearance a Julia set can go from one extreme to the other. And if we have a family of functions containing a complex parameter c, we will observe that by far the majority of c-values the Julia set is completely without interest. In fact, the attractive Julia sets are extremely rare.
And these Julia sets are just found by considering a family of iterations and from this constructing a set in the plane that can serve as an atlas of the Julia sets, in the sense that if we find an interesting locality in this set, we can be certain that some part of the pattern at this place will be reflected in the (self-similar) structure of the Julia sets associated to the points here. Such a set is called a Mandelbrot set.
Therefore, if we have a function $f(z)$, we introduce a complex parameter c in it, usually by addition: $f(z)+c$.

### Construction of the Mandelbrot set

The construction of the Mandelbrot set is based on the choice of two critical points $zc_{1}$ and $zc_{2}$ for the function $f(z)$: The Mandelbrot set (associated to the family $f(z)+c$ and the critical points $zc_{1}$ and $zc_{2}$) consists of the complex numbers c, such that the sequences of iteration (by $f(z)+c$) starting in $zc_{1}$ and $zc_{2}$, respectively, do not have the same terminus. This set is usually coloured black.

### Colouring the domain outside the Mandelbrot set

That a point c is lying outside the Mandelbrot set, means that the second critical point $zc_{2}$ is lying in the same Fatou domain (for the iteration $f(z)+c$) as the first critical point $zc_{1}$, and we can give c the colour of the point $zc_{2}$ in this Fatou domain.
In order to draw the Mandelbrot set and colour the domain outside it, we must have chosen a maximum iteration number M, a very small number $\epsilon$ (for iteration towards a finite cycle) and a very large number N (for iteration towards ∞).
If $zc_{1}$ = ∞ (and d ≥ 2, so that ∞ is a critical point and a (super-attracting) fixed point) we need of course not iterate $zc_{1}$: we iterate $zc_{2}$ (by $f(z)+c$) and if $|z_{k}|$ > N for some iteration number k < M, then c is lying outside the Mandelbrot set, and we colour c in the same way as we have coloured a z in a Fatou domain containing ∞. If we have reached the maximum iteration number M, we regard c as belonging to the Mandelbrot set.
If $zc_{1}$ is a finite critical point and if the iteration of $zc_{1}$ (by $f(z)+c$) is running to the maximum number of iterations M is reached, the terminus is most probably a finite attracting cycle that is not super-attracting (if not, there can be a fault in the colour of the pixel, but this is without significance in practice). If the last point of this iteration is z*, z* belongs to the cycle, but we must know the order and the attraction of the cycle. Therefore we continue the iteration: starting in z* and running until $|z_{k}-z*|<\epsilon$, then the number of iterations needed for this is the order r of the cycle, and we calculate the attraction $\alpha$ in the same way as before: 1/$\alpha$ is the product of the numbers $|f'(z_{i})|$ for the r points of the cycle. We hereafter iterate $zc_{2}$ (by $f(z)+c$), and stop when $|z_{k}-z*|<\epsilon$. If this iteration runs until the maximum number of iterations M is reached, we regard c as belonging to the Mandelbrot set. If $|z_{k}-z*|<\epsilon$ for k < M, we colour c according to k, or rather, the corresponding real iteration number, which is found in the same way as for a Fatou domain, by dividing k by r (and taking the integral part) and from this number subtract $log(\epsilon /|z_{k}-z*|)/log(\alpha )$.
If the cycle contains ∞, that is, if the iteration of $zc_{1}$ is stopped by $|z_{k}|$ > N for k < M, we let ∞ be the chosen point of the cycle, and we continue the iteration until we again have $|z_{k}|$ > N, then the number of iterations needed to do this is the order of the cycle. We then iterate $zc_{2}$ (by $f(z)+c$), and stop when $|z_{k}|$ > N. If this iteration runs until the maximum number of iterations M is reached, we regard c as belonging to the Mandelbrot set. If $|z_{k}|$ > N for k < M, we colour c according to k, or rather, the corresponding real iteration number, which is found in the same way as for a Fatou domain, by dividing k by r (and taking the integral part) and from this number subtract $log(log|z_{k}|/log(N))/log(|d|^{r})$.

### Colouring the boundary of the Mandelbrot set

That a point c is lying outside the Mandelbrot set, means that the second critical point $zc_{2}$ is lying in the same Fatou domain (for the iteration $f(z)+c$) as the first critical point $zc_{1}$, and the estimation of the distance from $zc_{2}$ to the Julia set, in this Fatou domain, is an estimation of the distance from c to the boundary of the Mandelbrot set. So, the boundary of the Mandelbrot set can be coloured in the same way as a Julia set, but now the derivative of $z_{k}$ is not with respect to z, but with respect to c.
If we set $g(z)=f(z)+c$, we have $z_{k}=g(g(...g(z)))$ (the k-fold composition)(the start value z is first $zc_{1}$ and then $zc_{2}$), and we find the derivative $z'_{k}$ of $z_{k}$ with respect to c by recursion: we have $z'_{k+1}=f'(z_{k})z'_{k}+1$, and we find $z'_{k}$ successively by performing this calculation for each iteration, starting with $z'_{0}$ = 0, together with (and before) the calculation of the next iteration value $z_{k+1}=f(z_{k})+c$, starting with z = $zc_{1}$ and $zc_{2}$, respectively.
As well as finding the point z* in the cycle by iterating $zc_{1}$ M times, we now also calculate the derivative z*' of z* with respect to c, and when iterating $zc_{2}$ towards the cycle, we now also calculate the derivative $z'_{k}$ of $z_{k}$ with respect to c. The formulas for $\delta (z)$ are for the two cases:
    $\delta (z)=$lim$_{k→∞}$$|z_{kr}-z*|/|z'_{kr}-z*'|$ (non-super-attraction)
    $\delta (z)=$lim$_{k→∞}$$log|z_{k}||z_{k}|/|z'_{k}|$ (d ≥ 2 and z* = ∞)
When the value of this number for the last iteration number is smaller than a given small number, we colour the point c dark-blue, for instance.

### Why the Mandelbrot set serves as an atlas of the Julia sets

If we choose a point c near the boundary of the Mandelbrot set, then the Julia set for $f(z)+c$ will have a (self-similar) structure that has some features in common with the Mandelbrot set at that locality. In the simple case $f(z)=z^{2}+c$ (the usual Mandelbrot set), the structure of the Julia set for c is exactly the same as the local structure of the Mandelbrot at c, but this is usually not the case for general rational functions, only that the structure of the Julia set reflects the local structure of the Mandelbrot set.
Why is this? When c is inside the Mandelbrot set, the sequence generated by $zc_{2}$ does not converge to the terminus of the sequence generated by $zc_{1}$, and this means that the two Fatou domains containing $zc_{1}$ and $zc_{2}$, respectively, are different. But when we let c pass over the boundary of the Mandelbrot set, the two sequences now have the same terminus, so that the two Fatou domains become identical. Because one of the Fatou domains has now disappeared, we can infer that the Julia set for $f(z)+c$ must change in a significant way (it becomes less connected).
It is only when c is near the boundary of the Mandelbrot set that we can predict something about the Julia set, but as there usually are several critical points, we can choose another pair and draw a new Mandelbrot set. Note that if we use two finite critical points and if we invert these, then the black is unaltered, but the colouring and the boundary can alter: the colour is determined by the value in $zc_{2}$ of the potential function of the Fatou domain for c containing $zc_{1}$. In order to get the most aesthetic colouring, we must use the value of the potential function in one and the same point (the second critical point) as c varies. When c passes the boundary of the Mandelbrot set, a Fatou domain disappears, but it is only when the second critical point leaves the Fatou domain, that we get the natural colouring and the boundary.

### The usual Mandelbrot set

For the family $f(z)=z^{2}+c$, there are two critical points, 0 and ∞, and therefore only one Mandelbrot set. This set consists of the points c such that the sequence generated by 0 (by $z^{2}+c$) remains bounded. For c outside the Mandelbrot set the sequence converges to ∞, and we can colour according to the number of iterations needed to bring the points outside a large circle with centre in origo. If we only colour according to the iteration number and if we do not draw the boundary, this circle needs only to have radius 2.
For this family, the Julia set for c has two Fatou domains when c is inside the Mandelbrot set, and one when c is outside. When c is inside the Mandelbrot set, the Julia set is connected, and when c is outside, the Julia set is disconnected (and more than that: totally disconnected - a dust cloud - because of the self-similarity). For c belonging to the boundary, the Julia set is connected, but it does not enclose an interior Fatou domain (this can be regarded as degenerated): the Julia set is just a fractal line with a "nose" and a "tail" and a "spine" connecting these two points.
The usual Mandelbrot set consists of an infinite system of cardioids and circles, all lying outside each other and some touching. When we zoom in, we find a swarm of mini-mandelbrots. Such mini-mandelbrots (possibly deformed) appear in the Mandelbrot set for every complex (differentiable) function, even for transcendental functions (see the picture in the section Julia and Mandelbrot sets for transcendental functions).

### The different types of Mandelbrot and Julia sets

Of all Mandelbrot sets the usual is the one that possesses most localities of beauty. All other Mandelbrot sets are more or less ugly in their entirety, especially when the function is not a polynomial. In return, it is in such Mandelbrot sets that we can be lucky enough to find the most interesting and original shapes.
When we draw the Mandelbrot set for different rational functions, of course some types of shape will recur, and it should be possible to classify these shapes. We cannot refer the any work in this direction, we can only state the most elementary differentiation:
1. d > 1 (m > n + 1). Then ∞ is a critical point and a super-attracting fixed point, and we usually use this as the first of the two critical points. For $f(z)=(z^{2}+z^{4}/2)/(2-z^{2}/20)+c$ (and critical point 0), we can find this motif in the Mandelbrot set (first picture):
2. d = 1 (m = n + 1). In this case $f(z)$ is usually constructed from the Newton procedure for solving an equation $g(z)=0$: $f(z)=z-g(z)/g'(z)$. The critical points are just the solutions to $g(z)=0$, and we choose two having the largest distance from each other. For $g(z)=z^{4}-1$ and thus $f(z)=(1+3z^{4})/(4z^{3})$, we can find this motif in the Mandelbrot set (second picture):
3. d < 1 (m < n + 1). In this case we usually use two finite critical points, and as the critical points are lying symmetrically around the x-axis (if $f(z)$ has real coefficients), we let the pair consist of conjugate numbers (of largest distance). We let the family be $f(z)=(1-z^{2})/(z-0.01z^{2}+0.004z^{3})+c$, and we zoom in at the place where the most interesting things seem to be (third picture). We choose three points on the boundary and draw their Julia sets. First a point on the thin tangent line passing through the sea horse valley. Then a point in one of the holes inside the upper black. The last point presupposes that we invert the critical points, so that we can see a part of the boundary that is not visible on this picture of the Mandelbrot set. This boundary forms a continuation downwards of the indicated vertical line in the centre.
* One Fatou domain
* Two Fatou domains
* One Fatou domain

### The parameter c

In order to get a family of iterations from the rational function f(z), we have here simply added the parameter c to f(z), so that the family is z → f(z) + c. This way is the simplest, and as we can get every Julia set in this way and as a Mandelbrot set locally is like a Julia set and as the type of the Mandelbrot sets constructed from families of the form z → f(z) + c is satisfying in every way, there is no strong reason for letting c enter in a more sophisticated way. But we can find interesting Mandelbrot sets by letting c enter in a specific way. We can transform the Mandelbrot set by replacing the family by z → $h_{1}(c)f(z)+h_{2}(c)$, for some functions $h_{1}(z)$ and $h_{2}(z)$, and we can construct Mandelbrot sets whose form in their entirety differ from those of the usual type by letting c appear in the coefficients of the rational function f(z).
Now the family is of the form z → g(z, c), and we assume that g(z, c) is rational in both z and c. The critical points can now depend on c (we denote the two chosen $zc_{1}(c)$ and $zc_{2}(c))$, and in order to draw the boundary we must (besides $g'(z,c)=\partial g(z,c)/\partial {z}$) calculate the derivative of g(z, c) with respect to c: (d/dc)g(z, c) (= $\partial g(z,c)/\partial {c}$ - see the section Terminology). And we must also calculate the derivative with respect to c of the critical points $zc_{1}(c)$ and $zc_{2}(c)$: $dzc_{1}(c)/dc$. The iteration is given by $z_{k+1}=g(z_{k},c)$ (starting in $zc_{1}(c)$ and $zc_{2}(c)$), and the derivative $z'_{k}$ (with respect to c) is calculated by
       $z'_{k+1}=z'_{k}g'(z_{k},c)+(d/dc)g(z_{k},c)$
starting with $z'_{0}=dzc_{1}(c)/dc$ and $dzc_{2}(c)/dc$.
We let f(z), $h_{1}(z)$ and $h_{2}(z)$ be respectively $z^{5}$, -iz and 1, and $z^{2}$, i(z - 1/z)/√2 and i(z + 1/z)/√2 (first and second picture below). In the last case the four parts meet in the points ±(√2 ± i√2)/2 which correspond to the points ±i belonging to the usual Mandelbrot set.
Let us now assume that g(z, c) is the rational function given by Newton iteration for the polynomial $f(z)=(z-1)(z^{2}-c)$, that is, $g(z,c)=z-f(z)/f'(z)=(2z^{3}-z^{2}-c)/(3z^{2}-2z-c)$. The critical points are the solutions to the equation g'(z, c) = 0, and as $g'(z,c)=f(z)f^{(2)}(z)/f'(z)^{2}$, the critical points are the roots of f(z) = 0 (in our case 1 and ±√c) and the roots of $f^{(2)}(z)=0$ (in our case 1/3). As a critical point which is a root of f(z) = 0 is a fixed point for g(z, c), the second of the critical points used in the construction of the Mandelbrot set (that is, $zc_{2}(c)$) must be one of the roots of $f^{(2)}(z)$. In our concrete case we construct the Mandelbrot set from only one critical point: $zc_{1}(c)=zc_{2}(c)=1/3$, so that only the boundary of the Mandelbrot set is drawn (third picture).
We have mentioned above that if the terminus of $zc_{1}$ is not ∞, then it is most likely a finite attracting cycle that is not super-attracting, and if not, there can be a fault in the colour of the pixel, but this is without significance in practice. However, in our just mentioned case where g(z, c) comes from Newton iteration, all the iterations (or rather, all the Fatou domains) outside the Mandelbrot set are super-attracting, therefore we must correct the formulas for the real iteration number and for the distance function by introducing log in the formulas.
* The Mandelbrot set for $-icz^{5}+1$
* The Mandelbrot set for (i(c - 1/c)/√2)$z^{2}$ + (i(c + 1/c)/√2)
* The Mandelbrot set for Newton iteration for $(z-1)(z^{2}-c)$

### Drawing Mandelbrot and Julia Sets in Practice

A Julia set for a rational complex function is so well-defined and natural that, like with some other mathematical concepts, we are inclined to say that it belongs to nature: if they have computers in another world, they will also definitely have Julia sets. Also the definition of a Mandelbrot set is simple and obvious, and the drawing procedure must necessarily be in this way: we enter the coefficients of the two polynomials in some way, and then either some pairs of critical points are found automatically or a pair is chosen graphically by clicking in a picture where all the critical points are shown. Hereafter the Mandelbrot set appears, and we can zoom in and alter the colouring. We go to the Julia sets by pressing a key so that the point in the centre of the window can be moved by the arrows, and when we have chosen a point (usually on the boundary of the Mandelbrot set), the procedure for the Julia set is exactly the same as that for the Mandelbrot set.
When you draw a large picture, you ought to draw it at least twice as large as intended, and then reduce it so that the boundary is no longer only one colour. This will lessen the often sharp character of the boundary and it will remove dots arising from impossible calculations.