The maths and physics of walking in the sand

I love this – which I picked up from Ian Stewart’s now slightly out-of-date (e.g., pre-proof of Fermat’s Last Theorem) and out-of-print The Problems of Mathematics (but a good read and on sale very cheaply at Amazon) – because it demonstrates the harmony of physics with maths, is based on a common experience and is also quite counter-

English: Foot stepping on wet sand causing san...
English: Foot stepping on wet sand causing sand to appear dry around the foot. Sand dilates due to the pressure of the foot nearby and draws water into pores so it appears to be dryer. (Photo credit: Wikipedia)


Most of us are familiar with the experience – if you walk on damp sand two things happen: firstly the area around our foot becomes suddenly dry and secondly, as we lift our foot off, the footprint fills with water. What is happening here?

Well, it turns out that the sand, before we stand on it, is in a locally optimised packing state – in other words, although the grains of sand are essentially randomly distributed they are packed together in a way that minimises (locally) the space between the grains. If they weren’t then even the smallest disturbance would force them into a better packed state and release the potential energy they store in their less efficiently packed state.

This doesn’t mean, of course, that they are packed in the most efficient way possible – just as they are randomly thrown together they fall into the locally available lowest energy state (this is the physics) which is the locally available best packing (this is the maths).

But this also means that when we stand on the sand we cannot actually be compressing it – because that would actually imply a form of perpetual motion as we created an ever lower energy state/even more efficient packing out of nothing. In fact we make the sand less efficiently compressed – the energy of our foot strike allowing the grains to reach a less compressed  packing – and, as a result, create more space for the water in the surrounding sand to rush into: hence the sand surrounding our foot becomes drier as the water drains out of it and into where we are standing.

Then, as we lift our foot, we take away the energy that was sustaining the less efficient packing and the grains of sand rearrange themselves into a more efficient packing (or – to look at it in the physical sense – release the energy stored when we stand on the sand). This more efficient packing mean less room for the water in the sand and so the space left by our foot fills with water expelled from the sand.


The evolution of the astroid pattern on the spirograph

Here is a MetaPost generated picture of the first 14% or so movements of an inner circle one quarter of the size of the outer circle (as might be found on a spirograph). This eventually generates the astroid pattern. The red arrows follow the movement of a fixed point on the smaller circle – as you can see it moves clockwise while the smaller circle moves anticlockwise relative to the centre of the larger circle.

Evolution of a spirograph pattern

The maths of the spirograph… with the drawings

Well, I sat down and thought this was going to be easy, but it has taken me three hours to work the maths of a smaller inner wheel rolling around inside a large outer wheel: mainly because for the first two of those I neglected the basic insight that the inner wheel rolls in the opposite direction to its direction of travel (think of it this way – as a car wheel moves forward the point at the top of the wheel moves backwards – relative to the centre of the wheel).

And instead of using MetaPost I resorted to a spread sheet – though I might do a MetaPost drawing still.

Anyway – assume you have a big wheel of unit radius and a small wheel inside it of radius \frac{1}{R} .

