Monkey typewriter theory

[[Image:Typingmonkeylarge.jpg|thumb|right|165px|An [[ape]] (a subgroup of [[monkey]]s) typing 
[[William Shakespeare]]
 Christopher Marlowe.]]
{{Mathematics}}
{{cquote|Come to think of it, there are already a million monkeys on a million typewriters, and [[Usenet]] is ''nothing'' like Shakespeare.|4=Blair Houghton}}

{{cquote|It was the best of times...it was the ''blurst'' of times? You stupid monkey!|4=Mr. Burns}}

The '''monkey typewriter 
[[theory]]
 
[[hypothesis]]
 theorem'''{{efn|it is not a '''[[theory]]''', because it is not an explanation for a body of evidence with predictive power. It is also not a hypothesis because it is only an almost testable (where/how do you prepare an [[Infinity|infinite]] number of monkeys?) statement. It is a theorem because it is a deduction from (other) simpler logical statements/truths.}} says that if a certain (large, often considered infinite, depending on who's saying it and what number they can think of [[random]]ly) number of monkeys were given typewriters and a ''really'' long time,{{efn|Unless you are using an {{wpl|Uncountable set|uncountably infinite}} number of monkeys, then it can usually be done in a very short amount of time.}} they could write the works of some random famous writer (e.g. Shakespeare, Dickens, etc. &mdash; it doesn't really matter{{efn|Of course, if you expect non-English works, you might need corresponding typewriters.}}). A similar idea is that patterns could be found within the value for [[pi]],{{efn|In formal language, "pi is disjunctive in base 10"; it's not ''strictly'' proven yet, but is strongly suspected.}} as the digits after the decimal point are essentially random and infinite.<ref>[http://www.thedoghousediaries.com/?p=923 DoughouseDiaries &mdash; 3.14159] Pretty much the same idea.</ref>

The more general idea behind these poetic conjectures is that, given a sufficient amount of [[time]], anything that squares with the laws of nature is theoretically possible. However, the time frame required for a bunch of monkeys randomly banging on a keyboard to produce the works of Shakespeare is longer than the anticipated existence of the [[Universe]] (not to mention the lifespans of the monkeys themselves). So this wiki is screwed. Damn, we tried.

However, it is a scientifically proven [[theory]] that if you give five (drunk) monkeys typewriters, and one minute, all of the resulting text would make more sense than anything [[Gene Ray]] says.{{cn|joke}}

==Ze math==
Suppose that there are 10 billion monkeys working on 10 billion typewriters.  If each monkey can type 10 characters per second, what are the odds that they compose ''Hamlet'' within the age of the Universe?{{efn|Variants of this problem can be found in various textbooks on statistical mechanics and thermodynamics.}}

''Hamlet'' has about 100,000 characters, and a decent typewriter might have 44 keys. If the monkey is typing randomly, and we don't care about case sensitivity, the probability that it hits the right sequence of keys to produce ''Hamlet'' is something like <math>\left(\frac{1}{44}\right)^{100,000}</math>, or 1 chance in 10<sup>164,345</sup>.  

If there are 10 billion monkeys who start typing at the [[Big Bang]] at a rate of 10 keys per second, and continued non-stop until the present day (a time period in the ballpark of 10<sup>18</sup> seconds), the probability that they would have composed ''Hamlet'' by now is about 1 chance in 10<sup>164,316</sup>. Yes, that number is a 1 followed by 164,316 zeroes.  

Of course, if the monkeys are [[YEC]]s, their universe is only 6,000 years old (about 10<sup>11</sup> seconds to an order-of-magnitude approximation).  Then the probability becomes even worse, about 1 in 10<sup>164,329</sup>.

The point to all of this is that even with a gigantic population of monkeys (more than the human population of Earth) typing at a fairly fast pace over a time period that, for all intents and purposes on a human scale, is forever, the probability of coming up with a particular work of Shakespeare is so minuscule as to be [[zero]] in any practical sense.

On the other hand, if you have 4.7×10<sup>164,345</sup> monkeys (which is ''way'' more than the number of atoms in the observable universe but just saying that it has theoretical basis), the probability to finish it within the first 100,000 characters (of each typewriter) becomes 99%.{{efn|Derivation:
probability of matching after <math>n</math> trials each with probability <math>p</math>:
::<math>P = 1-\left(1-p\right)^n</math>
so if you have <math>n=\frac{1}{p}</math>, for large enough numbers
::<math>e^{-1} = \lim_{n\to\infty} \left(1-\frac{1}{n}\right)^{n}</math>
Where <math>e</math> is the base of natural logarithm.

For <math>n=\frac{k}{p}</math>, you have
::<math>1-P=e^{-k} = \lim_{n\to\infty} \left(1-\frac{1}{n}\right)^{kn}</math>
So if we work backward from 99%, which is <math>1-P=0.01</math>
solve for <math>k</math> gives <math>k=4.60517</math> and so <math>n=\frac{k}{p}=4.60517 \times 10^{164345}</math>.

Obviously.
}}

==The Paignton Experiment==
In 2003, a group of researchers from the University of Plymouth placed a computer in the monkey enclosure of the Paignton Zoo for a month and gave the monkeys access to the keyboard in order to test this theory.<ref>[http://news.bbc.co.uk/2/hi/3013959.stm ''No words to describe monkeys' play''], BBC News, Friday, 9 May, 2003</ref>

After initially attempting to destroy the keyboard, then urinating on it, the monkeys did eventually produce some five pages of writing, mostly repetitions of the letter 'S' &mdash; which puts to rest the assumption of "jabbing randomly" assumed above, so add a few more zeros to those numbers. Although the experiment was described as having "little scientific value", it did show that while monkeys probably won't make good authors, they might quite possibly have a future in the performing arts, or on [[Wikipedia]].

==Computer experiments==
In 2011, a computer based project by US programmer Jesse Anderson tried out the monkey-typewriter method to generate the works of Shakespeare using Amazon.com's cloud computing resources.<ref>[http://www.bbc.co.uk/news/technology-15060310 BBC News &mdash; Virtual monkeys write Shakespeare]</ref> The method required the random generation of a 9-character string by a digital "monkey" that was then checked against known works by Shakespeare. These were then selected in an evolutionary algorithm to complete the 3 million or so characters needed to complete Shakespeare's work. Though this does have some differences to the actual monkey-typewriter hypothesis, which relies on purely random chance and a long, ''long'' time &mdash; multiple times the expected age of the universe.{{efn|In fact, and considering the sheer length of Shakespeare's complete works, one would expect to find shorter writings, such as this very article, appearing randomly long before and far more often than his.}} Anderson's work is more like [[Dawkins' weasel]] but on a scale far grander than a single sentence.

As an April Fool's joke in the year 2000, S. Christey of "MonkeySeeDoo, Inc." created an official Internet RFC entitled ''The Infinite Monkey Protocol Suite'' (IMPS) that "describes a protocol suite which supports an infinite number of monkeys that sit at an infinite number of typewriters in order to determine when they have either produced the entire works of William Shakespeare or a good television show. The suite includes communications and control protocols for monkeys and the organizations that interact with them."<ref>[http://www.ietf.org/rfc/rfc2795.txt The Infinite Monkey Protocol Suite], IETF.org</ref>

==Has it happened already?==
Yes, if you take into account genetic and technological drift.{{efn|Although this viewpoint might also imply that all literary works to date are indistinguishable from connecting randomly selecting words.}}

==Commentary from a monkey==
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssaaaavalvgggggggggggv-vasssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssmmmmmsssssssmmmsssssss

Clearly this is from one of the earlier works of Shakespeare.

==The power of infinity==
While everything said above is absolutely correct, the assumptions include a finite albeit large number of monkeys (10 billion in the given example) and a finite albeit long time (since the big bang in the given example). With these finite assumptions, it is imaginable that monkeys would be defeated in their endeavor. Now, if there were '''infinite''' number of monkeys which were given '''infinite''' amount of time, then they would produce all the books already written and all the books to be written. Not impressed? How about this then: if one monkey was given '''infinite''' amount of time, then it would still produce all the books already written and all the books to be written. And more amazingly, if '''infinite''' number of monkeys were given a mere second{{efn|(and sufficient typing speed)}}, they would still produce all the books already written and all the books to be written in a jiffy. This is the power of infinity.

Notice that infinity is only (and only) a mathematical concept and not a physical possibility. This means everything in the world (including the number of monkeys and the time passed since the big bang, along with the number of atoms in the universe/multiverse and basically anything you can think of) is finite, and as a result the idea of monkeys producing Hamlet remains impossible in reality.

==See also==
*[[Infinity]]
*[[Ramsey theory]]
*[[RationalWiki]]

==Notes==
{{reflist|group=note}}

==References==
{{reflist|2|80%}}

[[category:literature]]
[[category:science]]
[[Category:Mathematics]]

Categories: literature, science, Mathematics