# Pictures of Julia and Mandelbrot Sets/The Julia set and the Fatou domains

Let $f(z)$ be a differentiable mapping from the complex plane $\mathbb {C}$ into itself. We assume first that $f(z)$ is differentiable as a complex function, that is, that $f(z)$ is a holomorphic function and therefore differentiable as many times as we like. Moreover we assume that $f(z)$ is rational, that is, $f(z)=p(z)/q(z)$, where both $p(z)$ and $q(z)$ are complex polynomials. If the degrees of $p(z)$ and $q(z)$ are m and n, respectively, we call d = m - n the degree of $f(z)$.
The theory of the Julia sets starts with this question: what can happen when we iterate a point z, that is, what happens when we form the sequence $z_{k}$ (k = 0, 1, 2, ...) where $z_{k+1}=f(z_{k})$ and $z_{0}=z$.

### The three possibilities

Each sequence of iteration falls within one of these three classes:
          1: The sequence converges towards a finite cycle of points, and all the points within a sufficiently small neighbourhood of z converge towards the same cycle.
          2: The sequence goes into a finite cycle of (finite) polygon shaped or (infinite) annular shaped revolving movements, and all the points within a sufficiently small neighbourhood of z go into similar but concentrically lying movements.
          3: The sequence goes into a finite cycle, but z is isolated having this property, or: for all the points w within a sufficiently small neighbourhood of z, the distance between the iterations of z and w is larger than the distance between z and w.
In the first case the cycle is attracting, in the second it is neutral (in this case there is a finite cycle which is centre for the movements) and in the third case the sequence of iteration is repelling.
The set of points z, whose sequences of iteration converge to the same attracting cycle or go into the same neutral cycle, is an open set called a Fatou domain of $f(z)$. The complement to the union of these domains (the points satisfying condition 3) is a closed set called the Julia set of $f(z)$.
The Julia set is always non-empty and uncountable, and it is infinitely thin (without interior points). It is left invariant by $f(z)$, and here the sequences of iteration behave chaotically (apart from a countable number of points whose sequence is finite). The Julia set can be a simple curve, but it is usually a fractal.
The mean theorem on iteration of a complex rational function is:
             Each of the Fatou domains has the same boundary
The common boundary is consequently the Julia set. This means that each point of the Julia set is a point of accumulation for each of the Fatou domains.
If there are more than two Fatou domains, we can infer that the Julia set must be a fractal, because each point of the Julia set has points of more than two different open sets infinitely close, but this is "impossible" since the plane is only two-dimensional.
Therefore, if we construct $f(z)$ in a particular way, we can know for certain that the Julia set is a fractal. This is the case for Newton iteration for solving an equation $g(z)=0$. Here $f(z)=z-g(z)/g'(z)$ and the solutions (that can be found by iteration) belong to different Fatou domains (consisting of the points iterating to that solution). The first picture shows the Julia set for the Newton iteration for $g(z)=z^{5}-1$. But a Julia set can be a fractal for other reasons, the next picture shows a Julia set for an iteration of the form $1000(1-z)/(8-4z+2z^{2}-z^{3})+c$, and here there is only one Fatou domain.

### The critical points

To begin with, we must find all the Fatou domains. As a Fatou domain is determined if we know a single point in it, we must find a set of points such that each Fatou domain contains at least one of these. This is easily done, because:
             Each of the Fatou domains contains at least one critical point of $f(z)$
