The Fractal Program Ratio


The program draws the Mandelbrot and the Julia sets for a family of iterations of the form z → f(z) + ρ, where f(z) is a rational complex function f(z) = p(z)/q(z) for which the numerator p(z) and the denominator q(z) have real coefficients and degrees not exceeding eight. For instance f(z) can be the function (2 - 5z3)/(-1 - 6z + 6z2), and for this function are here two sections of the Mandelbrot set:


And here is the Julia set for the centre of the spiral (click on the picture and on some of the following to see the picture in its original size):

Begin by drawing some of the enclosed pictures: in a "formula" or a "julia" document remove the number in the name and start the program. The drawing stops when a key is pressed and the program is closed by pressing Esc two times. The brief instruction "Ratio_instruction" ought to be printed out and consulted during the work with the program.

For the Julia sets the whole plane can be coloured (and not only a single Fatou domain), and a lighting-effect can be introduced so that the picture looks like a landscape seen from above and illuminated from one side. The picture can be saved in the form of a file containing all the information necessary for the colouring, so that the final colouring can be made later and possibly with a newly constructed colour scale. You can make pictures of "unlimited" size, and because the drawing time can be long (possibly many hours) for large pictures or computation-demanding formulas, the drawing can be divided into parts (eg. for execution on two computers) or made in stages (and the picture is not lost in the event of a break in the circuit). This Julia set for the function (1 - z2)/(z - 0.01z2 + 0.005z3) is composed of four parts:

Beside the window with the picture is a window showing the numbers determining the colouring:

Enter the function

When the program is started (for a new function) enter first the degree n of the numerator and its n+1 coefficients (which are real numbers) and then the degree m of the denominator and its m+1 coefficients (a mark shows the length of the column of numbers). After this, one or two so-called critical points (which are complex numbers and so corresponding to points in the plane) have to be chosen. Unless you during the entering press a (casual) letter key, the program automatically calculates the critical points you most probably will choose. The manual procedure is decribed below. Hereafter the Mandelbrot set appears.

The colouring

When a picture is drawn you can change the colouring. For the colour outside the black (which is the Mandelbrot set or the uncoloured Fatou domains of a Julia set), enter a two-figure number. The cursor must be at the number and you can scroll the numbers. When editing, the cursor must always be within the window. If both the figures are non-zero, one of the predefined colour scales is applied (there are accordingly 81 to choose from), otherwise the colour is (immediately) white. The colour scales can be seen with the program "Scale". The numbers have to be scrolled, having pressed Shift the numbers are scrolled is in larger steps, and key P produces a picture of the scale (eg. to use for picture treatment). The parameters determining the colour scales are enumerated in the txt-document "colours". This document must be in the same folder as the program. The colour scales are to be regarded as temporary: a colour scale must be adapted to the actual motif, and you should make your colour scales yourself. The parameters in "colours" can be adjusted with the program "Edit". A colour scale consists of 720 colours and is cyclic, as the beginning is a continuation of the end:

If you have such a picture of a colour scale, the program can use it. The picture must be in BMP format and have a width of about 720 pixels (the height needs only to be 1 pixel) and its name must be a two-figure number (eg. "09.bmp"). These pictures are put in a folder named "sca", and their numbers ought to be less than 10 or divisible by 10, since the scale will otherwise replace the scale from "colours".

The colour scale is displaced by entering a pc or by scrolling, and it is used in the opposite order by pressing the key with the two arrows (a minus-sign then appears before the displacing pc). Density/iter. is a decimal number determining how close the colours are lying. It is normally between 5 and 30, and if correctly chosen a nice play of colours can arise. Having pressed Shift the numbers are scrolled is in larger steps.

The section

To change the section, place the cursor below the numbers and press one of the keys 4-9, a rectangle then appears. Its position is managed by the keys 4-7 and its size by keys 8 and 9. The position is fine-adjusted by the arrow keys and the size is fine-adjusted after pressing key 0. The rectangle is removed by key Z if, by mistake, you have got it ahead.

Start the drawing by key 1

A new drawing is started by key 1 and stopped by pressing a (random) letter or number key. If you want to zoom in quickly, after a sufficiently large portion of the picture has been drawn you can press key 8 several times.

The iteration number

The maximum number of iterations can be adjusted by keys 2 and 3. The number is adjusted automatically when zooming, but it can be necessary to adjust it manually. If the black is indistinct it must be increased, and as the black is drawn slowly when the maximum iteration number is large, you can provisionally increase the speed by lowering the number. In the event of iteration towards a cycle of finite points, the maximum iteration number must match the number "precision":

