# The Farey Room

The Farey Room contains pictures generated by means transformations of the Farey Number Mapping, and through transformations of the Continued Fraction Mapping. Click on the small icons to see larger, more detailed views.

Artistic apologies: This material was originally presented with graphic design sensibiliteis that were more sparse, neutral, mystical and suggestive, which helped highlight the intricately twisted patterns. I now think that more literate readers would rather enjoy a bit of the actual mathematical background that goes into these pictures. And so I've added a small dose of math to the descriptions. My aplogies to the artistic types who would prefer dark and mystery.

## Continued Fractions

Palms The above shows the most basic transformation, where all occurances of "1" in the numerator of continued fraction expansions of the real number are replaced by "z". That is, if x = 1/(a+1/(b+1/(c+1/(d+ ...)))) then fz(x) = 1/(a+z/(b+z/(c+z/(d+ ... )))) mod 1. We refer to this fz(x) as the "Farey Transform" of x. This fz(x) is used to generate a Hausdorff measure for a given (x,z). The measure is shown as a color, with black=zero, blue=small, green=larger, yellow=large, red=larger still. Note that as z goes negative, it is technically undefined, as the continued fraction rockets out of control. However, computationally, x is always a rational, and so each continued fraction terminates. Along the horizontal axis, real numbers. Along the vertical axis, z, ranging from +1 to -1 (+1 at bottom, -1 at top, 0 along the midline). Note the psuedo-Sinai's Tongues which occur for all irrational values on the horizonal axis. This is essentially due to the fact that the mapping is discontinuous for all rational values of x, and z != 1.

One can play more complex games. If x = 1/(a1+1/(a2+1/(a3+1/(a4+ ...)))) and one has a sequence {rn} then one can define fr(x) = 1/(a1+r1/(a2+r2/(a3+r3/(a4+ ...)))).     Another way of combing is to create a different function gr(x) = 1/(a1r1+1/(a2r2+1/(a3r3+1/(a4r4+ ...)))).     Note that these transformations may not be well defined when x is irrational; however, whenever x is rational, then the continued fraction has a finite number of terms, and the operations are always well defined.

Cmap Cosine Transform fr(x) with rn=cos(nz). Parameter z runs from zero at the bottom, to 2pi at the top.

Emap Exponential Transform fr(x) with rn=exp(-nt). Parameter t runs from one at the bottom to minus one at the top.

Jmap Spherical Bessel (j0) Transform rn=j0(nz)

Cn Sine Squared Transform rn=(1+cos(nz)). The goal here is to avoid the pathological divide-by-zero's that occur in Cmap when cos(nz) = -1. As is clear here, the figure is far better behaved than Cmap.

Magic Third As above, except only the range 1/2 < x < 2/3 is shown (not to scale).

The Brush A different 1/2 < x < 2/3 map.

Road to the Horizon If x = 1/(a1+1/(a2+1/(a3+1/(a4+ ...)))) then consider hg(x) = 1/(g(a1)+1/(g(a2)+1/(g(a3)+1/(g(a4)+ ...)))) In the road to the horizon, we use g(z)=1/z

Phat A 'trivial' reworking of the map: this shows x fz(x). Note since f1(x) = x, that the bottom row of pixels is just x2.

Crystaline An attempt to create a symmetrized version.

These show the basic map on an extended range ... either wider (x runs zero to two) or taller (z runs zero to 4), or both. Note that we accidentally flipped some of these "upside down".

## Farey Transforms

These pictures depict the actual values that the function ranges over.

The basic map, which is combined with itself to show the symmetric and the anti-symmetric components. The color at pixel (x,z) is simply the value of the Farey Transform fz(x), as defined above. Again, black=0.0, red=1.0, and a spectrum from blue to green in between. Note that z runs from +1 at the top, to -1 downwards. Thus, the top edge of the first picture is simple the straight line f1(x)=x.

## Glossary

Farey Transform
To construct the Farey Transform of x, start with the continued-fraction expansion of x when 0 < x < 1: x = 1/(a+1/(b+1/(c+1/(d+ ...)))) where a,b,c,... are positive integers. Note that this expansion is unique: for any rational or irrational x, there is only one, unique sequence a,b,c... Note that if x is a rational number, then the continued fraction has only a finite number of terms.

Define fz(x) = 1/(a+z/(b+z/(c+z/(d+ ... )))) mod 1. We refer to this fz(x) as the "Farey Transform" of x. Note that as long as 0 =< z =< 1, the continued fraction is convergent for all values of x, both rational and irrational. Note that f(x) is a continuous function of x only when z=1. Note that f(x) is always well-defined for all rational values of x, since whenever x is rational, then the continued fraction terminates after a finite number of terms, and therefore, any manipulation on is therefore finite. Note that for 1 < z, that fz(x) for irrational x seems to be stable and convergent in all cases (Quickie proof: each term is bounded, and the bounds converge as well or better than the z=1 case). Note that for z < 0, that fz(x) for irrational x is ill-defined, (although it may be possible to regularize it).

Hausdorf Measure
When we say 'Hausdorf Measure' above, what we really mean is this: Take the real number line between 0 and 1, and divide it into N equal bins. We start with each bin being empty (zero). Next, generate a seqeunce of random numbers 'x' between 0 and 1. Apply a transform (f(x) mod 1) to each x. Then, if f(x) falls in the i'th bin, increment the value of the i'th bin by one. When properly normalized, the resulting 'density' on the real-number line converges to a stable limit as N is increased, and as the number of samples is increased. We loosely call this value of the density the 'Hausdorf measure', in that it describes a practical way of taking a well-defined limit.

Most of these images were generated during January and February of 1994, in Austin, Texas. The work was inspired by a Christmas reading of the "Contorted Fractions" chapter of John Conway's "On Numbers and Games". The importance of Farey Trees to fractal phenomena was previously brought to my attention by Paul Cvitanovi\'c during some lectures in Paris in 1985.

Linas Vepstas February 1994

## References

The quickie bibliography below was scammed from http://www.math.uwn.edu/Farey.html

1. J.C. Lagarias and C. Tresser, A walk along the branches of the extended Farey tree, IBM Jour. of Res. and Dev., v. 39, 1995.
2. J.C. Lagarias, Number theory and dynamical systems, Proceedings of Symposia in Applied Mathematics 46, 35-72, 1992.
3. R. Siegel, C. Tresser, and G. Zettler, A decoding problem in dynamics and in number theory, Chaos 2, 473-493, 1992.
4. G.H. Hardy and E.M. Wright, An introduction to the theory of numbers, fifth edition, Clarendon, Oxford, England, 1979.
5. J. Farey, On a curious property of vulgar fractions, Philos. Mag. & Journal, London 47, 385-386, 1816.
6. Anonymous author, On vulgar fractions, Philos. Mag. & Journal, London 48, 204, 1816.
7. J. Farey, Propriété curieuse des Fractions Ordinaires, Bull. Sc. Soc. Philomatique 3, No. 3, 112, 1816.
8. J. Franel, Les Suites de Farey et le Problémes des Nombres Premiers, Gottinger Nachrichten, pp. 198-201, 1924.
9. P. Cvitanovi\'c, Farey Organization of the fractal hall effect, Phys. Scripta T9, 202, 1985.
10. P. Cvitanovi\'c, B. Shraiman, and B. Söderberg, Scaling laws for mode locking in circle maps, Phys. Scripta 32, 263-270, 1985.