4. More theoretical fractal information 

Table of contents

 4A. More maths 

 

 4Aa. 

What are complex numbers? 

 

 4Ab. 

What are the rules to calculate with complex numbers? 

 

 4Ac. 

How can complex numbers be represented graphically? 

 

 4Ad. 

What are critical points? 

 

 4Ae. 

What are orbits? 

 

 4Af. 

What are quaternions? 

 

 4Ag. 

What are hypercomplex numbers?

 

 4Ah. 

What is fractal dimension?

 

 4Ai. 

Is it really necessary to know that? 

 

 4Aj. 

Where can I find good tutorials or useful sites on the web? 

 

 

 4B. Chaos 

 

 4Ba. 

What is chaos? 

 

 

 4Bb. 

Are fractals and chaos synonymous? 

 

 

 4C. More about some fractal types 

 

 4Ca. 

What are Julia sets? 

 

 

 4Cb. 

What is the Mandelbrot set? 

 

 4Cc. 

These images are curious but in no way spectacular. Why? 

 

 4Cd. 

What is the connection between the Mandelbrot set and Julia sets? 

 

 4Ce. 

How are the Julia and Mandelbrot sets computed? 

 

 4Cf. 

Where can I have more information about the Mandelbrot set? 

 

 4Cg. 

Are Julia and Mandelbrot sets the only types of fractals using complex numbers? 

 

 4Ch. 

What are the images of quaternions? 

 

 4Ci. 

What is z-buffer? 

 

 4Cj. 

What are the maths and the programming peculiarities of fractal music? 

 

 


 4A. More maths 


 4Aa

What are complex numbers? 


   We know that in traditional arithmetic, whether a positive or a negative number is squared, the result is always positive. It is why, in this traditional arithmetic, the square root of a negative number has no meaning. But mathematicians said “why not?”, and they invented imaginary numbers. They named i as the square root of -1 and said that imaginary numbers can be written as a.i, with a being any real number. Moreover they invented complex numbers z with the following structure:

z=x+yi

where x is the real part of the number and y the imaginary part.
   The most surprising in this story is that these strange creatures, born in the mind of mathematicians, are widely used to solve very practical problems, for example in electricity.


 4Ab

What are the rules to calculate with complex numbers? 


   The arithmetic of complex numbers works mostly like regular algebra with a couple of additional formulas:
(note: a, b are real numbers, x, y are complex, i is the square root of -1)

Powers of i:
i2= -1
Addition:
(a+i*b)+(c+i*d)=(a+c)+i*(b+d)
Multiplication:
(a+i*b)*(c+i*d)=a*c-b*d+i*(a*d+b*c)
Division:
(a+i*b)/(c+i*d)=(a+i*b)*(c-i*d)/(c2+d2)
Exponentiation:
exp(a+i*b)=exp(a)*(cos(b)+i*sin(b))
Sine:
sin(x)=(exp(i*x)-exp(-i*x))/(2*i)
Cosine:
cos(x)=(exp(i*x)+exp(-i*x))/2
Modulus (or magnitude):
|a+i*b|=sqrt(a2+b2)
Log:
log(a+i*b)=log(|a+i*b|)+i*arctan(b/a) (note: log is multivalued.)
Log (polar coordinates):
log(re(i*a))=log(r)+i*a
Complex powers:
xy=exp(y*log(x))
de Moivre’s theorem:
xn=rn[cos(n*a)+i*sin(n*a)] (where n is an integer)

   More details can be found in any complex analysis book. See also:


 4Ac

How can complex numbers be represented graphically? 


   Very simply: in z=x+yi, x and y are real numbers, so they and can be considered as the coordinates of a point: the x axis being the real axis, and the y axis being the imaginary one (the unit used to graduate this axis represent i). The plane defined by this system of coordinates is called the complex plane.

A point of coordinates (x,y) in the complex plane. Remember Pythagoras: the length of the segment (0,0)(x,y) is the square root of x2+y2. This value is the modulus (or magnitude) of the complex number (see above, and 4Ce for the explanation of the Mandelbrot set).