The precision

When the iteration is not towards infinity, a parameter called precision comes into play. Its meaning is the following: the colour of a point is determined by a sequence of iterations converging towards a cycle of finite points. The iteration stops when a point is within a given distance from some point in that cycle, and this distance is the precision multiplied by "the width of the section" and divided by 100. The precision can be adjusted by key T. The number is not adjusted automatically at zooming, because this will lead to a deviation in the colouring, but it ought to be updated regularly, and this can be executed by pressing key T followed by Enter. To start with, the precision number is 0.5, but it often has to be reduced, possibly to 0.0001, at the same time as the maximum iteration number is increased. These two numbers must match each other, otherwise there will be flaws in the colouring. For iteration towards infinity, the distance is chosen beforehand and its precise value is of no matter: the iteration stops when a point is numerically larger than 10150.

The boundary

The thickness of the boundary is adjusted by key R. A decimal numeral around 1 is entered, it is normally 0.25-2 and must be chosen smaller when a large picture is to be drawn. The colour of the boundary is changed by key B. The RGB-values of the colour are shown and you can enter or scroll, and then close the menu by left or right clicking or by lowering the cursor.

If you press key R or T by mistake, which is to adjust the thickness of the boundary or the precision number respectively, just press on Enter.

Save Mandelbrot

Pressing key S produces a txt-document named "formula" and containing all the information relating to the Mandelbrot set. When such a document exists, the program draws this Mandelbrot set when started (so that its name must be changed, eg. by a figure addition, if it is not to be used). Pressing key D produces a file named "mandelbrot", which besides the information contains the picture so that it appears instantly.

The Julia sets: key J

By keying J you go from the Mandelbrot set to the Julia sets of the formula. A Julia set is associated to every point in the plane, and the most interesting ones are those associated to points on the boundary of the Mandelbrot set. The point in the centre of the window is shown, and it can be moved by keys 4-7 and (in size and steps of one pixel) by the arrow keys. Hereafter key 1 starts the drawing of the Julia set, and after this the procedure is the same as for the Mandelbrot sets. Pressing key J again brings you back to the Mandelbrot set.

Save Julia

Pressing key S when a Julia set is ahead produces a txt-document named "julia" and containing all the information relating to the Julia set. When such a document exists, the program draws this Julia set when started. Pressing key D produces a file named "julia" (but with another icon), which besides the information contains the picture.

Displace/close the window

By using the arrow keys in the number keyboard, the window can be displaced on the desktop - the position is saved in a txt-document named "position". Pressing Pause during the drawing closes the window until the drawing is finished (in this period the program can only be closed from the list over the running "processes": Ctrl+Alt+Del).

The critical points

The Mandelbrot set is constructed on the basis of two critical points. They are solutions to the equation f'(z) = 0. If the degree of the numerator is at least two larger than the degree of the denominator, or conversely, if the degree of the denominator is at least two larger than the degree of the numerator, infinity is also a critical point. In the first case infinity is usually chosen as the first critical point. The critical points must be chosen just after the entering of the function. If you do nothing during the entering, the program automatically calculates critical points.

By the automatical calculation you cannot be completely sure that the program will find all the critical points, but this does not matter in practice. The program calculates a sequence of pairs and takes at the start the first. By the horizontal arrow keys you can choose another pair of the sequence. This sequence is constructed by first ordering the individual finite critical points and by choosing a sequence of pairs of finite critical points:

The individual finite critical points are ordered in this way: the real come before the imaginary and they are in both cases ordered according to increasing numerical value.

The pairs of finite critical points are chosen and ordered in this way: the sequence starts with all the pairs lying symmetrically around the x-axis (if such pairs exist) and they are ordered according to decreasing distance, and hereafter comes a pair consisting of two points having maximum distance of abscissas (if such a pair exists) - if there is only one real critical point, this point is paired with itself.

The sequence of critical pairs is in the three cases:

1 If the degree of the numerator is at least two larger than the degree of the denominator, the sequence starts with infinity paired with the individual finite critical points and it ends with the pairs of finite critical points.

2 If the degree of the denominator is at least two larger than the degree of the numerator, the sequence starts with the pairs of finite critical points and it ends with infinity paired with the individual finite critical points.

