# Ford and his Circles. A Ford circle is a circle derived from a pair of numbers that are co-prime, i.e. they have no common factors. For a pair of co-prime integers p and q the Ford circle has radius r and centre at a point

P(x, y) where r = 1/(2q^2) and P = (p/q, r)

No matter what co-prime numbers, p and q, are used to create Ford circles the circles never intersect and they are all tangential to the horizontal axis.

Now, we could generate ‘random’ Ford circles by picking any old co-prime pair (p, q). However, the Farey series is a ‘ready made’ set of such integers – all the Farey fractions are in reduced form and so the numerator and denominator are co-prime. For example, using the code from the previous post,

To create Ford circles from these fractions we first define a suitable type and then create a few helper functions i.e.

Here we’re using the Farey sequence code from module Farey and mapping fordCircle over a Farey sequence. The function fordCircle is just the Haskell form of the equations described above. However, generating a list of FordCircle gives data that is not particularly informative. e.g.

But, using a little bit of Gloss

we can generate an attractive interpretation of the data…

Notice how the circles don’t intersect, are tangential to immediate neighbours and to the x axis. and with a bit of manipulation…  With high contrast…    Quite pleasing images for little effort 🙂

All the code is on Github and thanks for reading!