Let be a differentiable mapping from the complex plane into itself. We assume first that is differentiable as a complex function, that is, that is a holomorphic function and therefore differentiable as many times as we like. Moreover we assume that is rational, that is, , where both and are complex polynomials. If the degrees of and are m and n, respectively, we call d = m  n the degree of .
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 (k = 0, 1, 2, ...) where and .
The three possibilitiesEdit
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 . The complement to the union of these domains (the points satisfying condition 3) is a closed set called the Julia set of .
The Julia set is always nonempty and uncountable, and it is infinitely thin (without interior points). It is left invariant by , 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 twodimensional.
Therefore, if we construct 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 . Here 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 . But a Julia set can be a fractal for other reasons, the next picture shows a Julia set for an iteration of the form , and here there is only one Fatou domain.
The critical pointsEdit
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


A critical point of is a (finite) point z satisfying , or z = ∞, if the degree d of is at least two, or if for some c and a rational function 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 by Newton iteration: if z* is a solution, a point near z* is iterated towards z* by → . 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 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 cycleEdit
In order to colour a Fatou domain in a natural and smooth way, besides the order of the cycle we must know its attraction  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 (the rfold composition), and the attraction is the number . Note that = the product of for the r points of the cycle. If w is a point very near z* and is w iterated r times, we have that lim_{w→z*}.
However, this number 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 superattracting. We now set lim_{w→z*} or lim_{w→∞} if z* = ∞.
In the last case, that is, ∞ being a critical point and belonging to the cycle, we have d > 1 and . In this case we assume that ∞ is a fixed point (r = 1), so that d ≥ 2 and (we thus ignore a function such as , for which the attracting cycle is {c, ∞}).
In a case using Newton iteration to solve an equation (so that ), the Fatou domains (containing a solution) are superattracting, and (if the solution is not a multiple root).
Colouring the Fatou domainsEdit
Our method of colouring is based on the real iteration number, which is connected with the potential function of the Fatou domain. In the three cases the potential function is given by:
 lim_{k→∞} (nonsuperattraction)
 lim_{k→∞} (superattraction)
 lim_{k→∞} (d ≥ 2 and z* = ∞)
The real iteration number depends on the choice of a very small number (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 for one of the points z* (corresponding to the Fatou domains) or , 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 for the k that stops the iteration, and replace or by 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:
 (nonsuperattraction)
 (superattraction)
 (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 H1. 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 blackandwhite or in a moderate grey tone.
Colouring the Julia setEdit
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 (see the section Julia and Mandelbrot sets for noncomplex functions), whose equipotential lines must lie approximately regularly. In the formula appears the derivative of with respect to z. But as (the kfold composition), is the product of the numbers (i = 0, 1, ..., k1), and this sequence can be calculated recursively by and (before the calculation of the next iteration ). In the three cases we have:
 lim_{k→∞} (nonsuperattraction)
 lim_{k→∞} (superattraction)
 lim_{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 darkblue, for instance.
LightingeffectEdit
We can make the colouring more attractive for some motives by using lightingeffect. 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 xdirection and the other in the ydirection. 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 is a polynomial and when the cycle is superattracting, because singularities of the potential function or the distance function give bulges, which can spoil the colouring.
The field linesEdit
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 xaxis, but in this case (more precisely: when the Fatou domain is superattracting) we cannot draw the field lines coherently (because we use the argument of the product of 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 nonchaotic (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 (the rfold composition), and we define the complex number by
 .
If the points of C are , is the product of the r numbers . The real number 1/ is the attraction of the cycle, and our assumption that the cycle is neither neutral nor superattracting, means that 1 < 1/ < ∞. The point z* is a fixed point for , and near this point the map has (in connection with field lines) character of a rotation with the argument of (so that ).
In order to colour the Fatou domain, we have chosen a small number and set the sequences of iteration to stop when , 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 , the field line issuing from z* in this direction consists of the points z such that the argument of the number satisfies the condition
 .
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 is increased by , therefore the number 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 , and z belongs to a field line if the number (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 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 ).
A (coloured) field line is divided up by the iteration bands, and such a part can be put into a onotoone 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 nonintegral 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).
Filledin Julia setsEdit
The complement to a Fatou domain is called a filledin 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 filledin 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 filledin 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 filledin Julia set for the Fatou domain containing ∞ consists of the point whose sequence of iteration remains bounded.