3 Otherwise (that is, if the polynomials have equal degree or if the one is of degree one larger than the other), the sequence is the (chosen) pairs of finite critical points.

The following two pictures show sections of the Mandelbrot set for 1 - z2 + z5/(2 + 4z), the sections are at precisely the same locality, but different critical points are applied - note that the shapes match each other at some places:

The manual procedure is activated by pressing a casual letter key (except F and N) during the entering of the function. A finite critical point is chosen by choosing a point - graphically or by entering coordinates - which by an iterative procedure can lead to the critical point. If the degree of the numerator is at least two larger than the degree of the denominator, you must press key F if you want two finite critical points, otherwise infinity is chosen as the first point, so that only the second point has to be chosen. If the first two coefficients of the numerator are 0 (so that it begins with z2 or a larger power of z), then 0 is a critical point. If two finite critical points are needed, you can use the fact that the critical points are lying symmetrically around the x-axis, so that if there is an imaginary critical point, then there is one more (the conjugate), and this is chosen by pressing key C during the first choice. When the picture of the critical points is drawn, the point in the centre can be moved by using keys 4-7 and the arrow keys, and the iterative procedure is started by key 1. If the section has to be changed, key 0 produces a rectangle to be managed by keys 4-9, and hereafter key 1 starts the drawing of a new picture, and the point in the centre appears again. If the degree of the denominator is at least two larger than the degree of the numerator, infinity is a critical point, and this is chosen (as the first or the second critical point) by choosing the manual procedure and pressing a (casual) letter key instead of entering a number.

When the necessary critical points are chosen, the Mandelbrot set is drawn.

It is recommended now and then to choose the points graphically, in order to acquire experience of their constellation for the different formulas. The chosen critical points ought to have a good distance from each other. You can quite well let the two critical points be equal, this means that the Mandelbrot set will be empty, but the boundary is still drawn and is (sometimes only partly) usable to find the Julia sets.

The program always performs the automatical calculation of a sequence of critical points, even if the manual procedure is chosen. When a Mandelbrot set is drawn (or a part of it) and you press a horizontal arrow key, you go to the next or the former pair of the sequence.

The two sorts of Mandelbrot sets

The Mandelbrot set for the family of iterations z → f(z) + ρ is constructed in this way: For a point ρ we let first the first critical point iterate many times (for instance the maximum iteration number of times) so that the sequence comes very close to its terminal position (which usually is a finite cycle of points), and then we examine if the second critical point iterates towards that cycle. If this is not the case, the point ρ belongs to the Mandelbrot set and is coloured black, otherwise its colour is determined by a real number whose integral part is the number of iterations needed to bring the second critical point within a given small distance from the cycle (divided by the order of the cycle).

If the degree of the numerator is at least two larger than the degree of the denominator, infinity is a critical point, and it is also a fixed point for the iteration z → f(z) + ρ (for every ρ). This means that infinity only can appear as the first point of the critical pair, and that the Mandebrot set is the set of points ρ such that the second critical point does not iterate towards infinity by z → f(z) + ρ. Furthermore, infinity is super-attracting fixed point (for every ρ), and this means than the Mandelbrot set is drawn much faster than when both the critical points are finite. The Mandelbrot set of the preceding two pictures is of the super-attracting type. Here is a Mandelbrot set of the non-super-attracting type - the function is 1/z - (z + 0.001z2)/(1 - 0.002z + 0.001z2) = (1 - 0.002z - 0.999z2 - 0.001z3)/(z - 0.002z2 + 0.001z3):

This type - constructed from two finite critical points - usually exhibits a greater variety of shapes. When seen as a whole, however, a Mandelbrot set is always ugly, but it can have interesting and even beautiful localities, and it is (some features of) the local structure that in a pure form are exhibited in the Julia sets. If you zoom in at the vertical stripe you will see a structure like the one in this Julia set for a point in that stripe - see the picture in full size and note that the boundary is chosen thinner in the large picture:

Inversion of the critical points

The Mandelbrot set above is symmetric around the x-axis (because it is constructed from critical points lying symmetrically around the x-axis), but this symmetry does not necessarily concern the colouring and the boundary. The reason is that if a point ρ is to be coloured, then the two critical points must iterate towards the same cycle by z → f(z) + ρ, but the colour of ρ is determined by the behaviour of the iteration of the second critical point. More precisely: the colour is determined by the value in the second critical point of the potential function for the Fatou domain associated to ρ that contains the first critical point. And 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 ρ vary. When ρ passes the boundary of the Mandelbrot set, one of the two critical points comes outside the Fatou domain (or the Fatou domain disappears), and it is only when it is the second critical point that leaves the Fatou domain, that we get the natural colouring and the boundary. We can in this case get the natural colouring and the boundary by inverting the critical points. The critical points are inverted by key Q.