figure from Garr Lystad (http://www.lystad.us/fractals/docfiles/higher-dimensions.html)


 4Ad

What are critical points? 


   When computing the Mandelbrot set, zero is the critical point of the polynomial z=z2+c; that is, a point where the derivative (here 2z) is equal to 0. If you replace z2+c with a different function, the starting value will have to be modified. E.g. for z2+z, the critical point is 2z+1=0, so start with z=-0.5. In some cases, there may be multiple critical values, so they should all be tested.
   Critical points are important because, according to a Fatou’s result: every attracting cycle for a polynomial or rational function attracts at least one critical point. Thus, testing the critical point will show if there is any stable attractive cycle. Using less abstract words, it means that when a Mandelbrot-like set is computed, every iteration must start with the value of the critical point.
   Notice that you can precompute the first Mandelbrot iteration by starting with z=c instead of z=0, since 02+c=c.


 4Ae

What are orbits? 


   When a complex polynomial is iterated, the point representing z runs through successive positions which define a trajectory, named the orbit of the point. The properties of the orbit can be used to color the point of the complex plane used to do the iteration (see question 5Ba and following). For example, Fractint offers a very nice option to see the orbit of a point: strike the <o> key, then the <l> key when the Mandelbrot or a Julia set is displayed on the screen and place the cursor on different points of the image. It is easy to see that the orbit never escapes when the cursor is in the set, and that it escapes out of the limits of the window (in fact, towards infinity) when the cursor is on a brightly colored zone outside the set.
 

 

A point inside the Mandelbrot set never escapes

 

 

This point outside the set escapes after a few iterations

 

   


   Note that the iteration starts with z=(0,0) which is the point at the center of  the images.

 


 4Af

What are quaternions? 


   Quaternions have 4 components (1 real and 3 imaginaries) a+ib+jc+kd compared to the 2 components of complex numbers. Operations such as additions and multiplications can be performed on quaternions, but multiplication is not commutative.
   Quaternions satisfy the rules

i2= j2 = k2= -1
ij = -ji = k
jk = -kj = i
ki = -ik = j

   When quaternions are used to write fractal formulas, the corresponding figures are in a 4D space, and obviously that constitutes a problem to draw such an image. By keeping constant one of the terms, it is possible to get a 3D “slice” of the quaternionic fractal and to draw a projection (2D) on the screen of this 3D figure (see question 4Ch). See:


 4Ag

What are hypercomplex numbers? 


   The following text is made of of selected quotations from the Fractint manual (with permission from Tim Wegner) with a few modifications.

   Note that this expression is confusing. In several texts it is said that hypercomplex numbers are quaternions and octonions (numbers with 1 real part and 7 imaginary parts). It is not the meaning of hypercomplex here. Hamilton, who invented quaternions in 1843, considered an  alternative called the hypercomplex number system. Unlike quaternions, the hypercomplex numbers satisfy the commutative law of multiplication. The law which fails is the field property, that states that all non-zero elements of a field have a multiplicative inverse. For a non-zero hypercomplex number h, the multiplicative inverse 1/h does not always exist.
   As with quaternions, we will define multiplication in terms of the basis vectors 1, i, j, and k, but with subtly different rules.
   Multiplication rules for hypercomplex basis vectors:

ij=k jk=-i ki=-j
ji=k kj=-i ik=-j
ii=jj=-kk=-1
ijk=1

   Note that now ij=kand ji=k (and similarly for other products of pairs of basis vectors), so the commutative law holds.
   Hypercomplex numbers can be represented as a pair of complex numbers in the following way:

Let h=x+yi+zj+wk.
a=(x-w)+i(y+z)
b=(x+w)+i(y-z)

   The numbers a and b are complex numbers. We can represent h as the pair of complex numbers (a,b). Conversely, if we have a hypercomplex number given to us in the form (a,b), we can solve for x, y,z, and w.
   Fractal programs can create 3-D fractals using the formula h’=fn(h)+c, where “fn” is any of the built-in functions of the program because for that, hypercomplex numbers are easier to handle than quaternions.
   Where fnis sqr(), this is the famous Mandelbrot formula, generalized to four dimensions.


 4Ah

What is fractal dimension? 


   Everybody knows that the dimension of a point is 0, the dimension of a line is 1, the dimension of a surface is 2, the dimension of a volume is 3. And since Einstein discovered his theory of relativity, we know that we live in a space-time continuum of dimension 4.
   Things are not always so simple. This will be discussed mainly for the case of linear figures. Think that we may have to measure very complex and convoluted linear figures, and that the unit of length is a straight segment of conventional length (in fact, for the metric system, the unit of length was, for a long time, a ruler made of platinum-iridium alloy which was at the Pavillon de Breteuil at Sèvres, France; this ruler still exists, but the unit of length is based now on the speed of light).
   How can we measure convoluted lines with a straight ruler? We apply, again and again, the ruler along the curve. If the length of the ruler is negligible compared to the curvature or the irregularities of the line, we can approach the real length. This length is the number of unit segments used multiplied by the length of the segment, when this length tends towards 0. In other words, if we divide by 2 the length of the unit, we multiply by 2 the number of segments used to measure the line, but this is true only when the segment length tends towards 0. Or again:

   The fractal dimension D, for a linear figure, is defined as

         log (L2/L1)
     D = -----------    when S tends towards 0
         log (S1/S2)

where L1, L2 are the lengths measured on the curve (expressed in number of units), and S1, S2 are the sizes of the unit (i.e.. the scale) used for the measurements.
   Two things are new in this definition:

  • the phrase “fractal dimension”, which is used here because this formula can be used to calculate the dimension of classic as well as fractal figures. When applied to classic linear figures, this formula results in D=1.
  • the introduction of logarithms. This is justified if you think of a variant of this formula applied to surfaces: in this case, when you divide by 3, for example, the side of a square unit, you multiply by 9 (32) the number of squares needed to cover a given surface. You can see that log(32)/3=2 log(3)/log(3)=2 which is the Euclidean dimension of surfaces.

   If we use this formula to calculate the dimension of the von Koch curve, it shows that, when a unit segment of length L/3 is used, the length of the curve is multiplied by 4 and the ratio log 4/log 3=1.261859507143 which is the fractal dimension of the von Koch curve.
   This great result demonstrates that the dimension of fractal curves is greater than 1. We can prove that, in this case, 1 < D <= 2. This is a general property of fractals. In the same way, for fractal surfaces: 2 < D <= 3.
   Fractal dimension is generally referred to as the Hausdorff-Besicovitch dimension, but there are many approaches of the concept of dimension in mathematics, and this is a very complex field.

   For more information:


 4Ai

Is it really necessary to know that? 


   Are you afraid? Don’t worry. All this knowledge is very useful for those who want to create their own formulas, but there are thousand of formulas that you can freely use (thanks to all their creators). Fractal programs apply all these rules for you very well! If you don’t like math, forget all these formulas; but it is better to understand what complex numbers are... and, perhaps, quaternions and hypercomplex numbers which are employed in some programs.


 4Aj

Where can I find good tutorials or useful sites on the web? 


   There are many pages explaining what are fractals, how to make images, applications of fractals, etc. Here is a short list.

   On fractals and chaos

   And a very famous site were you can find a lot of information, programs...

 4B. Chaos 


 4Ba

What is chaos? 


   Chaos is apparently an unpredictable behavior arising in a deterministic system because of great sensitivity to initial conditions. Chaos arises in a dynamical system if two arbitrarily close starting points diverge exponentially, so that their future behavior is eventually unpredictable.
   Weather is considered chaotic since, arbitrarily, small variations in initial conditions can result in a radically different weather later. This  limits the possibilities of long-term weather forecasting (the canonical example is the possibility of a butterfly’s sneeze affecting the weather enough as to cause a hurricane weeks later).
   Devaney defines a function as chaotic if it has sensitive dependence on initial conditions, it is topologically transitive, and periodic points are dense. In other words, if it is unpredictable, indecomposable, and yet contains regularity.
   Allgood and Yorke define chaos as a trajectory that is exponentially unstable and neither periodic or asymptotically periodic. That is, it oscillates irregularly without settling down.


 4Bb

Are fractals and chaos synonymous? 


   No. Many people do confuse the two domains because, regularly, books or papers about chaos either speak of the two concepts or are illustrated with fractals.
   Fractals and deterministic chaos are mathematical tools to model different kinds of natural phenomena or objects. The keywords in chaos are non linear, unpredictability, sensitivity to initial conditions in spite of the deterministic set of equations describing the phenomenon. On the other hand, the keywords for fractals are self-similarity, invariance of scale. Many fractals are in no way chaotic (Sierpinsky triangle, Koch curve...). However, starting from very different points of view, the two domains have many things in common: many chaotic phenomena exhibit fractal structures (in strange attractors, for example; fractal structure is also obvious in chaotic phenomena due to successive bifurcations such as the logistic equation).

 

from Third Apex to Fractovia (http://www.fractovia.org/what/what_ing4.html)

 

 4C. More about some types of fractal.

 4Ca

What are Julia sets? 


   It has been previously said that when you iterate

z(n+1)=z2(n)+c

where z is the variable and c a constant, interesting fractal images can be obtained. The image will be drawn in the plane defined by the real and imaginary part of z
   It is necessary to compute the iteration of this polynomial for each value of the complex plane. Computers are the perfect tools to do such stupidly repetitive jobs. Doing so, it can be observed that, for some initial values of z, the iteration gives a result which escapes towards infinity, while for others the result remains into more or less narrow limits (it never diverges). If c=0, the iterated polynomial never diverges for all the points within a circle of center 0,0 and of radius 1: nothing very interesting (nor fractal), except that this will help to explain some points of vocabulary. 
   Strictly speaking, the Julia set is the circle itself, and the points contained in the surface limited by the circle are the Fatou set. The limit circle plus the inner points compose the filled-in Julia set.
   For reasonably small values of c (this point will be explained in 4Cd) the set is transformed into more convoluted figures, and now, if you zoom on the limit of this figure, you will see very complex structures (in particular, spirals are often observed). These structures are clearly fractals. But, for many values of c, the set explodes into a dust of points which are not connected, even if they are not obviously distributed randomly. When the Julia set is not connected, it has properties corresponding to a 2D Cantor dust.

 

julia_c.gif (1849 octets)

Connected Julia set

julia_nc.gif (2534 octets)

Disconnected Julia set

 

from http://fractals.iut.u-bordeaux1.fr

   Julia sets can be obtained with polynomials of any degree and any complexity (number of terms, coefficients of the terms, and so on).


 4Cb

What is the Mandelbrot set? 


   The Mandelbrot set is clearly related to the Julia set

z(n+1)=z2(n)+c

but you must distinguish what is different. Now cis not a constant, but a variable, and the set is drawn in the plane defined by the real and imaginary values of c (the Mandelbrot set is drawn in the c plane when the Julia set is drawn in the zplane).
   For each point c of the plane, the polynomial is iterated, starting at  the critical point z=0 (during each iteration for a given point, only z changes, not c; when the result is obtained, the polynomial is iterated for the the next point c of the plane, starting again with z=0).

from Third Apex to Fractovia (http://www.fractovia.org/what/what_ing3.html)

   The Mandelbrot set was first studied by Benoît Mandelbrot (1980). He used the limited graphic capabilities of a computer of that “old” time to explore its characteristics. The name “Mandelbrot set” was given later by Douady and Hubbard (1982).


 4Cc

These images are curious but in no way spectacular. Why? 


   These images represent only the points pertaining to the filled in Julia, or the Mandelbrot sets. But more information can be obtained from the iteration process. The most interesting concerns the points outside the set. Each of them has a distinct behavior and they can be colored according to the way they escape towards infinity. Much will be said later in part 5, but almost all the beautiful colored fractal images are obtained by exploring the properties (translated by varied colors) of points outside but near the boundary of the set. The points inside the set have also different behaviors and this can be used to color them, but these methods are less frequently used.


 4Cd

What is the connection between the Mandelbrot set and Julia sets? 


   There is only one Mandelbrot set, but there are an infinity of Julia sets because c can be any complex number. Each point c in the Mandelbrot set specifies the geometric structure of the corresponding Julia set. If c is in the Mandelbrot set, the Julia set will be connected. If c is not in the Mandelbrot set, the Julia set will be a Cantor dust. In other words, the Mandelbrot set is the set of all the values of c for which the corresponding Julia set is connected.


 4Ce

How are the Julia and Mandelbrot sets computed? 


   The process is rather similar. It has been explained previously that the Mandelbrot set iterates z2+c with z starting at 0 and varying c when the Julia set iterates z^2+c for fixed c and varying starting z values. The question is how to stop the iteration.
   It can be demonstrated that if |z|>2 the value will always escape towards infinity: then, iteration can be stopped for this point.
   |z| is the square root of x2+y2 and is named the modulus of the complex number. 2 is the bailout value for the Julia and Mandelbrot sets. When using a large enough number of iterations (at least one or several hundreds for each point), it can be assumed that almost all the points with |z|<2 pertain to the set (there is a small uncertainty for a few points near the border of the set, and the higher the number of iterations is, the better the precision of the image is).
   Other polynomials need other bailout values, but interesting images might be obtained with bailout values lower than the theoretical one. In fractal art, only the result is important even if slightly heretical from a mathematical point of view.


 4Cf

Where can I have more information about the Mandelbrot set? 


   The Mandelbrot set has aroused a passionate interest. It has been said to be the most complex mathematical object known, a paradox if you remember that its formula is very simple. And yes, it is indeed a very complex object.


 4Cg

Are Julia and Mandelbrot sets the only types of fractals using complex numbers? 


   No. Don’t forget that by using polynomials of higher degree, with various number of terms and having coefficients of various values, you can have a great variety of Mandelbrot-like and Julia-like sets.
   Moreover, the iterations of almost all formulas using complex numbers (in no way related to Julia or Mandelbrot formulas) lead to fractal structures. Fractal programs (with the exception of the simplest) have built in formulas, but also enable the user to enter his own formulas.
   The part of the program which runs user’s formulas is generally named the parser: it interprets (in the case of Ultra Fractal, it compiles) the formula and executes it. With the introduction of conditional loops in the characteristics of the parser, formulas may now be quite complex and are often indeed short programs on their own. If you are not a mathematician, you can freely use thousands of formulas which have been published.


 4Ch

What are the images of quaternions? 


   The first to calculate quaternionic fractals was Alan Norton (1982). Benoît Mandelbrot’s book “The fractal Geometry of Nature” shows two images of quaternionic fractals, and he mentions that the idea (and one of the two images) came from A. Norton.
   Alan Norton’s article was probably the first one on this topic:
“Generation and Display of Geometric Fractals in 3-D” (Computer Graphics, Volume 16 Number 3, July 1982). In that paper there’s a reference to another one:
   Mandelbrot, B. B. and Norton, A. “Fractal Surfaces Defined by Iteration of Rational Functions in the Quaternions”.
   The first web site showing 3D images made by the iteration of polynomials using quaternions seems to be that of Henrik Engstrom, at Chalmers University of Technology (Sweden). They were made with his program QJulia. Unfortunately this site was closed when Henrik Engstrom left this university.
   Other programs have been authored, and several sites show beautiful images of these objects (remark: the old Qjulia can be found at Spanky  http://spanky.triumf.ca/pub/fractals/programs/).
   It has been already said that quaternions are defined in a 4D space.
How can we draw such images? Excerpt from the Frode Gill’s quaternions page, courtesy of the author (http://home.hia.no/~fgill/quatern.html):

It is the 4D-thing that makes Quaternions so exciting, but also difficult to make. We are actually making a film of a 3D object! (But, usually we keep the 4th dimension constant, so we ‘only’ make a still-frame of a 3D object). What I usually do when calculating Quaternions, is scanning a 3D room (having the 4th dimension constant), building up a Z-Buffer, and then ‘ray-tracing’ it.

   Usually, the images of quaternionic fractals are images of the surface of a 3D Julia set seen from outside. To understand this, remember that the filled-in Julia set is the black area in the center of the left image  on section 4Ca. If you imagine a generalized Julia set in the 3D space, the black zone is now a solid object. If you look at this object from outside you see something like the image below.
   But now, remember that quaternions have 4 dimensions. What is the meaning of this fourth dimension? It can be regarded as time, which is the fourth dimension of our world. By keeping this dimension constant, we get a snapshot of the object at a given time.
   A low number of iterations must be used to avoid too complex and confusing details of the structure. It is why they hardly look like fractals but more like modern and abstract sculptures.

   Note that it is possible to use hypercomplex numbers in the same way. An other family of totally unrelated objects, cubic complex polynomials, can also be represented in a 4D space in spite the fact that they only use complex numbers. The explanation of the cubic polynomial maths is perhaps too peculiar to be explained in this FAQ, but there is a good page by Ingvar Kullberg at

For quaternions and hypernions:


 4Ci

What is z-buffer? 


   The principal problem of 3D objects is that they must be drawn on a 2D surface (that of the screen in computer art). The z-buffer is a part of the memory (usually an array) where the positions of each point in the depth dimension are stored. This information is then used to determine what parts of the object are visible and what parts are hidden by those in front of them. In ray-tracing programs, this information is also used to calculate the distance of each point to the light source and therefore its brightness.


 4Cj

What are the maths and the programming peculiarities of fractal music? 


   The mathematics behind fractal music are somewhat the same as those behind fractal images. Some, but not all, iterate on formulae such as the Mandelbrot set. Even here, there is some divergence, as some calculate a note on each iteration while others calculate the note at “escape time”. Yet others use fractal methods that might be unsuitable for images, such as the Morse-Thue algorithm, Sierpinski Triangle, and Koch Snowflake. Other software uses iterated function systems to trace patterns over images and choose note parameters based upon the RGB value of the pixels traversed. Yet others use a “everything but the kitchen sink” approach by allowing the data to come from a variety of sources, then appropriate algorithms applied to the data.

   Most fractal music generators produce output in MIDI form. MIDI files are small, as they don't actually contain the sound, but instructions to your soundcard/sound module/other MIDI-enabled instrument on how to produce the sound. Much like the concept of vectored graphics such as Macromedia Flash. GM (General Midi) supports 128 instruments and 16 channels. GS MIDI supports these standards, but also hundreds of synth-bank variations on the basic 128 instruments, plus audio effects. Notable differences in the quality and sound of the MIDI file occur between the various types of soundcards/devices. Therefore any serious recording of fractal music necessitates recording the MIDI file to a common audio format for public consumption.

   Writing MIDI files can be a daunting task. One helpful midi source for freeware programmers is Piet van Oostrum’s text-to-midi converter (t2mf.) With those routines, and the docs included, a programmer can convert fractal data to text, then convert the text to a midi file. What data is used to create the midi text can vary from the potential of z at an escape point, any data from rendering, or a point’s color index. Since midi involves many variables, length of note, pitch, spacing between notes, etc. different rendering data can be used to control all these simultaneously. This typically requires storing the data in buffers as a fractal is drawn, then converting/scaling it before writing the text file.

Text file written by Musinum for the melody Fractal Lullaby (the extension has been changed from .min to .txt to be compatible with the browsers)

Fractal Lullaby (J.P. L.)

   For reading and writing Standard MIDI Files, you should make use of the freely available C source code that has been floating around the net since the standard was first created. A copy may be found at:

   A nice collection of links to MIDI programming resources is here:

   Also, a great collection of MIDI utilities is Gunter Nagler’s Midi Utilities site. It’s one of the best sites for Midi applications:

   Some programs convert images into music while others generate music by applying various algorithmic and recursive procedures directly, or apply the principle that man-composed music has a spectral density not far from 1/f, as found by Richard F. Voss and John Clarke.

   For more theoretical information on these topics, read:

Table of contents