A critical point of $f(z)$ is a (finite) point z satisfying $f'(z)=0$, or z = ∞, if the degree d of $f(z)$ is at least two, or if $f(z)=1/g(z)+c$ for some c and a rational function $g(z)$ satisfying this condition.
As we have presupposed that f(z) is rational, this means that there is only a finite number of Fatou domains.
We can find the solutions to $f'(z)=0$ by Newton iteration: if z* is a solution, a point near z* is iterated towards z* by $z$ → $z-f'(z)/f''(z)$. We can apply Newton iteration on a large number of regularly situated points in the plane, and register the different critical points (if the start point belongs to the Julia set of the iteration, it doesn't necessarily lead to a solution, likewise, we cannot be completely sure that we will catch all critical points, but for our task we should not care about this).
Here we will only deal with the attracting Fatou domains: a neutral domain cannot be coloured in a natural way, and unless $f(z)$ is particularly chosen, it is improbable in practice that the Fatou domain is neutral.
We can find the different attracting Fatou domains in the following way: We iterate each of the critical points a large number of times (or stop if the iterated point is numerically larger than a given large number), so that the iterated point z* is very near its terminus, which is possibly a cycle containing ∞, and we continue the iteration until the point is very near z* again. The number r(z*) of iterations needed for this is the order of the cycle. Hereafter we register the different cycles by removing the points z* belonging to a formerly registered cycle. This set of points corresponds to the set of Fatou domains.
A Fatou domain can contain several critical points, and from the number of the critical points in the Fatou domains we can say something about the connectedness of the Julia set: the fewer critical points in the Fatou domains, the more connected the Julia set.

### The attraction of the cycle

In order to colour a Fatou domain in a natural and smooth way, besides the order of the cycle we must know its attraction $\alpha$ - a real number > 1:
For iteration towards an attracting cycle of order r, we have that if z* is a point of the cycle, then $f(f(...f(z*)))=z*$ (the r-fold composition), and the attraction is the number $\alpha =1/|(d(f(f(...f(z))))/dz)_{z=z*}|$. Note that $(d(f(f(...f(z))))/dz)_{z=z*}$ = the product of $f'(z_{i})$ for the r points of the cycle. If w is a point very near z* and $w_{r}$ is w iterated r times, we have that $\alpha =$lim$_{w→z*}$$|w-z*|/|w_{r}-z*|$.
However, this number $\alpha$ can be ∞, namely if the cycle contains a critical point (meaning that the critical point is iterated into itself after r iterations), and in this case the Fatou domain (and the cycle) is called super-attracting. We now set $\alpha =$lim$_{w→z*}$$log|w_{r}-z*|/log|w-z*|$ or $\alpha =$lim$_{w→∞}$$log|w_{r}|/log|w|$ if z* = ∞.
In the last case, that is, ∞ being a critical point and belonging to the cycle, we have |d| > 1 and $\alpha =|d|^{r}$. In this case we assume that ∞ is a fixed point (r = 1), so that d ≥ 2 and $\alpha =d$ (we thus ignore a function such as $1/(z-c)^{2}+c$, for which the attracting cycle is {c, ∞}).
In a case using Newton iteration to solve an equation $g(z)=0$ (so that $f(z)=z-g(z)/g'(z)$), the Fatou domains (containing a solution) are super-attracting, and $\alpha =2$ (if the solution is not a multiple root).

### Colouring the Fatou domains

Our method of colouring is based on the real iteration number, which is connected with the potential function $\phi (z)$ of the Fatou domain. In the three cases the potential function is given by:
    $\phi (z)=$lim$_{k→∞}$$1/(|z_{kr}-z*|\alpha ^{k})$ (non-super-attraction)
    $\phi (z)=$lim$_{k→∞}$$log(1/|z_{kr}-z*|)/\alpha ^{k}$ (super-attraction)
    $\phi (z)=$lim$_{k→∞}$$log|z_{k}|/d^{k}$ (d ≥ 2 and z* = ∞)
The real iteration number depends on the choice of a very small number $\epsilon$ (for iteration towards a finite cycle) and a very large number N (e.g. 10$^{100}$, for iteration towards ∞), and the sequence generated by z is set to stop when either $|z_{k}-z*|<\epsilon$ for one of the points z* (corresponding to the Fatou domains) or $|z_{k}|>N$, or when a chosen maximum number M of iterations is reached (which means that we have hit the Julia set, although this is not very probable).
If the cycle is not a fixed point, we must divide the iteration number k by the order r of the cycle, and take the integral part of this number.
If we calculate $\phi (z)$ for the k that stops the iteration, and replace $|z_{k}-z*|$ or $|z_{k}|$ by $\epsilon$ or N, respectively, we must replace the iteration number k by a real number, and this is the real iteration number. It is found by subtracting from k a number in the interval [0, 1[, and in the three cases this is given by:
    $log(\epsilon /|z_{k}-z*|)/log(\alpha )$ (non-super-attraction)
    $log(log|z_{k}-z*|/log(\epsilon ))/log(\alpha )$ (super-attraction)
    $log(log|z_{k}|/log(N))/log(d)$ (d ≥ 2 and z* = ∞)
In order to do the colouring, we must have a selection of cyclic colour scales: either pictures or scales constructed mathematically or manually by choosing some colours and connecting them in a continuous way. If the scales contain H colours (e.g. 600), we number the colours from 0 to H-1. Then we multiply the real iteration number by a number determining the density of the colours in the picture, and take the integral part of this product modulo H. The density is in reality the most important factor in the colouring and if it is chosen carefully, we can get a nice play of colours. However, some fractal motives seem to be impossible to colour satisfactorily and in these cases we have to leave the picture in black-and-white or in a moderate grey tone.

### Colouring the Julia set

In order to get a nice picture, we must also colour the Julia set, since otherwise the Julia set is only visible through the colouring of the Fatou domains, and this colouring changes vigorously near the Julia set, giving a muddy look (it is possible to avoid this by choosing the colour scale and the density carefully). A point z belongs to the Julia set if the iteration does not stop, that is, if we have reached the chosen maximum number of iterations, M. But as the Julia set is infinitely thin, and as we only perform calculations for regularly situated points, in practice we cannot colour the Julia set in this way. But happily there exists a formula that (up to a constant factor) estimates the distance from the points z outside the Julia set to the Julia set. This formula is associated to a Fatou domain, and the number given by the formula is the more correct the closer we come to the Julia set, so that the deviation is without significance.
The distance function is the function $\delta (z)=\phi (z)/|\phi '(z)|$ (see the section Julia and Mandelbrot sets for non-complex functions), whose equipotential lines must lie approximately regularly. In the formula appears the derivative $z'_{k}$ of $z_{k}$ with respect to z. But as $z_{k}=f(f(...f(z)))$ (the k-fold composition), $z'_{k}$ is the product of the numbers $f'(z_{i})$ (i = 0, 1, ..., k-1), and this sequence can be calculated recursively by $z'_{k+1}=f'(z_{k})z'_{k}$ and $z'_{0}=1$ (before the calculation of the next iteration $z_{k+1}=f(z_{k})$). In the three cases we have:
    $\delta (z)=$lim$_{k→∞}$$|z_{kr}-z*|/|z'_{kr}|$ (non-super-attraction)
    $\delta (z)=$lim$_{k→∞}$$log|z_{kr}-z*||z_{kr}-z*|/|z'_{kr}|$ (super-attraction)
    $\delta (z)=$lim$_{k→∞}$$log|z_{k}||z_{k}|/|z'_{k}|$ (d ≥ 2 and z* = ∞)
If this number (calculated for the last iteration number kr - to be divided by r) is smaller that a given small number, we colour the point z dark-blue, for instance.

### Lighting-effect

We can make the colouring more attractive for some motives by using lighting-effect. We imagine that we plot the potential function or the distance function over the plane with the fractal and that we enlight the generated hilly landscape from a given direction (determined by two angles) and look at it vertically downwards. For each point we perform the calculations of the real iteration number for two points more, very close to this, one in the x-direction and the other in the y-direction. The three values of the real iteration number form a little triangle in the space, and we form the scalar product of the normal (unit) vector to the triangle by the unit vector in the direction of the light. After multiplying the scalar product by a number determining the effect of the light, we add this number to the real iteration number (multiplied by the density number).
Instead of the real iteration number, we can also use the corresponding real number constructed from the distance function. The real iteration number usually gives the best result. Using the distance function is equivalent to forming a fractal landscape and looking at it vertically downwards.
The effect is usually best when $f(z)$ is a polynomial and when the cycle is super-attracting, because singularities of the potential function or the distance function give bulges, which can spoil the colouring.

### The field lines

In a Fatou domain (that is not neutral) there is a system of lines orthogonal to the system of equipotential lines, and a line of this system is called a field line. If we colour the Fatou domain according to the iteration number (and not the real iteration number), the bands of iteration show the course of the equipotential lines, and so also the course of the field lines. If the iteration is towards ∞, we can easily show the course of the field lines, namely by altering the colour according to whether the last point in the sequence is above or below the x-axis, but in this case (more precisely: when the Fatou domain is super-attracting) we cannot draw the field lines coherently (because we use the argument of the product of $f'(z_{i})$ for the points of the cycle). For an attracting cycle C, the field lines issue from the points of the cycle and from the (infinite number of) points that iterate into a point of the cycle. And the field lines end on the Julia set in points that are non-chaotic (that is, generating a finite cycle).
Let r be the order of the cycle C and let z* be a point in C. We have $f(f(...f(z*)))=z*$ (the r-fold composition), and we define the complex number $\alpha$ by
    $\alpha =(d(f(f(...f(z))))/dz)_{z=z*}$.
If the points of C are $z_{i}(i=1,2,...,r,z_{1}=z*)$, $\alpha$ is the product of the r numbers $f'(z_{i})$. The real number 1/$|\alpha |$ is the attraction of the cycle, and our assumption that the cycle is neither neutral nor super-attracting, means that 1 < 1/$|\alpha |$ < ∞. The point z* is a fixed point for $f(f(...f(z)))$, and near this point the map $f(f(...f(z)))$ has (in connection with field lines) character of a rotation with the argument $\beta$ of $\alpha$ (so that $\alpha =|\alpha |e^{\beta i}$).
In order to colour the Fatou domain, we have chosen a small number $\epsilon$ and set the sequences of iteration $z_{k}(k=0,1,2,...,z_{0}=z)$ to stop when $|z_{k}-z*|<\epsilon$, and we colour the point z according to the number k (or the real iteration number, if we prefer a smooth colouring). If we choose a direction from z* given by an angle $\theta$, the field line issuing from z* in this direction consists of the points z such that the argument $\psi$ of the number $z_{k}-z*$ satisfies the condition
    $\psi -k\beta =\theta (mod2\pi )$.
For if we pass an iteration band in the direction of the field lines (and away from the cycle), the iteration number k is increased by 1 and the number $\psi$ is increased by $\beta$, therefore the number $\psi -k\beta (mod2\pi )$ is constant along the field line.
A colouring of the field lines of the Fatou domain means that we colour the spaces between pairs of field lines: we choose a number of regularly situated directions issuing from z*, and in each of these directions we choose two directions around this direction. As it can happen, that the two bounding field lines do not end in the same point of the Julia set, our coloured field lines can ramify (endlessly) in their way towards the Julia set. We can colour on the basis of the distance to the centre line of the field line, and we can mix this colouring with the usual colouring.
Let n be the number of field lines and let t be their relative thickness (a number in the interval [0, 1]). For the point z, we have calculated the number $\psi -k\beta (mod2\pi )$, and z belongs to a field line if the number $v=(\psi -k\beta (mod2\pi ))/(2\pi )$ (in the interval [0, 1]) satisfies |v - i/n| < t/(2n) for one of the integers i = 0, 1, ..., n, and we can use the number |v - i/n|/(t/(2n)) (in the interval [0, 1] - the relative distance to the centre of the field line) to the colouring.
In the first picture, the function is of the form $z/2+1/(z-z^{3}/6)+c$ and we have only coloured a single Fatou domain. The second picture shows that field lines can be made very decorative (the function is of the form $z/(1+z^{3})+c$).
A (coloured) field line is divided up by the iteration bands, and such a part can be put into a ono-to-one correspondence with the unit square: the one coordinate is the relative distance to one of the bounding field lines, this number is (v - i/n)/(t/(2n)) + 1/2, the other is the relative distance to the inner iteration band, this number is the non-integral part of the real iteration number. Therefore we can put pictures into the field lines. As many as we desire, if we index them according to the iteration number and the number of the field line. However, it seems to be difficult to find fractal motives suitable for placing of pictures - if the intention is a picture of some artistic value. But we can restrict the drawing to the field lines (and possibly introduce transparency in the inlaid pictures), and let the domain outside the field lines be another fractal motif (third picture).

### Filled-in Julia sets

The complement to a Fatou domain is called a filled-in Julia set. It is the union of the Julia set and the other Fatou domains. The outer Fatou domain is usually that containing ∞, and the filled-in Julia set is usually coloured black, like the Mandelbrot set. The program is easier to write, but it runs more slowly, because the maximum iteration number is reached for the black points. As the fine Julia sets frequently only have a single Fatou domain, you can as well make such an easier program that only colours a single Fatou domain. You choose a point in the outer Fatou domain and iterate this a large number of times in order to find the attracting cycle, and then the filled-in Julia set consists of the points that are not iterated towards this cycle. If the degree of the rational function is at least two, the filled-in Julia set for the Fatou domain containing ∞ consists of the point whose sequence of iteration remains bounded.