Infinity is a critical point, but it is not used

When the degree of the numerator is at least two larger than the degree of the denominator, infinity is a critical point, and it is usually chosen as the first critical point. But if there are at least two finite critical points, we can as well choose these. This is done by using the manual procedure of choosing critical points and press key F before the entering of the function is finished. After this, a press on key F alternate between the use of infinity and the first finite as critical point.

The function -z2/2 + z3/3 has infinity and 0 and 1 as critical points. If we construct the Mandelbrot set from the two finite points 0 and 1, we can find the just mentioned phenomenon: the colouring and the boundary match not necessarily the Mandelbrot set, but we can achieve this by inversion of the critical points:


Besides infinity, the function 1 - z2/2! + z4/4! (which is a rational approximation to cos(z)) has 0 and 2.499... as critical points. I this section of the plane we can for the critical pairs (0, infinity), (0, 2.499), and (2.499, 0) draw these pictures:


The use of the two finite critical points means that a mini-mandelbrot appears, and if we invert the points we get another colouring and boundary. As the self-similar structure of the Julia set associated to a point has features that are a reflection of the form of the Mandelbrot set and its boundary around the point, such pictures with use of different combinations of the critical points give valuable information about the Julia sets. We know, for instance, that the Julia set for the usual function z2 and the "centre" of the main cardioid (namely 0) is a circle. This means that the circular form appears in the Julia sets for the centres of the mini-mandelbrots. Therefore we can infer that we in the structure of the Julia set for the centre of the mini-mandelbrot above, partly will find the structure of the first picture around this point and partly will find the circular form. The two next pictures show this Julia set - note that the Julia set point is not precisely the centre of the mini-mandelbrot, because of the irregularities in the colouring of the interior of the main circle. In the two last pictures above the two boundaries intersect each other, therefore the Julia set for a point of their intersection must have features of the structures of the two boundaries around the point. Such pictures for different combinations of critical points, can be drawn by editing in a "formula" document.

For this type of Mandelbrot sets, where there is iteration towards infinity as well as towards finite cycles, these two domains can be coloured separately. By Shift and a mouse click, you can alternate between the two edition windows - the subordinate window is marked "second".


When the number density/slope is larger than zero, a relief structure arises in the picture. We imagine a hilly country lying above the coloured domain and that light is sent in from a given direction specified by two angles. There are two possibilities for the height above the ground: it can be proportional to the so-called potential function (associated to the real iteration number) or to the distance function (which is an estimation of the distance into the boundary). The potential function usually gives the best effect (the distance function is best for fractal landscapes and is used in the program Landscape). By keying M you can alternate between the two methods of drawing:


"Density/slope" is a decimal number (about 4-40) determining the effect of the height, it is adjusted in the same way as "density/iter.". For large "density/slope", the "density/iter." must be small, possibly zero. The lighting-effect demands three times as many computations, so the picture is drawn more slowly when density/slope is larger than zero.

For the Mandelbrot set the lighting-effect works only for iteration towards infinity (that is when the degree of the numerator is at least two larger than the degree of the denominator), because otherwise the picture would be drawn too slowly.

The Fatou domains

In opposition to a Mandelbrot set, which has an interior (coloured black), so that it is only the boundary of the set that is a fractal, a Julia set is infinitely thin, and thus identical with its boundary, and the set is usually a fractal. The domain outside the Julia set is composed of one or more Fatou domains. Each Fatou domain contains at least one critical point, and it is characterized by the fact that all the sequences of iteration starting in the Fatou domain behave exactly equal, that is, have the same terminus (usually a finite cycle of points).

By pressing key W, only a single Fatou domain is drawn, namely that containing the first point of the critical pair (used in the construction of the Mandelbrot set). If there are more than two Fatou domains, you can go to the others by the arrow keys (they are ordered by the ordering of the critical points). If there are no more than one Fatou domain, you should use this procedure of drawing. By pressing key W again, you go back to the procedure of drawing all the Fatou domains.

