
Back in the 1970s, computer graphics were at a relatively primitive stage. A lot of them were just wireframe, and this very style became iconic of high technology and the futuristic. The 1979 Disney Film ‘The Black Hole’ was notable for having the longest ever CGI sequence in a feature film up until that time, at around a minute and a half. Here it is:
In the cinema, that looked pretty impressive to me at the time, as I’m sure it did others. However, CGI as we’re familiar with it today also existed, as with NASA’s sequence illustrating the Voyager missions, which was however updated with textures from the mission itself. Then there was Sunstone, also from 1979:
A few years later, there was ‘The Works’ in 1984:
However, by then they should’ve known better, because changes were taking place in mathematics which were reaching some kind of climax by that point, namely research into fractals.
I don’t really understand calculus, but I probably inaccurately think of it in two ways: trying to work out where a wiggly line will go next, and finding the slope of a curve at a particular point, with the emphasis on “point”. It’s where my understanding of maths runs out and therefore a bit of a locked gate for me because of what lies beyond in terms of its practical applications, which I can’t access. Nonetheless I am aware that in 1872, Karl Weierstrass announced his discovery of a function expressed by a wiggly line on a graph which was spiky everywhere, no matter how close you zoomed in on it. This is of course the Weierstrass Function, and looks like this:

The zoomed in bit is to show that it’s spiky on every level. Although it’s a line, there’s no curved or straight stretch anywhere along its length where it isn’t changing direction, no matter how small the difference between the values of x is. This is referred to as “nowhere differentiable”. The function can be expressed thus:

This was the first of a series of curves, infinite really, which became known as fractals. The standard, and wrong, way of describing a fractal is that it’s self-similar. There are many self-similar fractals, such as the Koch Snowflake:
This starts out as a triangle, to whose sides spikes are added, making a partly concave dodecagon, to whose sides spikes are added, making a four dozen-sided shape and so forth ad infinitum. The above shape, partly blurred by the fact that it isn’t a vector image due to the difficulty of using vector graphics on WordPress, has seven iterations and therefore 12 228 sides, or it would have if it was actually drawn as opposed to being a raster image. And we’re back to computer graphics. However, most fractals are not self-similar in that way. The coastline of this island is fractal. The shorter the ruler used to measure it, the longer it gets, and you could be reduced to measuring between the grains of sand on a beach or the bumps on a cliff face, at which point the tides and whether something counts as wet come into consideration, but it isn’t self-similar. There aren’t lots of “little Britains” just off our coast which themselves have littler Britains off theirs and so on, appealing though the idea might be.
A fractal is actually a shape with a non-integral number of dimensions. Whereas a square has two dimensions and a cube three, and a line one, it’s useful to consider dimensionality as having values in between whole numbers. The Koch Snowflake, for example, has about 1.262 dimensions, and Great Britain 1.21. The reason the number of dimensions a fractal has is not integral is that the “size” of some shapes, such as the measure polytopes of the line segment, square, cube and tesseract, can be thought of as its measure to the power of the number of dimensions it has, and this is in those cases a whole number but in the cases of fractals. The Koch Snowflake is a wiggly line which meets itself, but it comes close to filling the area around the perimeter of a roughly hexagonal shape, so it’s neither one-dimensional – it isn’t a line – nor two-dimensional – it isn’t a hexagon or a star – but somewhere in between. However, although these ideal platonic shapes are self-similar, most fractals are not, but that doesn’t stop them from having a fractional or irrational number of dimensions.
The real world is not like the smoothness seen in computer graphics, particularly earlier ones. The three videos at the start of this post are all coolly mathematical and, while difficult to produce, involve simple shapes textures with simple textures. With the aid of fractals, it became easy to generate this kind of picture:
This image dates from around 1982. In ‘The Works’, there is some kind of bumpy terrain and I’m not sure how this was generated. As far as I know, this was first used in a feature film, ‘Star Trek II’, in 1982:
The structure of this clip is quite interesting because it goes from old-style wire frame models through textured rendering of three-dimensional objects and ends with the mapping of a fractally-generated surface. At the end of the Voyager missions to Saturn in late 1980, it was mentioned that the CGI people who had produced the videos of the mission and mapped the textures taken by the Voyagers’ cameras onto models of the planets and moons had left to work on ‘Star Trek II’. I presume this is what they went on to do. Incidentally, this disbanding of the team working on the Voyager projects, which was related to the six-year gap between the Saturn and Uranus encounters, shows the difficulty the kind of societies which send rockets into space have with achieving long-term projects. They couldn’t just keep these people on the payroll for six years while they did nothing, so we get this clip but at what cost? What else didn’t we get and who else was “let go”?
This is a “making of” video of the same:
A further tangential detail: the star field is as seen from ε Indi. Alnitak, Alnilam and Mintaka are seen as lined up near the beginning of the clip, indicating their relatively great distance, and as the commentary mentions, the Sun is visible as part of Ursa Major near the end. The constellation of Indus is opposite that of Ursa Major in the sky – it’s a Southern constellation – and ε Indi is almost twelve light years away. This particular sequence is a milestone in the development of CGI.
Raster scan CGI on flat displays is often quite rationally organised at a fairly low level, in that the screen is seen as a rectangular array of pixels like a graph, with the origin either at a corner or the centre. This means that the famous Mandelbrot Set image – the Apfelmännchen or “apple mannikin” as it’s known in German – is effectively a graph with the X axis running horizontally along the middle of the picture. It’s often difficult to remember that this X axis at the centre is in fact the real number line. These are the actual axes of that graph:
Perhaps surprisingly, zero is near one side of the cardioid (heart shape) whereas intuition would suggest it was at the bottom of Seahorse Valley where the circle and cardioid meet. It can be seen from this graph that the set is based on some kind of calculation involving real numbers, but what about the vertical axis?
The vertical axis represents the so-called imaginary numbers. These are numbers based on a concept which originally arose when it was realised that the square root of minus one seemed to be impossible. Since signs cancel out in multiplication, -1 x -1 is 1, so it clearly isn’t the real number one, and the only option appears to be to invent a second axis and think of numbers as existing on a plane as coördinates. These are known as complex numbers. They have both a real and an imaginary part. The word “imaginary” is used for want of a better term, as in fact these numbers are just as real as “real” numbers. There are also hypercomplex numbers such as quaternions and octonions which are a generalisation of this idea from the plane to space and hyperspace. On the whole, all of these numbers can be added, subtracted and the like, but the operations concerned don’t always have the same properties as those on real numbers. For instance, real number multiplication is commutative: 4 x 5 = 5 x 4. Octonion mutliplication is not, and this is crucial because for reasons I won’t go into here, it leaves the possibility that there is an omniscient observer open – it prevents Bell’s Theorem from being a proof of atheism.
The formula used to generate the Mandelbrot Set is quite simple, but before I get to that I’m briefly going to wallow in complex numbers for a bit. Complex numbers are combinations of real and imaginary numbers, more specifically the sum of a real number and the product of a real and complex number. They are useful, and here are two examples:
AC current is generated by a rotary dynamo and its voltage and current therefore vary as a sine wave – that’s the dynamo spinning. Capacitors and inductors alter this variation. Capacitors delay current, for example. The impedance, which is the opposition of a circuit to a current when voltage is applied. This can be calculated using complex numbers and power consumption can be reduced by doing these calculations to design efficient AC circuits.
An object with a rest mass can never move at the velocity of light because it would have infinite mass. However, if mass can be validly expressed by a complex number, this would not be a problem and therefore if tachyons – particles which only move faster than light – exist, they would have to have complex mass.
Hence complex numbers do have real world applications. They’re not only pure mathematics.
The Mandelbrot Set can be plotted on a plane without explicitly using complex numbers. There are programming languages, such as FORTRAN, which have complex numbers as a data type just as they do real and integer numbers, and in FORTH and other threaded interpretative languages there are ways of defining words which can perform operations on complex numbers as two values on the stack, but this isn’t necessary to plot the Mandelbrot Set, although it is effectively what’s happening when it’s done. The formula for the set is zn+1 = zn2 + c, where z and c are a complex numbers and z is an integer. On a computer screen, each pixel is used as an example of c. This is a QBASIC program to generate the Mandelbrot Set in full:
DECLARE SUB InitPalette ()
DECLARE SUB DrawFractal ()
DECLARE SUB SaveScreen (filename AS STRING, w AS INTEGER, h AS INTEGER)
SCREEN 13
CLS
LINE (0, 0)-(320, 200), 15, BF
CONST w = 320
CONST h = 200
CALL InitPalette
CALL DrawFractal
CALL SaveScreen("MANDELBR.RAW", w, h)
REM This is fractal rendering code, the other functions are to make it look nicer
SUB DrawFractal
DIM sx AS SINGLE
DIM xy AS SINGLE
DIM x AS SINGLE
DIM y AS SINGLE
DIM x2 AS SINGLE
DIM y2 AS SINGLE
DIM p AS INTEGER
DIM r AS INTEGER
DIM g AS INTEGER
DIM B AS INTEGER
CONST maxi = 100
CONST colours = 256
FOR py = 0 TO h - 1
REM scale Y to -1:+1
sy = (py / h) * 2! - 1
FOR px = 0 TO w - 1
REM scale x to -2.5:1
sx = (px / w) * 3.5 - 2.5
vy = 0
vx = 0
i = 0
x = 0
y = 0
x2 = 0
y2 = 0
WHILE (x2 + y2 < 4) AND (i < maxi)
xt = x2 - y2 + sx
y = 2 * x * y + sy
x = xt
x2 = x * x
y2 = y * y
i = i + 1
WEND
c = i / maxi * colours
PSET (px, py), c
NEXT
NEXT
END SUB
REM Changes the palette as the default is not pretty
SUB InitPalette
DIM red AS LONG
DIM green AS LONG
DIM blue AS LONG
DIM colour AS LONG
FOR i = 0 TO 63
blue = i
green = i / 2
red = i / 3
colour = blue * 65536 + green * 256 + red
PALETTE i, colour
PALETTE i + 128, colour
NEXT i
FOR i = 63 TO 0 STEP -1
blue = i
green = i / 2
red = i / 3
colour = blue * 65536 + green * 256 + red
PALETTE i + 64, colour
PALETTE i + 192, colour
NEXT i
END SUB
SUB SaveScreen (filename AS STRING, w AS INTEGER, h AS INTEGER)
OPEN filename FOR OUTPUT AS #1
FOR y = 0 TO h - 1
FOR x = 0 TO w - 1
PRINT #1, CHR$(POINT(x, y));
NEXT x
NEXT y
CLOSE #1
END SUB
This is in QBASIC, Microsoft’s BASIC for DOS. It’s possible to zoom in by changing the ranges of py and sy in the control loops, and also their step value. The above code is both fancy and not optimised.

