The curlicue fractal is an exceedingly easy-to-make but richly complex pattern composed, at the fundamental level, of Cornu spirals - although that isn't always obvious. The Cornu spiral, also known as the clothoid or Fresnel spiral, is a sort of S shape that spirals in on itself at both ends, something like this:

: : ,,,,,,,,,,,,,: : ,,,,: ,,;;. : :;;, :;;: : ,;: :i. : ,;, ... t. : .i. :;,,,:,,,,;;, ti : :t ;; ,;;tttt;;,,i .t. : t; ;t :tjfKGLftGLft.t t : t: .t. tjEEi .fDft.i j : i: t i;GKt tKt t. t : :i t ;;GKf ,LGj.i ,, : ,j .i tiGDGt;;ifGLj:t it : t. ;t ;;tijjjjtii;; i: :,, .i: .,,,,,,,,; :i: :j :;,, .,;;: :t .,,,,,:,,,,: t, f f f j t f t t .................................................j................................................ t t t t .t :i ,; i, t: j: .:,::,:. t: ,;,,: :,;;: ;:: ;;. ,,,,,,,: .i: ,t : :i, ;;tiittiit;; i: ti : :i. ,i;fGGftjjDDjit. ti ,; : t ;j:fDj, .LEL;t ,j j : .i j;ttD EDtj .t t. : :; jiijE: ;KGit ;t ,; : .i :t.tfDLt;tjGEfti :i. .t, : j .t:;jfLffjfj;; ,i t : :; ,;,,,,,,::,;;. ,i : it :,,,:,,,: :i; : i, ,;: : :;;. ;;;. : .;;, :,,;, : :,,,,,,,,,,,,,,,. : ... : ,

The shape of the fractal varies smoothly as you increase the value of its main input parameter, which makes possible the creation of a perpetually furling-unfurling-spinning animation which cycles through a dizzying array of forms. Every number between 0 and 1 has a different curlicue fractal associated with, the shape of which - for reasons I will get back to - depends on the properties of the number expressed as a fraction. Sometimes it looks like chains of dragons, or seahorses; other times it forms intricate crystalline structures, or shapes which look like nothing more than the spirally doodles of someone with far too much time on their hands. Here is an example of the output from a setting which brings out its true nature particularly clearly - you can see that in some sense it's made out of clothoids in clothoid configurations:

.,:. .::,::. ,,:::,:: .::::::. ;,ifj:, .:, .:,. ;;L###G., ; :, :::: . .ifKKEj ; ;. ;.;iLf,:,. :,:::.:::::,:. :::. ;. ; :::,::,. ;;f###D; ; ;,,,;:,: .:::::::::,:: ;. ;,ffLt,:.,: ,,iDKKj, ., ::::::. ,,;EWKD,.; .;;;;,: ,. ;iE####f; :: .::::. ; :::::,j;itt::;,: .iiW##Kt ; :tLDDf.i,. ,, ,jDDED;; ; ,: .;;::::Lt####E: ;., .;ijti. ; it###Wi i; :,:. ::,:,. ; .,. i,DKKL,;LW#KKD; ; :, ..iiii;,. ,. ;iLL; ;; .:::. ; .,: jiW##Kj .j,,,. ,i ;,iLfDE##Ki;:: ,: ; ; ; ,: ,ijj; ; ;:,:;jK######Ki; ; ,, :,: ,: ; .::. ,, ; :, .tiW####LDt:, ; :, ::::,,: :: ;. ,;,:.:::. ., ,,,,,,;,::. ::iLKWDfij. ;. :,. ::::::::. ; :, ,;jLfi: :; ;. .,,;,,,iLit::: ; ,ifjtt; .; ,, .,:: .; ,. ;j###Ki: ; ,. :,:;::,:: i; ,,i ,,:;;;,,:i::;iiLjjji: ,. :,. ; ,: .iDDDfi: ; ; :,fEKEi .f,:fDDt.i:,::::::,,iiijti;,jK##W;i: i .:,i::,i,: i .:::,;,:. ; .,;;K###i; j;L###DG .::,,:: ,: jD##K,;; ;.,:fjifDKD;i:. ; ; :,;iffti :iLDKGG,,,. .ii. :,:,;: ;i E###EK#K;, :,. ; ijDLt; ., .::: jj,jDWKGi ,. .::.:,. ,,,iKKEft;,, :, :: D###Ei; ; :::::. ,j.L####KDDjjt:::::::i,::,::: .:;;;i: ,, ,: ;GDDii, ; ,,,,: .,:. iiijGjK###EEj ; ijDji,. :,:.,,::,i: ;. ;:LWWEt, ,: ; ,jj,LEEffi ; ,f###Ei; .::::. ,. ,,G###j; ., .; ;;L###WWi, .,.iGEDi,; :,.:,iti;: :, ,i:,,,K##EEti::. ::,,:,,. .:::,. ., ;.:tii;,;;ii; .:,::::::::: :, ;,E##Kji:: ., ;;E##Kt; ,,. ,,ii;,:

I discovered the curlicue fractal when I was very young, playing about in BASIC on a ZX Spectrum - it wasn't until much later that I learnt anything much about what it could do, and why; I don't think I had even heard of fractals when I first stumbled on it, playing around to see what different mathematical functions look like plotted to the screen. I wrote a program that must have looked a lot like this:

10 LET x=100 20 LET y=100 30 FOR f=0 TO 5000 STEP 0.1 40 LET x = x + COS (f*f) 50 LET y = y + SIN (f*f) 60 PLOT x, y 70 NEXT f