The drawing of the Fatou domains is initially based on the automatical calculation of critical points. If there are faults in the drawing, either because the number precision and the maximum iteration number are not optimally chosen or because a critical point is missing in the automatical calculation, you can start a new drawing based on another method of registering the Fatou domains. Press key K (two times, the first in order to reset), then a drawing begins whose only aim is to register the Fatou domains. It is slow, but the picture needs only to be drawn until the boundary is reached. By key K (again) the picture is drawn on the basis of the registered information.

If the degree of the numerator is at least two larger than the degree of the denominator (and infinity is chosen as a critical point), and if you use the procedure of drawing only a single Fatou domain (key W), then you can by key U alter between the drawing of the Fatou domain containing infinity and the Fatou domain containing the finite critical point.

When there are more than two Fatou domains, you can, after pressing key X, colour one of them separately. By Shift and a mouse click, you can alternate between the two edition windows. After a redrawing a Fatou domain is coloured separately, if it is not the right, you can choose another by the horizontal arrow keys. If the degree of the numerator is at least two larger than the degree of the denominator (and infinity is chosen as a critical point), you need not press key X, as the Fatou domain containing infinity is always coloured separately.

In this Julia set there are two Fatou domains, and there is lighting-effect in the top one - the function is the sixth-degree polynomial approximation to cosine:


For some Julia sets, where the iteration is towards a cycle of finite points, the drawing is much quicker than usual, and this is because the cycle is super-attracting. This sort of iteration has relationship with iteration towards infinity, which is a super-attracting fixed point (when the degree of the numerator is at least two larger than the degree of the denominator). If a cycle is super-attracting, this is noted in the edition window. There is an infinity of points in the Mandelbrot set for which the associated Julia set has a super-attracting cycle, namely the "centres" of the domains it consists of. For the usual Mandelbrot set, the Julia set for the centre of the central domain is a circle.

Functions of Newton-type

A special type of Julia set for which there is super-attraction, is those that graphically illustrate the iteration procedure of Newton for the solution of an equation: If g(z) is a (rational) complex function, you can (in certain cases) find a solution to the equation g(z) = 0 by an iterative procedure starting at a suitably chosen (but otherwise casual) point, and this procedure is given by:

z → z - g(z)/g'(z).

The function f(z) = z - g(z)/g'(z) is rational (it can be written f(z) = (zg'(z) - g(z))/g'(z)), and so we can use it in our Mandelbrot procedure (that is, we can consider the family of iterations z → f(z) + ρ). For this type of function, the critical points are just the solutions to the equation g(z) = 0, and the iterations are always towards cycles of finite points. The function in the above picture of a "formula" document is the iterative procedure for the solution of the fourth-degree equation z4 = 1, and therefore the critical points are the points (1, 0), (0, 1), (-1, 0) og (0, -1). If we choose the real 1 and -1 as the two critical points in the construction of a Mandelbrot set, we can find this motif in the Mandelbrot set:

The Julia set for the point 0 (that is ρ = 0) is "the Julia set for the iterative procedure": a point outside the Julia set (that is, belonging to a Fatou domain) always leads to a solution of the equation g(z) = 0, and a point belonging to the Julia set (that is, lying on the boundary) only leads to a solution when it is itself a solution. For the fifth-degree equation z5 + z3/3 = 1 the iterative procedure is z → (1 + 2z3/3 + 4z5)/(z2 + 5z4), and the Julia set for this (that is, for the point ρ = 0, which is the centre of the central domain of the Mandelbrot set) looks like this:

You can enter a function of this type in the program by entering only the function g(z) (of the equation g(z) = 0). Press key N before entering, and then enter the degree n of g(z) and its n+1 coefficients. For the function above, n is 5 and the coefficients are -1, 0, 0, 0.333333, 0, 1, and when going to the Julia sets, the point in the centre is not to be moved. You can also enter the function via a "formula" document: write the coefficients of the equation instead of the coefficients of the numerator and write a casual letter on the line just after.

Entering the function via an incomplete "formula" or "julia" document

The document "formula and julia" explains the meaning of the numbers in the documents "formula" and "julia" (there must be the indicated spaces between the lines and there must not be other empty spaces). For the function (1 + 3z4)/(4z3), the very first lines in which the function is specified look like this:

