Wednesday, 23 May 2012

The infinite monkey theorum

Yesterdays post (now deleted) talked about the monkey hypothesis but I thought that it might give the wrong idea (sorry) and this seems more constructive and perhaps educational! I didn't think that my students read the inane rubbish I tend to write but it seems I was wrong and I claim temporary marking insanity! Bear with me.......... it does get more interesting towards the bottom

I am sure that most of us are quite happy with the idea that if you flip a coin once then the probability of flipping a head or a tail is 0.5 (or 50%). Most of us probably also know the classic concept of probability (mathematical) that if you set an infinite number of monkeys to work on an infinite number of typewriters for an infinite length of time then one of them will write the complete works of Shakespeare flawlessly. With my head fried today, looking into this seemed like a better option than work - here goes:

This site suggests that there are 34896 lines in all of the works of Shakespeare and, making some gross assumptions, a word document has about 80 characters (including spaces and punctuation) per line. That makes 2,791,680 characters total in the works. My keyboard has 78 keys total and if we assume that for each of the characters, there is a 1/78 chance of the monkey hitting the right one, then the probability of the monkey writing the whole works flawlessly is 1 in 78 to the power of 2791680 (or 1/78 multiplied by itself 2791680 times). Needless to say it is a small number - the calculators I have available give up on it but it is a number that starts 0. and then has more than 4 million zeros before the next non-zero number...... I said it was small and this is what sensible mathematicians call tending to zero - or translated, it ain't happening. (In case you ever need to know, excel rounds down to zero at 10^-307 or after a mere 307 zeros)

However, biology and maths are not the same thing - would the monkey have an equal chance of hitting each key or would the central ones be favored as with my son? Would the monkey just get pissed off and go scratch its genitalia for a while? Has anyone tried this? Clearly we do not have access to infinite monkeys etc but it can, and has, been attempted with computers generating random keystrokes. After 2,737,850 million billion billion billion monkey-years equivalent, the closest they had got was this: "RUMOUR. Open your ears; 9r"5j5&?OWTY Z0d..." partly from Henry V, part II (from Wikipedia) so it seems like the mathematical probability was about right!

So the real question is "has anyone ever tried with real monkeys?" And the answer is yes. You may be surprised to learn that this fundamental piece of research was done right here in the arts department in Plymouth! They gave 6 Celebes Crested Macaques at Paignton Zoo a keyboard for a month. So what did they manage to write in a month? 5 pages of crap as might be expected (honestly, this link takes you to a pdf of the masterpiece). Most of it consisting of the letter S perhaps due to a male squashing a testicle on the keyboard for a while....... They also started bashing it with a stone and then urinating and defecating on the keyboard too (photos here but not of the defecation/urination bit if you were hoping). Let the statisticians work all of that into a probability calculation! You cannot always explain biology with maths.......

If you have not lost the will to live is there a point to all of this drivel? Not really apart from the fact that I thought that it was quite a fun story. Here's a monkey:

Photo - Romana Klee (CC)

No comments:

Post a Comment