...which - to my surprise - drew a series of interconnected spirals on the screen in intriguing configurations. Changing the rate at which f is increased every step turned out to make the whole thing change shape, rather than just changing size as I had thought it might; a small nudge would turn it from a pattern clearly made of interlocking S-shaped spirals to something much harder to characterise, with certain similarities of form but also very striking differences, and more nudges would change it all around again.

At the time I wrote this, what little I knew about the trigonometric functions I was playing with had come from the BASIC manual which came with the computer, and I knew nothing at all of calculus; these equations all seemed quite abstract to me. As a result, a simple description of what was fundamentally being drawn eluded me until somebody else drew my attention to it: This is the trail left by a turtle which takes steps of a fixed size and turns left faster and faster each step. This allows an elegant reformulation of the program which brings out what is really the main input parameter - sticking with Spectrum BASIC for consistency, we can now write*

10 LET x=100 20 LET y=100 25 INPUT seed 30 FOR d=0 TO 5000 STEP seed*2*PI 35 LET f=f+d 40 LET x=x+COS f 50 LET y=y+SIN f 60 PLOT x, y 70 NEXT d

If the rate of increase of the speed of rotation (the seed for the fractal) is small enough, then the shape traced is essentially a clothoid. However, where a clothoid spirals ever-closer to its focus without ever reaching it, our algorithm sooner or later reaches a point where the fixed size of its steps becomes important, and its path diverges from that of the true clothoid because it cannot follow the tight curve. As the turtle turns ever-faster, it will eventially reach a point where it is turning 90° each step, tracing out a square; then, a little later, it will be jumping over the same three points of an equilateral triangle, then hopping back and forth between two points as it turns right around with each step.

After that, the turtle goes through the same sequence on the other side - triangle path, square, pentagon and so on, until it is once again tracing something close to the smooth curve of a clothoid. This is not usually the same clothoid as it came in on - the moment of reversal, where the new clothoid effectively starts, can leave the angle of the new clothoid out of synch with the old one by an amount which depends on where on the new clothoid the turtle starts out.

This is where things start to get interesting, because in effect what is happening (for most seeds) is that each of these clothoids takes us one step along a larger one; we soon see a pattern of clothoids made of clothoids. Keep going, and we see that the larger clothoids themselves form even larger clothoids; if the input parameter is an irrational number, we can keep on going, finding ever-larger levels of organisation as we look at the pattern on a larger and larger scale.

Why should it matter whether the input parameter is an irrational number? Well, remember that the seed value is the amount by which the change in the angle increases every step, as a fraction of a full turn. If the seed is a rational number - that is, if it can be expressed as a fraction - then both the angle and its rate of change are guaranteed to hit a multiple of 2 times pi again after a number of steps equal to the denominator of that fraction, if it is odd, or double the denominator if it is even (the proof of this is left as an exercise for the reader). For even denominators this coincides with a return to the origin; for odd ones it dances off into the distance. A seed value of a half, for example, starts again from the origin after four steps - step, 180°-turn, step, 360° turn, step, 540° turn (or, equivalently, another 180° turn), step. A seed of a third turns 120°, then 240°, then 360°, making a little zig-zag.

Clearly the form of the fractal reflects the nature of the seed number in various interesting ways, which as far as I know have never been explored in very great depth. It is probably only for irrational seed numbers that it counts as a true fractal - for other input values, any self-similarity will occur on a finite number of levels. Cliff Pickover devotes a chapter of his book Keys to Infinity to the curlicue fractal, exploring the temperature of the curves produced by different seeds, where temperature roughly corresponds to wiggliness**. By this measure the 'coolest' fractal that Pickover could find was the one corresponding to the golden ratio, yet another argument for the specialness of that number - albeit a particularly abstruse one.

Animated versions of the curlicue fractal periodically pass through convergence points, where what was a pattern repeating itself through space gradually folds in on itself until all the copies lie on top of each other; then the moment passes, and the copies diverge again - dancing around and outwards in their consistent, yet curiously unpredictable way. I have spent many hours since I first came across the curlicue fractal - too many, probably - playing with it, mesmerised...

* We are actually switching to triangle numbers here - the sum of the series 1+2+3+...n - instead of squares, which would be the sum of the series 1+3+5+...(2n-1); the mathematics are similar, and exactly the same kind of fractal is produced, but the relation of the input seed to the output is somewhat different.

** For the mathematically curious, temperature is defined as 1/ln(2l/(2l-h)) where *l* is the length of the curve and *h* is the length of its convex hull - the smallest convex polygon which can enclose it, like a rubber band stretched around its outermost points.

I have Marijke van Gans to thank for most of my understanding of what's going on in the curlicue fractal, and for her beautiful machine code implementation of it, Dragomat. This version, which includes a function for locating the nearest fraction corresponding to the current output, can be found here:http://www.silicon-alley.com/cat/dragomat.html.

My Java implementation of this, Dragoric, which leaves trails and uses a different colouring algorithm for a very different visual effect, is athttp://oolong.co.uk/Dragoric.htm- my newer C++ version is available for download at http://oolong.co.uk/curlicue.htm together with screenshots and this piece.

All of these implementations include source code.

There is a table of the temperature of the curlicue fractals for different irrational seeds athttp://mathworld.wolfram.com/CurlicueFractal.htmlalong with some monochrome pictures and several references.

When I read Vonnegut's The Sirens of Titan, I always imagined the path Winston Niles Rumfoord travels after being sucked through the Chronosynclastic Infundibulum as being shaped like a Curlicue Fractal. I'm not sure why, but it fits remarkably well with the descriptions in the book.