That is: the degree of the numerator and the degree of denominator - space - the coefficients of the numerator - space - the coefficients of the denominator - space - and hereafter the other numbers that specify the Mandelbrot set. If you omit these other numbers and write a (casual) letter at the last space, that is, on the line after the last coefficient of the denominator (and press Enter), then the program draws the default Mandelbrot set for this function. You can thus, instead of entering the function by the program, enter it via an incomplete "formula" document - in this way you can easily make alterations in the numbers. If you let the casual letter be m, the program goes to the manual choice of critical points.

In the "formula" document the coordinates of the two critical points (separated by spaces) are written just after the function. If the degree of the numerator is at least two larger than the degree of the denominator and infinity is chosen as the first critical point, the finite critical point is written two times. If the degree of the denominator is at least two larger than the degree of the numerator and infinity is chosen as a critical point (the first or the second), this is indicated by writing three zeros ("000") instead of the x-coordinate. You can in this case replace a finite critical point by infinity, by writing three zeros instead of one of the coordinates (you can as well let both the critical points be infinity, and thus draw Mandelbrot sets that have no finite critical points, for instance the Mandelbrot set for 1/z2 + c).

A "julia" document starts with the two coordinates of the Julia set point, then follows the numbers that specifies the function and after these the other numbers that specify the Julia set. You can, in the same way as for the Mandelbrot set, draw the default Julia set belonging to the function and the Julia set point, via an incomplete "julia" document - provided that the procedure of drawing a single Fatou domain is used (key W). By repeatedly small alterations in the coordinates of the Julia set point (the very first two number of the document), you can (without the Mandelbrot set) find an interesting position of the Julia set point.

Also in a complete "formula" or "julia" document you can with profit make other alterations, instead of doing this via the program - the thickness of boundary, for instance.

The critical points appear in the "julia" document, primary in order to give possibility for reconstructing the Mandelbrot set, and because the first is used by the procedure of drawing a single Fatou domain. The last numbers in a "julia" document are information about the Fatou domains. This part begins with a whole number determined by the character of the Julia set. The number 0 means that the iteration is towards infinity and that only this Fatou domain is drawn, there are no more numbers. The number -1 means that the iteration is towards a cycle of finite points and that only this Fatou domain is drawn, and the following numbers are then: the two coordinates of a point in the cycle, the order of the cycle (that is, the number of its points), the figure 1 or 0 (depending on whether the cycle is super-attracting or not), and finally a number that is a measure for the attraction of the cycle. These five numbers (after -1) are not read by the program, therefore you can make alteration in the Julia set point (the first two number of the document) so that the other information (determining section and colouring) is preserved. If the number opening the last part is positive, then all the Fatou domains are drawn and the number states their number (or rather: the number of the finite ones), and the subsequent blocks of numbers have the meaning just mentioned.

False critical points

If, in a "formula" document, you enter other critical points than the true, the Mandelbrot set will be deformed. It loses its characteristic shape and at some places it will look like a Julia set. Furthermore, it will no longer work as an "atlas" of the Julia sets: there will be localities where the structure of the Julia set is not a reflection of the structure of the Mandelbrot set. But if you are interested in funny Mandelbrot sets, you can enter funny critical points in "formula".

The picture as a file

By pressing key P the picture is redrawn in a chosen size and rendered as a BMP file (to the folder with the program). The width in pixels is entered - 1024 or 1600 is normal desktop size and 6000-8000 is poster size.

File to picture and File to average picture mean that the creation of a file named "pre_pict.bmp" is commenced. "Average" means that four times as many points are involved and that the average value is used. By this procedure the often sharp character of the boundary is lessened - as well as dots arising from impossible calculations. The drawing can be broken off by Pause and continued by restarting the program. When the drawing is finished the program closes and "pre_pict" is converted to a true BMP file named "pict". File to edition is described below.

Pressing key P during the creation of the file "pre_pict", produces a picture in BMP format named "pict0" of the portion of the window drawn up to now. It can be used to test the quality of the large picture, or it can be used instead of this if the motif is upright, in this case it is placed in the left-hand side of the window and the drawing is stopped when, for instance, half of the window is drawn.

If you want to make an extremely large picture (eg. of 16000 pixels which will seize almost 600 Mb), it can be necessary to compose it of four (or possibly sixteen) pictures. The programs "Part_formula" and "Part_julia" create four new "formula" and "julia" documents with name additions "-11", "-12", "-21" and "-22". When these four pictures are drawn and named "11", "12", "21" and "22", they are composed by the program "ComposeFour".

Edition in the colour scales