At any given time the centre of this small wheel will be at cartesian co-ordinates (assuming the big wheel is centred on (0,0):

(cos(\theta)(1 -\frac{1}{R}) , sin(\theta)(1 -\frac{1}{R})) (1)

where \theta is the angle of rotation of the small wheel relative to the centre of the big wheel.

But if the small wheel has moved through angle \theta relative to the centre of the big wheel, then it will have itself rotated through the angle R\theta – in the opposite direction to its rotation around the centre of the big wheel.

This means a fixed point on the surface of the small wheel will now be, compared to the centre of the smaller circle, at cartesian co-ordinates:

(\frac{cos(\theta - R\theta)}{R}, \frac{sin(\theta - R\theta)}{R}) (2)

And we add (1) and (2) together to get the co-ordinates relative to the origin (ie the centre of the bigger circle).

Looking at the above it should be relatively obvious that if R is an integer then the pattern will represent R cusps – and not much less obvious is the fact that if \frac{1}{R} can be expressed as a rational number then the pattern will repeat. But if \frac{1}{R} cannot be expressed as a rational then it turns out there are a countably infinite number i.e., \aleph_0 , number of cusps. In a way this is just a graphical way of representing an irrational number – it is a number that cannot be made to divide up unity (the circle) into equal proportions.

So here are the pretty pictures:

Let R = 2 and we have a degenerate case

2 cusp figure from 'spirograph'Then the 3 cusps of the ‘deltoid’:

Three cusped deltoidThe four cusped astroid:

Four cusped astroidAnd, here is the spreadsheet:
spirograph spreadsheet

The maths of the spirograph

I wrote this on Saturday >> I have been reading some more of Wheels, Life and Other Mathematical Amusements: in fact I just read the rest of the first chapter on

Spirograph (Photo credit: Wikipedia)

wheels. And so now I know about the maths of the spirograph.


<< Since then I have been fitfully working out how to draw some of the shapes needed to illustrate this article. But spending more time reading and writing stuff for my PhD literature review presentation, which really ought to be a greater priority.


But I cannot let this hang around for ever, so I am going to have a serious attempt at drawing the spirograph pictures (with MetaPost) this evening and


hopefully post about it!


A search on – Spirograph – suggests that the original toy may be all but extinct … so maybe nobody under-35 has a clue what this is about.


From The Selfish Gene to Alan Turing: the Enigma

As I spend a lot of time in the gym (honestly) I have decided to use that a little more productively and listen to decent non-fiction audio books – and I have just finished listening to Richard Dawkins’s The Selfish Gene.

Cover of "Alan Turing: The Enigma"
Cover of Alan Turing: The Enigma

I quite enjoyed the book (or the recording) in the end – certainly added to my knowledge of genetics (not that that would be tough) and made a convincing case for its central argument: that genes the fundamental replicators of the biological world and it is their ‘drive’ to selfish self-preservation that shapes so much of our world. In fact my biggest criticism of the book is the way it anthropomorphises genes – a weakness reflected in the title itself. Genes are not selfish really – they are molecules that, statistically, interact with other molecules in a way that ensures their molecular formation survives. The book’s unwillingness to discuss anything but the most minimal amount of maths means Dawkins refuses to discuss that perspective in anything but the briefest of terms.

I also found his explanation of intelligence unconvincing, but this is a tricky and exceptionally difficult subject and I don’t have an original idea to counter Dawkins with.

And, of course, there is no discuss of the chemical processes that allow these proteins to shape their ‘machines’ or their phenotypes generally.

But, yes, it’s worth reading or listening to.

Next up? Andrew Hodges‘s Alan Turing: The Enigma. This, at 30 hours, is almost twice as long as Dawkins’s book, so suspect will be listening to this into August (unless I go mad for the gym) – will be interesting to see how, if at all, the maths are dealt with.

Volume of a ball

As ane fule kno the volume of a ball (ie., the interior of a sphere) is \frac{4}{3}\pi r^3.

But I have just had one of those “why’s that then” moments and sought to prove to myself, using integration, why this would be so.

But my logic is flawed and I get the wrong result – so risking looking stupid – I am asking for someone to correct the error in my logic.

Starting from the start and a familiar (I hope!) lemma:

\pi is the ratio of a circle’s circumference (c ) to its diameter (d ), hence c = \pi d or, more familiarly, c = 2 \pi r where r is the radius of the circle.

Now the area (a) of a circle can then be found by integration:

a = \int_0^r 2\pi x dx , giving the familiar \pi r^2

So, my reasoning runs, the volume of a ball would then be:

2 \int_0^r \pi x^2 dx or \frac{2}{3}\pi r^3 , which is precisely half the figure it should be – so where have I gone wrong?

Update: with thanks to Hugh in the comments – of course what I have described is a (double) cone with a height equal to the radius of the base. Cones and circles are not the same, obviously.

My (computer science) book of the year

The Annotated Turing
Image via Wikipedia

It wasn’t published in 2011 but The Annotated Turing: A Guided Tour Through Alan Turing’s Historic Paper on Computability and the Turing Machine is without doubt my computer science book of the year.

If books can change your life then The Annotated Turing changed mine – because it showed me just how strong the link between maths and computer science is and how fundamental maths is to an understanding of the nature of reality and truth. The world, in my eyes, has not been the same since I read this book last January.

If you are a computer science student the you must read this book!

And finally, Happy New Year to all.

The tyranny of the arts graduates continues

Michael Gove speaking at the Conservative Part...
Image via Wikipedia

I imagine in Michael Gove‘s world, this has been a good week. The UK’s secretary of state for education has been in the news a lot this week, and that seems to be the key metric for him – after all his qualifications for the job essentially seem to be that he was once a journalist (and a militant and active trade unionist – a friend who worked with him at the BBC once told me he was deployed to ensure that “the Tories all came out” during disputes at the Corporation in 1994.)

The two equal pinnacles of Mr Gove’s week would appear to be his writing a preface (!) to the Bible that he is sending to all schools (he doesn’t seem to understand that Catholic schools – of which there are rather a lot – will not use the text he is sending them, never mind the questions of what the state-maintained Jewish and Muslim schools will think) and a speech he gave to Cambridge University earlier in the week where he waxed lyrical about high literature but seemed to have nothing or next-to-nothing to say about engineering, maths and science.

Matt Pearson puts it so much better than I ever could:

Gove rarely talks of skills which can be used in the modern economy, he does not mention collaboration and teamwork, communication skills and the ability to use a range of technologies to get a job done. He does not talk of creativity and entrepreneurship, of engaging with the information society and introducing young people to the rigours of engineering or computer programming. Presumably as his own education did not cover these elements, and Jane Austen wrote very little in JavaScript, these disciplines have not entered his purview.