Sometimes people come up with awful analogies in an effort to describe a concept which is too difficult for a regular person to understand. One such bizarre analogy deals with monkeys, typewriters and Shakespeare. This analogy states:
An infinite number of monkeys hitting at an infinite number of typewriters for an infinite amount of time will eventually produce all works of Shakespeare.
This ridiculous Infinite Monkeys Theorem (yeah, it's given the status of a theorem since it has been repeated so many times by so many people for so many years) is actually releated to the theories of probability. What it's trying to say that if an evenly distributed random number generator generates random numbers for an infinite amount of time, the probability of generating a particular finite sequence of number becomes unusually high.
Wikipedia offers a nice explanation of this theory.
Suppose the typewriter has 50 keys, and the word to be typed is "banana". Typing at random, the chance that the first letter typed is b is 1/50, and the chance that the second letter typed is a is also 1/50, and so on, because events are independent. So the chance of the first six letters matching banana is
(1/50) × (1/50) × (1/50) × (1/50) × (1/50) × (1/50) = (1/50)6.
For the same reason, the chance that the next 6 letters match banana is also (1/50)6, and so on.
From the above, the chance of not typing banana in a given block of 6 letters is 1 − (1/50)6. Because each block is typed independently, the chance of not typing banana in any of the first n blocks of 6 letters is
As n grows, Xn gets smaller. For an n of a million, Xn is roughly 0.9999 (i.e. the chance of not typing banana is roughly 99.99%), but for an n of 10 billion Xn is roughly 0.53 (i.e. the chance of not typing banana is roughly 53%) and for an n of 100 billion it is roughly 0.0017 (i.e. the chance of not typing banana is roughly 0.17%). As n approaches infinity, the probability Xn approaches zero.
So if we bring an infinite number of typewriters for this purpose, the probability of the typewriters producing the word banana becomes close to 100%.
By the same argument, an infinite number of monkeys typing at an infinite number of typewriters will most surely produce even complex works like Hamlet or Othello.
Those who have been following my blog, and particularly those who had the patience to follow this article till now, must be wondering why I suddenly began to talk about monkeys and Shakespeare. Well, it started when I stumbled across this program called Infinite Monkeys.
The Infinite Monkeys program tries to create the 'infinite monkeys with typewriters' scenario by simulating a large number of monkeys typing random characters on the keyboard and outputting the data to files. The program creates one monkey per thread and has the capacity of creating any number of threads, and hence monkeys, depending on the capacity of the computer. I ran 5 monkeys, which is the default and which I guess my machine can handle, and in about 5 seconds they produced 50 Mb of text files. Now all I need is some volunteers to help me find Hamlet in these files! :)
Doing some more research into this monkey business, I discovered a website called One Million Monkeys Typing. OMMT tries to "harness the literary power of one million "monkeys" typing" to churn out adventures and stories. You begin by reading a snippet of a story and then add your own segment thus advancing the story. The site hopes that when a large number of people (or monkeys) contribute it will eventually produce a literray work worthy of the Booker Prize! It says:
With a total of 1248 registered monkeys, we are 0.1248% complete to our goal.
But perhaps the funniest episode involving the Infinite Monkeys theory is, some lecturers and students from the University of Plymouth in England actually put this to test. A single computer was placed inside an enclosure with six primates. At the end of six months all they succeeded in producing was five pages of text which consisted mainly of the letter "s" and a partially destroyed computer. More on the story.
Should you not factor in the possibility a monkey is more likely to bang or smash multiple keys at once (as with fists or open palms) than to press single keys individually? Key presses created with fists or open palms will certainly register multiple characters and this can be considered, but the proximity of these characters on the keyboard must also be factored. An open palm press of the keyboard is extremely unlikely to register a "P" and a "Z" simultaneously, for example.
ReplyDeleteThis brings up the issue of case sensitivity... how can we account for the need for capital letters to be created at the appropriate times?
Let us not forget the most important question of all, which is... given an infinite number of monkeys, who is going to clean up all that monkey shit?
That's exactly what the guys at the University of Plymouth found out.
ReplyDeletei went bananas reading this
ReplyDeletePicking a string of words of sufficiently long length you might calculate how random a random number generator is right? If the longer you type the more likely you are to type the fixed length string in this case one of Shakespeare's plays.
ReplyDeleteIt seems possible to estimate the number of random keystrokes it would take by working backward from the string length.
The formula would be...
Calculate variance and approximate randomness.
I've often thought that Charles Darwin's "Origin of the Species" disproves The infinite monkey theorem. In other words if you had an infinite number of monkeys with an infinite amount of typewriters it is very likely that the monkeys would evolve into another species prior to publishing any readable written work. ;-)
ReplyDelete