File to edition (after pressing key P) means that a file is created containing (for every point in the picture) all the (real) numbers that determine the colouring but which are independent of the actual colouring (that is, scale and density). The file is for situations where you want to postpone the final colouring or to construct a new colour scale. It has the name "fracfile" and it is opened with the program "Edit". When this program is started the picture is shown as before, and when a scale number is chosen, a mouse click produces a scheme containing all the numbers determining the colouring: first the parameters of the colour scale and then the parameters from "Ratio" (displacement, density, ...). The procedure of adjustment is as before, and a new mouse click brings you back to the choice of scale menu. A press on key P during the treatment, produces the picture as a BMP file named "pict" (and the program is not closed). It is recommended to halve the picture so that the colour values (like "average picture") become average values. Because the file "fracfile" is very large, the picture should not be too large, and the real intention with the procedure is in fact the construction of new colour scales (for temporary or permanent use). The picture should be redrawn with "Ratio" and the new scale (by using the saved "formula" or "julia" document). This picture was at first coloured only in grey scale and saved as "fracfile", and then later recoloured with "Edit":


The adjustments of the parameters of a colour scale are saved by pressing key G (until a new use of key G is designated). Using key S, the edited colour scale is saved permanently, that is: the parameters in "colours" are replaced by the new parameters. Key S may, of course be used while "Edit" is running, but this should be done with caution. You must have a back-up of "colours" or rather you should copy the line in "colours" to be edited and put it at a free place (and change its number to the number of that place). You can for instance let the colour numbers 51-99 be for experiments. For systematic construction of colour scales, you should edit manually in "colours". Related colour scales should follow each other in the numbering. The first scale - scale 11 - is the default scale. At the construction of a colour scale you ought to choose a fractal motif which is characteristic for the motives the scale is to be applied to.

The first number of a line in "colours" is the number of the scale, and then follows a cipher 1 or 2 denoting the type of the scale.

Scales of type 1

A colour is immediately (in the computer) given by its composition of the three primary colours red, green and blue, and their shares are measured in whole numbers between 0 and 255. This triple of numbers is the set of RGB values of the colour. The colours correspond accordingly to the entire points in a cube with side length 256 as seen in the left-hand picture, the right-hand picture shows a section of the cube:


If you go regularly along a closed curve in the cube, you have a colour scale. As the shape of this curve we have chosen the composition of two half-ellipses with common 1st axis and lying in the same plane. If the two half-ellipses are lying opposite each other, they are divided regularly into 360 parts, but otherwise (that is, when the curve is shaped like a half-moon) the division is finer at the end points (the tips of the half-moon). Such a double-ellipse is determined by: the centre whose coordinates are an RGB triple, the length of the 1st axis (or rather, half of it, called radius), the length of the 2nd axis as a percentage of the 1st axis, the length of the "3rd axis" as a percentage of the 2nd axis (negative percentage for half-moon shape), the two angles (angle x,y and angle z) determining the plane of the curve and finally the angle (orientation) determining the direction of the 1st axis in that plane. This method can produce a lot of beautiful colour scales, and it has the advantage that an RGB value can be kept constant. But we also have a construction in which the end points of the 1st axis form parts of the parameters and which is based on the so-called HSL values of the colours:

Scales of type 2

The most natural way to characterise a colour, is through the association of hue, saturation and luminance. The hue of a colour is the pure colour corresponding to the colour. The pure colours can be represented by the points on a circumference, and can thus be measured by an angle (in degrees). Red has hue 0, green 120 and blue -120. We have however changed the concept of hue a little, because it is necessary in connection with fractals: the pure colours are too glaring and they have varying intensity (the primary colours red, green and blue have less intensity than the secondary colours yellow, cyan and magenta). This gives no troubles in the former construction, because the double-ellipse does not usually come near the pure colours. But in our type 2 construction the double-ellipse can actually consist of pure colours. We have therefore adjusted their definition and levelled their intensity, so our HSL values are not exactly the same as the usual.