The first time I plotted the set, it was on an Acorn Electron. This was an eight-bit computer based on BBC Micro architecture, and was notably cut down from the glories of its predecessor. One of the ways in which this was done was by providing only four dynamic RAM chips and using them to store bytes in two halves, which meant that every time the CPU interacted with memory the clock speed was effectively halved – it had to fetch or store one byte in two cycles. It was possible to speed the computer up somewhat by fooling the video hardware into thinking it was using a text mode, because this skipped two scan lines per line of text and there was no need for the CPU to halt when the video hardware accessed video RAM, but this spoilt the display. The video modes I used to display the set were MODE 2 and MODE 0. The first of these is an eight-colour (supposèdly sixteen but half are merely flashing versions of the others) 256 x 160 display, and has the benefit of being colourful while not being very detailed. The other is 640 x 256 in two colours, allowing a lot of detail and to be honest I prefer it. Doing it on a BBC Micro would, for the reasons just mentioned, be faster than on an Electron, but that’s what I had. However, it’s dead easy to speed it up by only calculating the top or bottom half and mirroring it on the other half of the display. I think it took about eight hours to do the whole set.
I also did Seahorse Valley, which doesn’t benefit from any kind of reflection hack, and it took twenty hours. Not having a printer, I recorded it on a VHS cassette, which I still have somewhere. There are ways of speeding it up a lot, such as writing it in machine code and using fixed point arithmetic rather than floating point, and not bothering to calculate large blank bits of the picture, but I didn’t do those. Around the same time as I was doing this, a DOS program called FRACTINT was developed which managed to do it using only integer arithmetic and was therefore much faster.
The Mandelbrot Set is among the most complex objects in the Universe, or rather the Multiverse. It’s often claimed that the human brain is this, but in fact this object is far more complex because no matter how far you zoom in, there’s always more. It can also be extended into four dimensions because each point on it can be used to generate a Julia Set, such as this:

The Mandelbrot Set itself does not reflect anything in the physical world, or rather the formula used to generate it seems not to have any practical application, but there is another set which is very similar and does represent something real, in the area of magnetism. This formula:


There’s a blog mentioning this here.
Because of the visual effectiveness of fractal and this kind of imaging, it was suggested at some point that the nature of mathematical discovery had changed, because it was now possible to visualise much of what woul previously have seemed highly obscure. This has been seen as both bad and good. It’s good in that it makes maths more accessible and appealing, but it may also lead towards a bias towards the kind of maths that can do this kind of thing.
Finally, it occurs to me that my metaphor for consciousness being a property of matter like magnetism could be extended meaningfully to model a dying brain. What if the way consciousness works involves a whole, fully awake and living brain as one of the stable states, the “dark bits” as it were on the Mandelbrot Set, but that on falling asleep, having a seizure, being starved of oxygen or under the influence of drugs it fragments consciousness physically into little areas throughout the brain which are individually conscious but not unified? And what if this could be modelled mathematically? I don’t know where I’m going with this but it sounds promising.