The saturation of a colour is its degree of pureness, that is, its deviation from grey, and it is measured in pc. The luminance of a colour is the intensity of the colour. For instance it can go from 0, corresponding to black, over 100, corresponding to the pure colours, and to 200, corresponding to white. We will however let 0 corresponds to the pure colours, -100 corresponds to black and 100 corresponds to white. The pure colours are at the mean level, and all the colours at that level correspond to the points in a circle: the centre corresponds to mean-grey and the points on the periphery correspond to the pure colours. Every other colour is obtained from a colour in this circle by mixing with black or white. Thus the colours can be parametrisized by the points in a double-cone of height 2 x 100 and radius 100. However, in order to get a model with which the shape of the ellipse harmonizes more naturally, we transform the double-cone to a sphere (of radius 100) by expansion along the axis of rotation. A double-ellipse in this sphere is given by two HSL values being the end points of the 1st axis, an angle (orientation) in a plane orthogonal to the 1st axis determining the direction of the 2nd axis (and the 3nd axis), and the length of the 2nd and the 3nd axis as a percentage of respectively the 1st axis and the 2nd axis.

The two types and other types

For both types of construction, nine parameters determine the double-ellipse. These are in the document "colours" enumerated after the number and the type of the scale.

When you adjust the parameters with "Edit" and points of the double-ellipse come outside the cube or the sphere, a clear discolouring springs up.

As a help to find the plane of the double-ellipse, two programs "Cube" and "Sphere" are enclosed, showing the colours in the sections of the cube and the sphere. In "Cube" a point is shown which the section pass-through (the centre of the double-ellipse) and in "Sphere" two points are shown (the end points of the 1st axis). The angles and the RGB and HSL values respectively are adjusted by scrolling.


An obvious way to colour scale construction would be to go along a polygon in the cube of RGB values - and possibly smooth out the colours. However the polygon might then consist of at least six points, and that would mean 18 parameters in contrast to our nine, of which some are secondary. Such a construction ought to be based on considerations of coloured squares - possibly supported by the rules of chromatology:

If you resize this picture so that its width becomes of only 6 pixels, and then resize it to 720 pixels with the program "Adjust", you will get this colour scale:

The program Adjust

The program "Adjust" can perform some modifications of a colour scale given as a picture. The picture (in BMP format) is given the name "00", and you must have a back-up since the program modifies the file (in such pictures of colour scales only the first horizontal line is read, and if you are not sure that the colours are exactly constant along the vertical lines, then give the picture the name "000" and, it will be modified (by average) and given the name "00"). By left clicking the scale is extended at the cursor by putting in two colours (given by interpolation) - an operation to be done several times within the domain to be extended. After this the colours can be smoothed out by pressing key N or M, replacing each colour by the average of the adjacent respectively 10 and 20 colours. By right clicking, 20 colours are removed at both sides of the cursor, replaced by the average of the adjacent colours and smoothed out. By pressing key D, the width of the picture is changed to 720 pixels. By pressing the arrow keys, the scale is displaced.

You can also use picture treatment - on a picture of a fractal as well as a colour scale - see this site: ImageEdit.

Examples of motives

Cutting out of a former shown motif from the Mandelbrot set for 1 - z2 + z5/(2 + 4z), here with lighting-effect:

Lower down in this The Sea Horse Valley we can find this motif:

Julia set for the previous Mandelbrot set:

Section of the Mandelbrot set for 4(1 - z)2/(1 + 4z + 2z2 - z3):

Julia set from the previous Mandelbrot set:

Julia set for 1/(z + z3):

Julia set for z4(1 - 5z)/(1 + 5z):

Section of the Mandelbrot set for (2 - z4)/(z - 2z3):

Julia set from the previous Mandelbrot set:

Julia set for (1 - z2)/(z(1 - z(1 - z)/20)):

Julia set for (1 + 0.5z - z2)/(-0.01 + z - 0.02z2 + 0.015z3):

Julia set for (1 - 2z2)/(z - 0.01z2 + 0.002z3):

Julia set for (0.01 - z2)/(z - 0.1z2 + 0.03z3):

Julia set for (1 - z)/(0.008 - 0.004z + 0.002z2 - 0.001z3):

Julia set for (1 - z2/2 + z4/20)/(1 - z2/2) - texture is introduced in the picture:

Julia set for (-1 + z2 - z3/2 + 3z4)/(-1/2 + 2z - 3z2/4 + 4z3):

Julia set for 1/(3z2) - z/6:

Section of the Mandelbrot set for z2 + 0.009/z:

Julia set for z2:

In this motif from the right-hand side of The Sea Horse Valley lighting-effect is used with the distance function and vertical direction of light:

Julia set from the left-hand side of The Sea Horse Valley (the picture is of 8000 pixels):

Continuations of this site: RatioField and Landscape

The fractal site

Updated: Juni 2020

This site is a subsection of