Revision as of 15:31, 9 August 2007 view sourceBongle (talk | contribs)539 edits →Random number generation← Previous edit | Latest revision as of 19:13, 4 January 2025 view source Trovatore (talk | contribs)Autopatrolled, Extended confirmed users, Pending changes reviewers38,078 edits →Simulated and limited conditions: nothing worth covering in that paper | ||
Line 1: | Line 1: | ||
{{short description|Counterintuitive result in probability}} | |||
] typing at random will allegedly type out a copy of one of Shakespeare's plays.]] | |||
{{pp-semi-indef|small=yes}} | |||
], according to researchers.]] | |||
The '''infinite monkey theorem''' states that a ] hitting keys at ] on a ] for an infinite amount of time will almost surely type |
The '''infinite monkey theorem''' states that a ] hitting keys at ] on a ] keyboard for an ] amount of time will ] type any given text, including the complete works of ].{{efn|In practice, for any realistic ''finite'' attempt, the probability of a monkey generating even a small part of a Shakespeare work is negligible.}} In fact, the monkey would almost surely type every possible finite text an infinite number of times. The theorem can be generalized to state that any sequence of events that has a non-zero ] of happening will almost certainly occur an infinite number of times, given an infinite amount of ] or a ] that is ]. | ||
In this context, "almost surely" is a mathematical term meaning the event happens with probability 1, and the "monkey" is not an actual monkey, but a ] for an ] device that produces an endless ] of letters and symbols. Variants of the theorem include multiple and even infinitely many typists, and the target text varies between an entire library and a single sentence. | |||
Variants of the theorem include multiple and even infinitely many typists, and the target text varies between an entire library and a single sentence. The history of these statements can be traced back to ]'s ''Metaphysics'' and ]'s ''De natura deorum'', through ] and ], and finally to modern statements with their iconic typewriters. In the early 20th century, ] and ] used the theorem to illustrate the timescales implicit in the foundations of ]. Various ] on the one hand, and ] on the other, have argued about the appropriateness of the monkeys as a metaphor for ]. | |||
One of the earliest instances of the use of the "monkey metaphor" is that of French mathematician ] in 1913,<ref name=":0" /> but the first instance may have been even earlier. ] traced the history of this idea from ]'s '']'' and ]'s '']'' (On the Nature of the Gods), through ] and ], up to modern statements with their iconic simians and typewriters.<ref>. Anthologized in Selected Non-fictions (1999). Edited by Eliot Weinberger. New York: Viking</ref> In the early 20th century, Borel and ] used the theorem to illustrate the timescales implicit in the foundations of ]. | |||
Today, popular interest in the typing monkeys is sustained by numerous appearances in literature, television and radio, music, and the Internet. A "Monkey Shakespeare Simulator" website got as far as 24 characters with "RUMOUR. Open your ears; ". In 2003 a humorous experiment was performed with six ]s, but their literary contribution was five pages consisting largely of the letter ''S'', besides attacking and defecating on the keyboard. Researchers concluded that the infinite monkey theorem does not apply to real monkeys; despite their entertaining methods, they make poor ]s, as well as needing to be fed. | |||
==Solution== | ==Solution== | ||
===Direct proof=== | ===Direct proof=== | ||
There is a straightforward proof of this theorem. As an introduction, recall that if two events are ], then the probability of both happening equals the product of the probabilities of each one happening independently. For example, if the chance of rain in ] on a particular day in the future is 0.4 and the chance of an ] in ] on any particular day is 0.00003, then the chance of both happening on the same day is {{nowrap|1=0.4 × 0.00003 = 0.000012}}, ] that they are indeed independent. | |||
Consider the probability of typing the word ''banana'' on a typewriter with 50 keys. Suppose that the keys are pressed randomly and independently, meaning that each key has an equal chance of being pressed regardless of what keys had been pressed previously. 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. Therefore, the probability of the first six letters spelling ''banana'' is: | |||
:(1/50) × (1/50) × (1/50) × (1/50) × (1/50) × (1/50) = (1/50)<sup>6</sup> = 1/15,625,000,000. | |||
The result is less than one in 15 billion, but ''not'' zero. | |||
From the above, the chance of ''not'' typing ''banana'' in a given block of 6 letters is 1 − (1/50)<sup>6</sup>. Because each block is typed independently, the chance ''X''<sub>''n''</sub> of not typing ''banana'' in any of the first ''n'' blocks of 6 letters is: | |||
Suppose the ] has 50 keys, and the word to be typed is "]". Typing at random, the chance that the first letter typed is ''b'' is 1/50, as is the chance that the second letter typed is ''a'', and so on. These 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)<sup>6</sup>. | |||
For the same reason, the chance that the next 6 letters match ''banana'' is also (1/50)<sup>6</sup>, and so on. | |||
From the above, the chance of ''not'' typing ''banana'' in a given block of 6 letters is 1 − (1/50)<sup>6</sup>. Because each block is typed independently, the chance ''X''<sub>''n''</sub> of not typing ''banana'' in any of the first ''n'' blocks of 6 letters is | |||
:<math>X_n=\left(1-\frac{1}{50^6}\right)^n.</math> | :<math>X_n=\left(1-\frac{1}{50^6}\right)^n.</math> | ||
As ''n'' grows, ''X''<sub>''n''</sub> gets smaller. For an ''n'' of a million, ''X''<sub>''n''</sub> is 99.99%, but for an ''n'' of 10 billion ''X''<sub>''n''</sub> is 53% and for an ''n'' of 100 billion it is 0.17%. As ''n'' approaches infinity, the probability ''X''<sub>''n''</sub> ] zero; that is, by making ''n'' large enough, ''X''<sub>''n''</sub> can be made as small as one likes.<ref>This shows that the probability of typing "banana" in one of the predefined non-overlapping blocks of six letters tends to 1. In addition the word may appear across two blocks.</ref><ref>{{cite book |last=Isaac |first=Richard E. |title=The Pleasures of Probability |year=1995 |publisher=Springer |id=ISBN 038794415X |pages=48–50}} Isaac generalizes this argument immediately to variable text and alphabet size; the common main conclusion is on p.50.</ref> | |||
As ''n'' grows, ''X''<sub>''n''</sub> gets smaller. For ''n'' = 1 million, ''X''<sub>''n''</sub> is roughly 0.9999, but for ''n'' = 10 billion ''X''<sub>''n''</sub> is roughly 0.53 and for ''n'' = 100 billion it is roughly 0.0017. As ''n'' approaches infinity, the probability ''X''<sub>''n''</sub> ] zero; that is, by making ''n'' large enough, ''X''<sub>''n''</sub> can be made as small as is desired,<ref name="Isaac1995">{{cite book |last=Isaac |first=Richard E. |title=The Pleasures of Probability |publisher=Springer |year=1995 |isbn=0-387-94415-X |location=New York |pages=48–50 |oclc=610945749 |postscript=– Isaac generalizes this argument immediately to variable text and alphabet size; the common main conclusion is on page 50.}}</ref> and the chance of typing ''banana'' approaches 100%.{{efn|This shows that the probability of typing "banana" in one of the predefined non-overlapping blocks of six letters tends to 1. In addition the word may appear across two blocks, so the estimate given is conservative.}} Thus, the probability of the word ''banana'' appearing at some point in an infinite sequence of keystrokes is equal to one. | |||
The same argument shows why at least one of infinitely many monkeys will (almost surely) produce a text as quickly as it would be produced by a perfectly accurate human typist copying it from the original. Of course, the rest of the infinite number of monkeys will produce something else while the human typist will produce only the correct text. In this case ''X''<sub>''n''</sub> = (1 − (1/50)<sup>6</sup>)<sup>''n''</sup> where ''X''<sub>''n''</sub> represents the probability that none of the first ''n'' monkeys types ''banana'' correctly on their first try. When we consider 100 billion monkeys, the probability falls to 0.17%, and as the number of monkeys ''n'' increases to infinity the value of ''X''<sub>''n''</sub> — the probability of the monkeys failing to reproduce the given text — decreases to zero. This is equivalent to stating that the probability that one or more of an infinite number of monkeys will produce a given text on the first try is 100%, or that it is almost certain they will do so. | |||
The same argument applies if we replace one monkey typing ''n'' consecutive blocks of text with ''n'' monkeys each typing one block (simultaneously and independently). In this case, ''X''<sub>''n''</sub> = (1 − (1/50)<sup>6</sup>)<sup>''n''</sup> is the probability that none of the first ''n'' monkeys types ''banana'' correctly on their first try. Therefore, at least one of infinitely many monkeys will (''with probability equal to one'') produce a text as quickly as it would be produced by a perfectly accurate human typist copying it from the original. | |||
===Infinite strings=== | |||
The two statements above can be stated more generally and compactly in terms of ]s, which are sequences of characters chosen from some finite alphabet: | |||
* Given an infinite string where each character is chosen ], any given finite string almost surely occurs as a substring at some position (and indeed, infinitely many positions). | |||
* Given an infinite sequence of infinite strings, where each character of each string is chosen uniformly at random, any given finite string almost surely occurs as a prefix of one of these strings (and indeed, as a prefix of infinitely many of these strings in the sequence). | |||
====Infinite strings==== | |||
Both follow easily from the second ]. For the second theorem, let ''E''<sub>''k''</sub> be the ] that the ''k''th string begins with the given text. Because this has some fixed nonzero probability ''p'' of occurring, the ''E''<sub>''k''</sub> are independent, and the below sum diverges, | |||
This can be stated more generally and compactly in terms of ], which are sequences of characters chosen from some finite ]: | |||
:<math>\sum_{i=1}^\infty P(E_k) = \sum_{i=1}^\infty p = \infty,</math> | |||
* Given an infinite string where each character is chosen ], any given finite string almost surely occurs as a ] at some position. | |||
the probability that infinitely many of the ''E''<sub>''k''</sub> occur is 1. The first theorem is shown similarly; one can divide the random string into nonoverlapping blocks matching the size of the desired text, and make ''E''<sub>''k''</sub> the event where the ''k''th block equals the desired string.<ref>The first theorem is proven by a similar if more indirect route in {{cite book |last=Gut |first=Allan |title=Probability: A Graduate Course |year=2005 |publisher=Springer |id=ISBN 0387228330 |pages=97–100}}</ref> | |||
* Given an infinite sequence of infinite strings, where each character of each string is chosen uniformly at random, any given finite string almost surely occurs as a prefix of one of these strings. | |||
Both follow easily from the second ]. For the second theorem, let ''E''<sub>''k''</sub> be the ] that the ''k''th string begins with the given text. Because this has some fixed nonzero probability ''p'' of occurring, the ''E''<sub>''k''</sub> are independent, and the below sum diverges, | |||
:<math>\sum_{k=1}^\infty P(E_k) = \sum_{k=1}^\infty p = \infty,</math> | |||
the probability that infinitely many of the ''E''<sub>''k''</sub> occur is 1. The first theorem is shown similarly; one can divide the random string into nonoverlapping blocks matching the size of the desired text and make ''E''<sub>''k''</sub> the event where the ''k''th block equals the desired string.{{efn|The first theorem is proven by a similar if more indirect route in Gut (2005).<ref>{{cite book |last=Gut |first=Allan |title=Probability: A Graduate Course |year=2005 |publisher=Springer |isbn=0-387-22833-0 |pages=97–100}}</ref>}} | |||
===Probabilities=== | ===Probabilities=== | ||
However, for physically meaningful numbers of monkeys typing for physically meaningful lengths of time the results are reversed. If there were as many monkeys as there are atoms in the observable universe typing extremely fast for trillions of times the life of the universe, the probability of the monkeys replicating even a ''single page'' of Shakespeare is unfathomably small. | |||
Ignoring ], spacing, and capitalization, a monkey typing letters uniformly at random has one chance in 26 of correctly typing the first letter of ''].'' It has one chance in 676 (26 times 26) of typing the first two letters. Because the probability shrinks ]ly, at 20 letters it already has only one chance in 26<sup>20</sup> = 19,928,148,895,209,409,152,340,197,376, roughly equivalent to the probability of buying 4 ] tickets consecutively and winning the jackpot each time. In the case of the entire text of ''Hamlet'', the probabilities are so vanishingly small they can barely be conceived in human terms. Say the text of Hamlet contains 130,000 letters (it is actually more, even stripped of punctuation), then there is a probability of one in 3.4×10<sup>183946</sup> to get the text right at the first trial. The average number of letters that needs to be typed until the text appears is also 3.4×10<sup>183946</sup><ref>For any required string of 130,000 letters from the set a-z, the average number of letters that needs to be typed until the string appears is (rounded) 3.4×10<sup>183946</sup>, except in the case that all letters of the required string are equal, in which case the value is about 4% more, 3.6×10<sup>183946</sup>. In that case failure to have the correct string starting from a particular position reduces with about 4% the probability of a correct string starting from the next position (i.e., for overlapping positions the events of having the correct string are not independent; in this case there is a positive correlation between the two successes, so the chance of success after a failure is smaller than the chance of success in general).</ref>. | |||
Ignoring punctuation, spacing, and capitalization, a monkey typing letters uniformly at random has a chance of one in 26 of correctly typing the first letter of ''].'' It has a chance of one in 676 (26 × 26) of typing the first two letters. Because the probability shrinks ], at 20 letters it already has only a chance of one in 26<sup>20</sup> = 19,928,148,895,209,409,152,340,197,376{{efn|Nearly 20 octillion}} (almost 2 × 10<sup>28</sup>). In the case of the entire text of ''Hamlet'', the probabilities are so vanishingly small as to be inconceivable. The text of ''Hamlet'' contains approximately 130,000 letters.{{efn|Using the Hamlet text {{cite web |url=http://www.gutenberg.org/dirs/etext99/1ws2611.txt |title=from gutenberg.org}}, there are 132680 alphabetical letters and 199749 characters overall}} Thus, there is a probability of one in 3.4 × 10<sup>183,946</sup> to get the text right at the first trial. The average number of letters that needs to be typed until the text appears is also 3.4 × 10<sup>183,946</sup>,{{efn|For any required string of 130,000 letters from the set 'a'-'z', the average number of letters that needs to be typed until the string appears is (rounded) 3.4 × 10<sup>183,946</sup>, except in the case that all letters of the required string are equal, in which case the value is about 4% more, 3.6 × 10<sup>183,946</sup>. In that case failure to have the correct string starting from a particular position reduces with about 4% the probability of a correct string starting from the next position (i.e., for overlapping positions the events of having the correct string are not independent; in this case there is a positive correlation between the two successes, so the chance of success after a failure is smaller than the chance of success in general). The figure 3.4 × 10<sup>183,946</sup> is derived from ''n'' {{=}} 26<sup>130000</sup> by taking the logarithm of both sides: log<sub>10</sub>(''n'') {{=}} 1300000×log<sub>10</sub>(26) {{=}} 183946.5352, therefore ''n'' {{=}} 10<sup>0.5352</sup> × 10<sup>183946</sup> {{=}} 3.429 × 10<sup>183946</sup>.}} or including punctuation, 4.4 × 10<sup>360,783</sup>.{{efn|26 letters ×2 for capitalisation, 12 for punctuation characters {{=}} 64, 199749×log<sub>10</sub>(64) {{=}} 4.4 × 10<sup>360,783</sup> (this is generous as it assumes capital letters are separate keys, as opposed to a key combination, which makes the problem vastly harder).}} | |||
For comparison purposes, there are only about 10<sup>79</sup> atoms in the ] and only 4.3 x 10<sup>17</sup> seconds have elapsed since the ]. Even if the universe were filled with monkeys typing for all time, their total probability to produce a single instance of ''Hamlet'' would still be less than one chance in 10<sup>183800</sup>. As ] and ] put it, "The probability of ''Hamlet'' is therefore zero in any operational sense of an event…", and the statement that the monkeys must eventually succeed "gives a misleading conclusion about very, very large numbers." This is from their textbook on ], the field whose statistical foundations motivated the first known expositions of typing monkeys.<ref name="KK">{{cite book | author=] and ] | title=Thermal Physics (2nd ed.) | publisher=W. H. Freeman Company | year=1980 | id=ISBN 0-7167-1088-9 |pages=53}}</ref> | |||
Even if every proton in the observable universe (which is ] at roughly 10<sup>80</sup>) were a monkey with a typewriter, typing from the ] until the ] (when protons ]), they would still need a far greater amount of time – more than three hundred and sixty thousand ''orders of magnitude'' longer – to have even a 1 in 10<sup>500</sup> chance of success. To put it another way, for a one in a trillion chance of success, there would need to be 10<sup>360,641</sup> observable universes made of protonic monkeys.{{efn|There are ≈10<sup>80</sup> protons in the observable universe. Assume the monkeys write for 10<sup>38</sup> years (10<sup>20</sup> years is when ], 10<sup>38</sup> years is when all but 0.1% of ]). Assuming the monkeys type non-stop at a ridiculous 400 ] (the world record is 216 ] for a single minute), that is about 2,000 characters per minute (Shakespeare's average word length is a bit under 5 letters). There are about half a million minutes in a year, this means each monkey types half a billion characters per year. This gives a total of 10{{sup|80}}×10{{sup|38}}×10{{sup|9}} {{=}} 10{{sup|127}} letters typed – which is still zero in comparison to 10{{sup|360,783}}. For a one in a trillion chance, multiply the letters typed by a trillion: 10<sup>127</sup>×10<sup>15</sup> {{=}} 10<sup>145</sup>. 10<sup>360,783</sup>/10<sup>145</sup> {{=}} 10<sup>360,641</sup>.}} As ] and ] put it in their textbook on ], the field whose statistical foundations motivated the first known expositions of typing monkeys,<ref name="KK">{{cite book |last1=Kittel |first1=Charles |title=Thermal Physics |last2=Kroemer |first2=Herbert |publisher=W.H. Freeman Company |year=1980 |isbn=0-7167-1088-9 |edition=2nd |location=San Francisco |page=53 |oclc=5171399 |author1-link=Charles Kittel |author2-link=Herbert Kroemer}}</ref> "The probability of ''Hamlet'' is therefore zero in any operational sense of an event ...", and the statement that the monkeys must eventually succeed "gives a misleading conclusion about very, very large numbers." | |||
In fact, there is less than a one in a trillion chance of success that such a universe made of monkeys could type any particular document a mere 79 characters long.{{efn|As explained at {{cite web |url=http://www.nutters.org/docs/more-monkeys |title=More monkeys |access-date=2013-12-04 |url-status=dead |archive-url=https://web.archive.org/web/20150418004018/https://www.nutters.org/docs/more-monkeys |archive-date=2015-04-18 |df=dmy-all}} The problem can be approximated further: 10<sup>145</sup>/log<sub>10</sub>(64) {{=}} 78.9 characters.}} | |||
An online demonstration showed that short random programs can produce highly structured outputs more often than classical probability suggests, aligning with ]'s modern theorem and building on ] and ] by ] and ].<ref name="ZenilSolerToscano2013">{{cite web|title=Infinite Monkey Theorem |url=https://demonstrations.wolfram.com/InfiniteMonkeyTheorem/ |website=Wolfram Demonstrations Project |author=Zenil, Hector and Soler-Toscano, Fernando |date=October 2013 |access-date=May 24, 2024}}</ref> The demonstration illustrates that the chance of producing a specific binary sequence is not shorter than the base-2 logarithm of the sequence length, showing the difference between ] and ], as well as between random programs and random letters or digits. | |||
===Almost surely=== | |||
{{Main|Almost surely}} | |||
{{Unreferenced section|date=May 2024}} | |||
The probability that an infinite randomly generated string of text will contain a particular finite substring is 1. However, this does not mean the substring's absence is "impossible", despite the absence having a prior probability of 0. For example, the immortal monkey ''could'' randomly type G as its first letter, G as its second, and G as every single letter, thereafter, producing an infinite string of Gs; at no point must the monkey be "compelled" to type anything else. (To assume otherwise implies the ].) However long a randomly generated finite string is, there is a small but nonzero chance that it will turn out to consist of the same character repeated throughout; this chance approaches zero as the string's length approaches infinity. There is nothing special about such a monotonous sequence except that it is easy to describe; the same fact applies to any nameable specific sequence, such as "RGRGRG" repeated forever, or "a-b-aa-bb-aaa-bbb-...", or "Three, Six, Nine, Twelve…". | |||
If the hypothetical monkey has a typewriter with 90 equally likely keys that include numerals and punctuation, then the first typed keys might be "3.14" (the first three ]) with a probability of (1/90)<sup>4</sup>, which is 1/65,610,000. Equally probable is any other string of four characters allowed by the typewriter, such as "GGGG", "mATh", or "q%8e". The probability that 100 randomly typed keys will consist of the first 99 digits of pi (including the separator key), or any other ''particular'' sequence of that length, is much lower: (1/90)<sup>100</sup>. If the monkey's allotted length of text is infinite, the chance of typing only the digit of pi is 0, which is just as ''possible'' (mathematically probable) as typing nothing but Gs (also probability 0). | |||
The same applies to the event of typing a particular version of ''Hamlet'' followed by endless copies of itself; or ''Hamlet'' immediately followed by all the digits of pi; these specific strings are ] in length, they are not prohibited by the terms of the thought problem, and they each have a prior probability of 0. In fact, ''any'' particular infinite sequence the immortal monkey types will have ''had'' a prior probability of 0, even though the monkey must type something. | |||
This is an extension of the principle that a finite string of random text has a lower and lower probability of ''being'' a particular string the longer it is (though all specific strings are equally unlikely). This probability approaches 0 as the string approaches infinity. Thus, the probability of the monkey typing an endlessly long string, such as all of the digits of pi in order, on a 90-key keyboard is (1/90)<sup>∞</sup> which equals (1/∞) which is essentially 0. At the same time, the probability that the sequence ''contains'' a particular subsequence (such as the word MONKEY, or the 12th through 999th digits of pi, or a version of the King James Bible) increases as the total string increases. This probability approaches 1 as the total string approaches infinity, and thus the original theorem is correct. | |||
===Correspondence between strings and numbers=== | |||
In a simplification of the thought experiment, the monkey could have a typewriter with just two keys: 1 and 0. The infinitely long string thusly produced would correspond to the ] digits of a particular ] between 0 and 1. A countably infinite set of possible strings end in infinite repetitions, which means the corresponding real number is ]. Examples include the strings corresponding to one-third (010101...), five-sixths (11010101...) and five-eighths (1010000...). Only a subset of such real number strings (albeit a countably infinite subset) contains the entirety of ''Hamlet'' (assuming that the text is subjected to a numerical encoding, such as ]). | |||
Meanwhile, there is an '']'' infinite set of strings which do not end in such repetition; these correspond to the ]. These can be sorted into two uncountably infinite subsets: those which contain ''Hamlet'' and those which do not. However, the "largest" subset of all the real numbers is those which not only contain ''Hamlet'', but which contain every other possible string of any length, and with equal distribution of such strings. These irrational numbers are called ]. Because almost all numbers are normal, almost all possible strings contain all possible finite substrings. Hence, the probability of the monkey typing a normal number is 1. The same principles apply regardless of the number of keys from which the monkey can choose; a 90-key keyboard can be seen as a generator of numbers written in base 90. | |||
==History== | ==History== | ||
===Statistical mechanics=== | ===Statistical mechanics=== | ||
In one of the forms in which probabilists now know this theorem, with its "dactylographic" monkeys ({{langx|fr|singes dactylographes}}; the French word ''singe'' covers both the monkeys and the apes), appeared in ]'s 1913 article "''Mécanique Statique et Irréversibilité''" (''Static mechanics and irreversibility''),<ref name=":0">{{Cite journal |last=Borel |first=Émile |date=1913 |title=La mécanique statique et l'irréversibilité |url=https://hal.science/jpa-00241832 |journal=Journal de Physique Théorique et Appliquée |language=fr |volume=3 |issue=1 |pages=189–196 |doi=10.1051/jphystap:019130030018900 |issn=0368-3893 |quote=Concevons qu'on ait dressé un million de singes à frapper au hasard sur les touches d'une machine à écrire et que ces singes dactylographes travaillent avec ardeur dix heures par jour avec un million de machines à écrire de types variés. Au bout d'un an, volumes se trouveraient renfermer la copie exacte des livres de toute nature et de toutes langues conservés dans les plus riches bibliothèques du monde.}}</ref> and in his book "Le Hasard" in 1914.<ref name="Borel1914">{{cite book |author=Borel |first=Émile |url=https://books.google.com/books?id=Kmm4vgEACAAJ&q=frapper |title=La hasard |publisher=Félix Alcan |year=1914 |location=Paris |page=164 |language=fr-FR }} </ref> His "monkeys" are not actual monkeys; rather, they are a metaphor for an imaginary way to produce a large, random sequence of letters. Borel said that if a million monkeys typed ten hours a day, it was extremely unlikely that their output would exactly equal all the books of the richest libraries of the world; and yet, in comparison, it was even more unlikely that the laws of statistical mechanics would ever be violated, even briefly. | |||
] proposed an early version of the theorem.]] | |||
In one of the forms in which probabilists now know this theorem, with its "dactylographic" monkeys, appeared in ]'s 1913 article "''Mécanique Statistique et Irréversibilité''" (''] and irreversibility'').<ref>{{cite journal | author=Émile Borel | title=''Mécanique Statistique et Irréversibilité'' | journal=J. Phys. 5e série | volume=3 | year=1913 | pages=189–196}}</ref>, and in his book "Le Hasard" in 1914. His "monkeys" are not actual monkeys; rather, they were a vivid metaphor for an imaginary way to produce a large, ] of letters. Borel said that if a million monkeys typed ten hours a day, it was extremely unlikely that their output would exactly equal all the books of the richest libraries of the world; and yet, in comparison, it was even more unlikely that the laws of statistical mechanics would ever be violated, even briefly. | |||
The physicist ] drew on Borel's image further in ''The Nature of the Physical World'' (1928), writing: | The physicist ] drew on Borel's image further in ''The Nature of the Physical World'' (1928), writing: | ||
{{blockquote|If I let my fingers wander idly over the keys of a typewriter it might happen that my screed made an intelligible sentence. If an army of monkeys were strumming on typewriters they might write all the books in the British Museum. The chance of their doing so is decidedly more favourable than the chance of the molecules returning to one half of the vessel.<ref name="Arthur1928">{{cite book | author=Arthur Eddington | title=The Nature of the Physical World: The Gifford Lectures | url=https://archive.org/details/natureofphysical00eddi | publisher=Macmillan | location=New York | year=1928 | page= | isbn=0-8414-3885-4}}</ref><ref name='Arthur1927'>{{cite web | url = http://www.giffordlectures.org/Browse.asp?PubID=TPNOPW&Volume=0&Issue=0&ArticleID=6 | title = Chapter IV: The Running-Down of the Universe | access-date = 2012-01-22 | last = Eddington | first = Arthur | work = The Nature of the Physical World 1926–1927: The ] | url-status = dead | archive-url = https://web.archive.org/web/20090308150708/http://www.giffordlectures.org/Browse.asp?PubID=TPNOPW&Volume=0&Issue=0&ArticleID=6 | archive-date = 2009-03-08 }}</ref>}} | |||
These images invite the reader to consider the incredible improbability of a large but finite number of monkeys working for a large but finite amount of time producing a significant work |
These images invite the reader to consider the incredible improbability of a large but finite number of monkeys working for a large but finite amount of time producing a significant work and compare this with the even greater improbability of certain physical events. Any physical process that is even less likely than such monkeys' success is effectively impossible, and it may safely be said that such a process will never happen.<ref name="KK" /> It is clear from the context that Eddington is not suggesting that the probability of this happening is worthy of serious consideration. On the contrary, it was a rhetorical illustration of the fact that below certain levels of probability, the term ''improbable'' is functionally equivalent to ''impossible''. | ||
===Origins and "The Library |
===Origins and "The Total Library"=== | ||
In a 1939 essay entitled " |
In a 1939 essay entitled "The Total Library", Argentine writer ] traced the infinite-monkey concept back to ]'s ''Metaphysics.'' Explaining the views of ], who held that the world arose through the random combination of atoms, Aristotle notes that the atoms themselves are homogeneous and their possible arrangements only differ in shape, position and ordering. In '']'', the Greek philosopher compares this to the way that a tragedy and a comedy consist of the same "atoms", ''i.e.'', alphabetic characters.<ref>Aristotle, ''Περὶ γενέσεως καὶ φθορᾶς'' (''On Generation and Corruption''), 315b14.</ref> Three centuries later, ]'s ''De natura deorum'' (''On the Nature of the Gods'') argued against the ] worldview: | ||
{{Blockquote|Is it possible for any man to behold these things, and yet imagine that certain solid and individual bodies move by their natural force and gravitation, and that a world so beautifully adorned was made by their fortuitous concourse? He who believes this may as well believe that if a great quantity of the one-and-twenty letters, composed either of gold or any other matter, were thrown upon the ground, they would fall into such order as legibly to form the ]. I doubt whether fortune could make a single verse of them.<ref>Marcus Tullius Cicero, ''De natura deorum'', 2.37. Translation from ''Cicero's Tusculan Disputations; Also, Treatises On The Nature Of The Gods, And On The Commonwealth'', C. D. Yonge, principal translator, New York, Harper & Brothers Publishers, Franklin Square. (1877). .</ref>}} | |||
Borges follows the history of this argument through ] and ], then observes that in his own time, the vocabulary had changed. |
Borges follows the history of this argument through ] and ],<ref>The English translation of "The Total Library" lists the title of Swift's essay as "Trivial Essay on the Faculties of the Soul". The appropriate reference is, instead: Swift, Jonathan, Temple Scott et al. "A Tritical Essay upon the Faculties of the Mind." The Prose Works of Jonathan Swift, Volume 1. London: G. Bell, 1897, pp. 291-296. </ref> then observes that in his own time, the vocabulary had changed. By 1939, the idiom was "that a half-dozen monkeys provided with typewriters would, in a few eternities, produce all the books in the British Museum." (To which Borges adds, "Strictly speaking, one immortal monkey would suffice.") Borges then imagines the contents of the Total Library which this enterprise would produce if carried to its fullest extreme: | ||
{{Blockquote|Everything would be in its blind volumes. Everything: the detailed history of the future, ]' ], the exact number of times that the waters of ] have reflected the flight of a falcon, ], the encyclopedia ] would have constructed, my dreams and half-dreams at dawn on August 14, 1934, the proof of ]'s ], the unwritten chapters of '']'', those same chapters translated into the language spoken by the ], the paradoxes ] invented concerning Time but didn't publish, ]'s books of iron, the premature epiphanies of ], which would be meaningless before a cycle of a thousand years, the Gnostic ], the song ] sang, the complete catalog of the Library, the proof of the inaccuracy of that catalog. Everything: but for every sensible line or accurate fact there would be millions of meaningless cacophonies, verbal farragoes, and babblings. Everything: but all the generations of mankind could pass before the dizzying shelves – shelves that obliterate the day and on which chaos lies – ever reward them with a tolerable page.<ref>{{cite magazine |author-link=Jorge Luis Borges |last=Borges |first=Jorge Luis |title=La biblioteca total |trans-title=The Total Library |magazine=Sur |issue=59 |date=August 1939}} republished in {{cite book |translator-link=Eliot Weinberger |translator-first=Eliot |translator-last=Weinberger |title=Selected Non-Fictions |publisher=Penguin |year=1999 |isbn=0-670-84947-2}}</ref>}} | |||
Borges' total library concept was the main theme of his widely read 1941 short story "]", which describes an unimaginably vast library consisting of interlocking hexagonal chambers, together containing every possible volume that could be composed from the letters of the alphabet and some punctuation characters. | |||
==Actual monkeys== | |||
In 2002,<ref name=vivariaNotesShakespeare/> lecturers and students from the ] MediaLab Arts course used a £2,000 grant from the ] to study the literary output of real monkeys. They left a computer keyboard in the enclosure of six ]s in ] in Devon, England from May 1 to June 22, with a radio link to broadcast the results on a website.<ref name="BBC News">{{cite news |title=No words to describe monkeys' play |date=2003-05-09 |website=BBC News |url=http://news.bbc.co.uk/2/hi/3013959.stm |access-date=2009-07-25}}</ref> | |||
Not only did the monkeys produce nothing but five total pages<ref>{{cite web |url=http://www.vivaria.net/experiments/notes/publication/NOTES_EN.pdf |title=Notes Towards the Complete Works of Shakespeare|archive-url=https://web.archive.org/web/20090318143423/http://www.vivaria.net/experiments/notes/publication/NOTES_EN.pdf|archive-date=2009-03-18}}</ref> largely consisting of the letter "S",<ref name=vivariaNotesShakespeare/> the lead male began striking the keyboard with a stone, and other monkeys followed by urinating and defecating on the machine.<ref>{{Cite web |last=K. |first=Alfred |date=April 2013 |title=Finite Monkeys Don't Type: A story about the interpretations of probability |url=http://alfre.dk/finite-monkeys-dont-type/ |url-status=live |archive-url=https://web.archive.org/web/20220331124433/http://alfre.dk/finite-monkeys-dont-type/ |archive-date=2022-03-31 |access-date=2023-05-11 |website=Alfred K}}</ref> Mike Phillips, director of the university's Institute of Digital Arts and Technology (i-DAT), said that the artist-funded project was primarily ], and they had learned "an awful lot" from it. He concluded that monkeys "are not random generators. They're more complex than that. ... They were quite interested in the screen, and they saw that when they typed a letter, something happened. There was a level of intention there."<ref name="BBC News"/><ref name="Associated2003">{{cite magazine|url=https://www.wired.com/news/culture/0,1284,58790,00.html |title=Monkeys don't write Shakespeare |magazine=Wired News |date=2003-05-09 |access-date=2007-03-02 |archive-url=https://web.archive.org/web/20040201230858/http://www.wired.com/news/culture/0%2C1284%2C58790%2C00.html |archive-date=2004-02-01 |url-status=dead}}</ref> | |||
==Applications and criticisms== | |||
==Applications== | |||
===Evolution=== | ===Evolution=== | ||
] is sometimes misattributed with proposing a variant of the theory in his debates with ].]] | ] is sometimes misattributed with proposing a variant of the theory in his debates with ].]] | ||
In his 1931 book ''The Mysterious Universe'', Eddington's rival ] attributed the monkey parable to a "Huxley", presumably meaning ]. This attribution is incorrect.<ref>{{cite journal |first=Thanu |last=Padmanabhan |title=The dark side of astronomy |journal=Nature |volume=435 |pages=20–21 |year=2005 | |
In his 1931 book ''The Mysterious Universe'', Eddington's rival ] attributed the monkey parable to a "Huxley", presumably meaning ]. This attribution is incorrect.<ref name="Padmanabhan2005">{{cite journal |first=Thanu |last=Padmanabhan |title=The dark side of astronomy |journal=Nature |volume=435 |pages=20–21 |year=2005 |doi=10.1038/435020a |issue=7038|bibcode=2005Natur.435...20P |doi-access=free }} {{cite book |author=Platt, Suzy |title=Respectfully quoted: a dictionary of quotations |year=1993 |publisher=Barnes & Noble |isbn=0-88029-768-9 |pages= |url-access=registration |url=https://archive.org/details/respectfullyquot00suzy/page/388 }}</ref> Today, it is sometimes further reported that Huxley applied the example in a ] over ]'s '']'' with the Anglican Bishop of Oxford, Samuel Wilberforce, held at a meeting of the ] at Oxford on 30 June 1860. This story suffers not only from a lack of evidence, but the fact that in 1860 the typewriter was ].<ref name="Rescher2006">{{Cite book |last=Rescher |first=Nicholas |url=https://books.google.com/books?id=_NSBWYdDDAoC |title=Studies in the Philosophy of Science: A Counterfactual Perspective on Quantum Entanglement |date=2006 |publisher=Ontos Verlag |isbn=978-3-11-032646-8 |pages=103 |language=en}}</ref> | ||
Despite the original mix-up, monkey-and-typewriter arguments are now common in arguments over evolution. |
Despite the original mix-up, monkey-and-typewriter arguments are now common in arguments over evolution. As an example of ] Doug Powell argued that even if a monkey accidentally types the letters of ''Hamlet'', it has failed to produce ''Hamlet'' because it lacked the intention to communicate. His parallel implication is that natural laws could not produce the information content in ].<ref name="Powell2006">{{cite book |last=Powell |first=Doug |title=Holman Quicksource Guide to Christian Apologetics |year=2006 |publisher=Broadman & Holman | isbn = 0-8054-9460-X |pages=60, 63}}</ref> A more common argument is represented by Reverend ], who claimed that the genetic mutations necessary to produce a tapeworm from an amoeba are as unlikely as a monkey typing Hamlet's soliloquy, and hence the odds against the evolution of all life are impossible to overcome.<ref name="MacArthur2003">{{cite book |first=John |last=MacArthur |title=Think Biblically!: Recovering a Christian Worldview |year=2003 |publisher=Crossway Books |isbn=1-58134-412-0 |pages=78–79}}</ref> | ||
] ] employs the typing monkey concept in his |
] ] employs the typing monkey concept in his book '']'' to demonstrate the ability of ] to produce biological ] out of random ]s. In a simulation experiment Dawkins has his ] produce the Hamlet phrase ''METHINKS IT IS LIKE A WEASEL'', starting from a randomly typed parent, by "breeding" subsequent generations and always choosing the closest match from progeny that are copies of the parent with random mutations. The chance of the target phrase appearing in a single step is extremely small, yet Dawkins showed that it could be produced rapidly (in about 40 generations) using cumulative selection of phrases. The random choices furnish raw material, while cumulative selection imparts information. As Dawkins acknowledges, however, the weasel program is an imperfect analogy for evolution, as "offspring" phrases were selected "according to the criterion of resemblance to a ''distant ideal'' target." In contrast, Dawkins affirms, evolution has no long-term plans and does not progress toward some distant goal (such as humans). The weasel program is instead meant to illustrate the difference between ] cumulative selection, and ] single-step selection.<ref name="Dawkins1996">{{cite book |last=Dawkins |first=Richard |year=1996 |title=The Blind Watchmaker |publisher=W.W. Norton & Co. |isbn=0-393-31570-3 |pages= |url=https://archive.org/details/blindwatchmaker0000dawk/page/46 }}</ref> In terms of the typing monkey analogy, this means that ''Romeo and Juliet'' could be produced relatively quickly if placed under the constraints of a nonrandom, Darwinian-type selection because the ] will tend to preserve in place any letters that happen to match the target text, improving each successive generation of typing monkeys. | ||
A different avenue for |
A different avenue for exploring the analogy between evolution and an unconstrained monkey lies in the problem that the monkey types only one letter at a time, independently of the other letters. Hugh Petrie argues that a more sophisticated setup is required, in his case not for biological evolution but the evolution of ideas: | ||
{{blockquote|In order to get the proper analogy, we would have to equip the monkey with a more complex typewriter. It would have to include whole Elizabethan sentences and thoughts. It would have to include Elizabethan beliefs about human action patterns and the causes, Elizabethan morality and science, and linguistic patterns for expressing these. It would probably even have to include an account of the sorts of experiences which shaped Shakespeare's belief structure as a particular example of an Elizabethan. Then, perhaps, we might allow the monkey to play with such a typewriter and produce variants, but the impossibility of obtaining a Shakespearean play is no longer obvious. What is varied really does encapsulate a great deal of already-achieved knowledge.<ref name="Blachowicz1998">As quoted in {{cite book |first=James |last=Blachowicz |title=Of Two Minds: Nature of Inquiry |year=1998 |publisher=SUNY Press |isbn=0-7914-3641-1 |page=109}}</ref>}} | |||
], while admitting that the classic monkey's task is impossible, finds that there is a worthwhile analogy between written English and the ]n genome in this other sense: both have "combinatorial, hierarchical structures" that greatly constrain the immense number of combinations at the alphabet level.<ref>{{cite book |first=James |last=Valentine |title=On the Origin of Phyla |year=2004 |publisher=University of Chicago Press | |
], while admitting that the classic monkey's task is impossible, finds that there is a worthwhile analogy between written English and the ]n genome in this other sense: both have "combinatorial, hierarchical structures" that greatly constrain the immense number of combinations at the alphabet level.<ref name="Valentine2004">{{cite book |first=James |last=Valentine |title=On the Origin of Phyla |year=2004 |publisher=University of Chicago Press |isbn=0-226-84548-6 |pages=77–80}}</ref> | ||
=== Zipf's law === | |||
] states that the frequency of words is a power law function of its frequency rank:<math display="block">\text{word frequency} \propto \frac{1}{(\text{word rank} + b)^a}</math>where <math>a, b</math> are real numbers. Assuming that a monkey is typing randomly, with fixed and nonzero probability of hitting each letter key or white space, then the text produced by the monkey follows Zipf's law.<ref>{{Cite journal |last1=Conrad |first1=B. |last2=Mitzenmacher |first2=M. |date=July 2004 |title=Power laws for monkeys typing randomly: the case of unequal probabilities |url=https://ieeexplore.ieee.org/document/1306541 |journal=IEEE Transactions on Information Theory |volume=50 |issue=7 |pages=1403–1414 |doi=10.1109/TIT.2004.830752 |s2cid=8913575 |issn=1557-9654}}</ref> | |||
===Literary theory=== | ===Literary theory=== | ||
] argued in 1938 that art cannot be produced by accident, and wrote as a sarcastic aside to his critics, | ] argued in 1938 that art cannot be produced by accident, and wrote as a sarcastic aside to his critics, | ||
<blockquote>…some … have denied this proposition, pointing out that if a monkey played with a typewriter … he would produce … the complete text of Shakespeare. Any reader who has nothing to do can amuse himself by calculating how long it would take for the probability to be worth betting on. But the interest of the suggestion lies in the revelation of the mental state of a person who can identify the 'works' of Shakespeare with the series of letters printed on the pages of a book…<ref>p.126 of ''The Principles of Art'', as summarized and quoted by {{cite journal |first=Richard J. |last=Sclafani |title=The logical primitiveness of the concept of a work of art |journal=British Journal of Aesthetics |year=1975 |volume=15 |issue=1 |id={{doi|doi:10.1093/bjaesthetics/15.1.14}}}}</ref></blockquote> | |||
{{blockquote|... some ... have denied this proposition, pointing out that if a monkey played with a typewriter ... he would produce ... the complete text of Shakespeare. Any reader who has nothing to do can amuse himself by calculating how long it would take for the probability to be worth betting on. But the interest of the suggestion lies in the revelation of the mental state of a person who can identify the 'works' of Shakespeare with the series of letters printed on the pages of a book ...<ref name="Sclafani1975">p. 126 of ''The Principles of Art'', as summarized and quoted by {{cite journal |first=Richard J. |last=Sclafani |title=The logical primitiveness of the concept of a work of art |journal=British Journal of Aesthetics |year=1975 |volume=15 |issue=1 |doi=10.1093/bjaesthetics/15.1.14 |page=14}}</ref>}} | |||
] took the contrary position, illustrating his point along with Catherine Elgin by the example of Borges' “]”, | |||
<blockquote>What Menard wrote is simply another inscription of the text. Any of us can do the same, as can printing presses and photocopiers. Indeed, we are told, if infinitely many monkeys … one would eventually produce a replica of the text. That replica, we maintain, would be as much an instance of the work, ''Don Quixote'', as Cervantes' manuscript, Menard's manuscript, and each copy of the book that ever has been or will be printed.<ref>{{cite book |author=John, Eileen and Dominic Lopes, editors |title=The Philosophy of Literature: Contemporary and Classic Readings: An Anthology |year=2004 |publisher=Blackwell |id=ISBN 1-4051-1208-5 |pages=96}}</ref></blockquote> | |||
] took the contrary position, illustrating his point along with Catherine Elgin by the example of Borges' "]", | |||
In another writing, Goodman elaborates, "That the monkey may be supposed to have produced his copy randomly makes no difference. It is the same text, and it is open to all the same interpretations…." ] dismisses Goodman's argument as begging the question.<ref>{{cite book |first=Gérard |last= Genette |title=The Work of Art: Immanence and Transcendence |year=1997 |publisher=Cornell UP |id=ISBN 0801482720}}</ref> | |||
{{blockquote|What Menard wrote is simply another inscription of the text. Any of us can do the same, as can printing presses and photocopiers. Indeed, we are told, if infinitely many monkeys ... one would eventually produce a replica of the text. That replica, we maintain, would be as much an instance of the work, ''Don Quixote'', as Cervantes' manuscript, Menard's manuscript, and each copy of the book that ever has been or will be printed.<ref name="John2004">{{cite book |editor1=John, Eileen |editor2=Dominic Lopes |title=The Philosophy of Literature: Contemporary and Classic Readings: An Anthology |year=2004 |publisher=Blackwell |isbn=1-4051-1208-5 |page=96}}</ref>}} | |||
For ], the question of the identity of texts leads to a different question, that of ]. If a monkey is capable of typing ''Hamlet'', despite having no intention of meaning and therefore disqualifying itself as an author, then it appears that texts do not require authors. Possible solutions include saying that whoever finds the text and identifies it as ''Hamlet'' is the author; or that Shakespeare is the author, the monkey his agent, and the finder merely a user of the text. These solutions have their own difficulties, in that the text appears to have a meaning separate from the other agents: what if the monkey operates before Shakespeare is born, or if Shakespeare is never born, or if no one ever finds the monkey's typescript?<ref>{{cite book |last=Gracia |first=Jorge |title=Texts: Ontological Status, Identity, Author, Audience |year=1996 |publisher=SUNY Press |id=ISBN 0-7914-2901-6 |pages=1–2, 122–125}}</ref> | |||
In another writing, Goodman elaborates, "That the monkey may be supposed to have produced his copy randomly makes no difference. It is the same text, and it is open to all the same interpretations. ..." ] dismisses Goodman's argument as ].<ref name="Genette1997">{{cite book |first=Gérard |last= Genette |title=The Work of Art: Immanence and Transcendence |url=https://archive.org/details/workofart00gene |url-access=registration |year=1997 |publisher=Cornell UP |isbn=0-8014-8272-0}}</ref> | |||
===Random number generation=== | |||
The theorem concerns a ] which cannot be fully carried out in practice, since it is predicted to require prohibitive amounts of time and resources. Nonetheless, it has inspired efforts in finite random text generation. | |||
For ], the question of the identity of texts leads to a different question, that of author. If a monkey is capable of typing ''Hamlet'', despite having no intention of meaning and therefore disqualifying itself as an author, then it appears that texts do not require authors. Possible solutions include saying that whoever finds the text and identifies it as ''Hamlet'' is the author; or that Shakespeare is the author, the monkey his agent, and the finder merely a user of the text. These solutions have their own difficulties, in that the text appears to have a meaning separate from the other agents: What if the monkey operates before Shakespeare is born, or if Shakespeare is never born, or if no one ever finds the monkey's typescript?<ref name="Gracia1996">{{cite book |last=Gracia |first=Jorge |title=Texts: Ontological Status, Identity, Author, Audience |year=1996 |publisher=SUNY Press |isbn=0-7914-2901-6 |pages=1–2, 122–125}}</ref> | |||
One computer program run by Dan Oliver of Scottsdale, Arizona, according to an article in '']'', came up with a result on August 4, 2004: After the group had worked for 42,162,500,000 billion billion monkey-years, one of the "monkeys" typed, “VALENTINE. Cease toIdor:eFLP0FRjWK78aXzVOwm)-‘;8.t . . ." The first 19 letters of this sequence can be found in "The Two Gentlemen of Verona". Other teams have reproduced 18 characters from "Timon of Athens", 17 from "Troilus and Cressida", and 16 from "Richard II".<ref name=ja> Acocella, Joan, "The Typing Life: How writers used to write", '']'', ], ], a review of ''The Iron Whim: A Fragmented History of Typewriting'' (Cornell) 2007, by Darren Wershler-Henry</ref> | |||
===Simulated and limited conditions=== | |||
A website entitled The Monkey Shakespeare Simulator, launched on ], ], contained a ] that simulates a large population of monkeys typing randomly, with the stated intention of seeing how long it takes the virtual monkeys to produce a complete Shakespearean play from beginning to end. For example, it produced this partial line from '']'', reporting that it took "2,737,850 million billion billion billion monkey-years" to reach 24 matching characters: | |||
In 1979, ], a profesor of ] at ], brought fresh attention to the theorem by applying a series of computer programs. Dr. Bennett simulated varying conditions under which an imaginary monkey, given a keyboard consisting of twenty-eight characters, and typing ten keys per second, might attempt to reproduce the sentence, "To be or not to be, that is the question." Although his experiments agreed with the overall conclusion that even such a short string of words would require many times the current age of the universe to reproduce, he noted that by modifying the statistical probability of certain letters to match the ordinary patterns of various languages and of Shakespeare in particular, seemingly random strings of words could be made to appear. But even with several refinements, the English sentence closest to the target phrase remained gibberish: "TO DEA NOW NAT TO BE WILL AND THEM BE DOES DOESORNS CAI AWROUTROULD."<ref>{{cite journal|date=March 6, 1979|author=Boyce Rensberger|title=Computer Says Monkeys Couldn't Write 'Hamlet'—At Least Not So Far|work=]|url=https://www.nytimes.com/1979/03/06/archives/computer-says-monkeys-couldnt-write-hamlet-at-least-not-so-far.html}}</ref> | |||
:''RUMOUR. Open your ears; 9r"5j5&?OWTY Z0d…'' | |||
===Random document generation=== | |||
Due to processing power limitations, the program uses a probabilistic model (by using a ] or RNG) instead of actually generating random text and comparing it to Shakespeare. When the simulator "detects a match" (that is, the RNG generates a certain value or a value within a certain range), the simulator simulates the match by generating matched text.<ref>{{cite web | title = The Monkey Shakespeare Simulator | url= http://web.archive.org/web/20060207100939/http://user.tninet.se/~ecf599g/aardasnails/java/Monkey/webpages/index.html | |||
The theorem concerns a ] which cannot be fully carried out in practice, since it is predicted to require prohibitive amounts of time and resources. Nonetheless, it has inspired efforts in finite random text generation. | |||
| accessdate=2006-06-13}} Link inactive as of ].</ref> | |||
One computer program run by Dan Oliver of Scottsdale, Arizona, according to an article in '']'', came up with a result on 4 August 2004: After the group had worked for 42,162,500,000 billion billion monkey-years, one of the "monkeys" typed, "<samp>VALENTINE. Cease toIdor:eFLP0FRjWK78aXzVOwm)-‘;8.t</samp>" The first 19 letters of this sequence can be found in "The Two Gentlemen of Verona". Other teams have reproduced 18 characters from "Timon of Athens", 17 from "Troilus and Cressida", and 16 from "Richard II".<ref name="ja">{{cite magazine |url=http://www.newyorker.com/arts/critics/books/2007/04/09/070409crbo_books_acocella?currentPage=all |last=Acocella |first=Joan |title=The typing life: How writers used to write |magazine=] |date=9 April 2007}} – a review of {{cite book |title=The Iron Whim: A fragmented history of typewriting |publisher=Cornell University Press |year=2007 |first=Darren |last=Wershler-Henry}}</ref> | |||
Questions about the statistics describing how often an ideal monkey should type certain strings can motivate practical tests for random number generators as well; these range from the simple to the "quite sophisticated". Computer science professors ] and ] report that they used to call such tests "overlapping m-] tests" in lecture, since they concern overlapping m-tuples of successive elements in a random sequence. But they found that calling them "monkey tests" helped to motivate the idea with students. They published a report on the class of tests and their results for various RNGs in 1993.<ref>{{cite journal |author=Marsaglia, George and Arif Zaman |title=Monkey Tests for Random Number Generators |journal=Computers & Mathematics with Applications |volume=9 |pages=1–10 |year=1993 |url=http://www.jstatsoft.org/v14/i13/monkey.pdf}}</ref> | |||
A website entitled ''The Monkey Shakespeare Simulator'', launched on 1 July 2003, contained a ] that simulated a large population of monkeys typing randomly, with the stated intention of seeing how long it takes the virtual monkeys to produce a complete Shakespearean play from beginning to end. For example, it produced this partial line from '']'', reporting that it took "2,737,850 million billion billion billion monkey-years" to reach 24 matching characters: | |||
==Real monkeys== | |||
:<samp>RUMOUR. Open your ears; 9r"5j5&?OWTY Z0d</samp> | |||
Primate behaviorists Cheney and Seyfarth remark that real monkeys would indeed have to rely on chance to have any hope of producing '']''. Unlike ]s and particularly ]s, the evidence suggests that monkeys lack a ] and are unable to differentiate between their own and others' knowledge, emotions, and beliefs. Even if a monkey could learn to write a play and describe the characters' behavior, it could not reveal the characters' minds and so build an ironic tragedy.<ref>{{cite book |author=Cheney, Dorothy L. and Robert M. Seyfarth |title=How Monkeys See the World: Inside the Mind of Another Species |publisher=University of Chicago Press |year=1992 |id=ISBN 0-226-10246-7 |pages=253–255}}</ref> | |||
Due to processing power limitations, the program used a probabilistic model (by using a ] or RNG) instead of actually generating random text and comparing it to Shakespeare. When the simulator "detected a match" (that is, the RNG generated a certain value or a value within a certain range), the simulator simulated the match by generating matched text.<ref>{{cite web |url=http://io9.gizmodo.com/5809583/the-story-of-the-monkey-shakespeare-simulator-project |title=The story of the Monkey Shakespeare Simulator Project |last1=Inglis-Arkell |first1=Esther |date=June 9, 2011 |website=io9 |publisher=gizmodo |access-date=24 February 2016}}</ref> | |||
In 2003, lecturers and students from the ] MediaLab Arts course used a £2,000 grant from the ] to study the literary output of real monkeys. They left a computer keyboard in the enclosure of six ]s in ] in ] in ] for a month, with a radio link to broadcast the results on a website. One researcher, Mike Phillips, defended the expenditure as being cheaper than reality TV and still "very stimulating and fascinating viewing".<ref name="BBC News">{{cite news | title= No words to describe monkeys' play | date= ] | publisher= BBC News | url= http://news.bbc.co.uk/1/3013959.stm | accessdate = 2007-02-05}}</ref> | |||
===Testing of random-number generators=== | |||
Not only did the monkeys produce nothing but five pages<ref>{{cite web | title = Notes Towards the Complete Works of Shakespeare | url= http://www.vivaria.net/experiments/notes/publication/NOTES_EN.pdf | format = PDF | publisher = vivaria.net | year= 2002 | accessdate = 2006-06-13}}</ref> consisting largely of the letter ], the lead male began by "bashing the hell out of" the keyboard with a stone, and the monkeys continued by urinating and defecating on it. The zoo's scientific officer remarked that the experiment had "little scientific value, except to show that the 'infinite monkey' theory is flawed". Phillips said that the artist-funded project was primarily performance art, and they had learned "an awful lot" from it. He concluded that monkeys "are not random generators. They're more complex than that. … They were quite interested in the screen, and they saw that when they typed a letter, something happened. There was a level of intention there."<ref name="BBC News" /><ref>{{cite news |url=http://www.wired.com/news/culture/0,1284,58790,00.html |title=Monkeys Don't Write Shakespeare |author=Associated Press |publisher=Wired News |date= ]| accessdate = 2007-03-02}}</ref> | |||
{{main|Diehard tests}} | |||
Questions about the statistics describing how often an ideal monkey is ] to type certain strings translate into ]; these range from the simple to the "quite sophisticated". Computer-science professors ] and ] report that they used to call one such category of tests "overlapping m-] tests" in lectures, since they concern overlapping m-tuples of successive elements in a random sequence. But they found that calling them "monkey tests" helped to motivate the idea with students. They published a report on the class of tests and their results for various RNGs in 1993.<ref name="Marsaglia1993"> | |||
{{Cite journal |last1=Marsaglia |first1=George |last2=Zaman |first2=Arif |year=1993 |title=Monkey tests for random number generators |journal=Computers & Mathematics with Applications |publisher=Elsevier, Oxford |volume=26 |issue=9 |pages=1–10 |doi=10.1016/0898-1221(93)90001-C |issn=0898-1221 |doi-access=free}} | |||
</ref> | |||
== |
==In popular culture== | ||
{{Main|Infinite monkey theorem in popular culture}} | |||
The infinite monkey theorem, or some version thereof, appears in novels, short stories, plays, a radio program, television programs in various genres, graphic novels, stand-up comedy routines, musical works, and the Internet. | |||
The infinite monkey theorem and its associated imagery is considered a popular and proverbial illustration of the mathematics of probability, widely known to the general public because of its transmission through popular culture rather than through formal education.{{efn|Examples of the theorem being referred to as proverbial include: {{cite journal |title=Why creativity is not like the proverbial typing monkey |first1=Jonathan W. |last1=Schooler |first2=Sonya |last2=Dougal |journal=Psychological Inquiry |volume=10 |issue=4 |year=1999}}; and {{cite book |title=The Case of the Midwife Toad |author-link=Arthur Koestler |first=Arthur |last=Koestler |place=New York |year=1972 |page=30 |quote=Neo-Darwinism does indeed carry the nineteenth-century brand of materialism to its extreme limits{{spaced endash}}to the proverbial monkey at the typewriter, hitting by pure chance on the proper keys to produce a Shakespeare sonnet.}} The latter is sourced from {{cite web |url=https://www.angelfire.com/in/hypnosonic/Parable_of_the_Monkeys.html |title=Parable of the Monkeys}}, a collection of historical references to the theorem in various formats.}} This is helped by the innate humor stemming from the image of literal monkeys rattling away on a set of typewriters, and is a popular visual gag. | |||
A quotation attributed<ref>{{Citation |title=Robert Wilensky 1951–American academic |url=https://www.oxfordreference.com/view/10.1093/acref/9780191826719.001.0001/q-oro-ed4-00011578 |work=Oxford Essential Quotations |year=2016 |editor=Susan Ratcliffe |publisher=Oxford University Press |quotation=in Mail on Sunday 16 February 1997 ‘Quotes of the Week’}}</ref><ref>{{Cite news |last=Lewis |first=Bob |date=1997-06-02 |title=It's time for some zoning laws in today's version of the Old West: the Web |volume=19 |page=84 |work=InfoWorld |publisher=InfoWorld Media Group, Inc. |issue=22 |department=Enterprise Computing, IS Survival Guide |url=https://books.google.com/books?id=-DsEAAAAMBAJ&pg=PA84 |issn=0199-6649 |postscript=. May also be in "Bob Lewis's IS Survival Guide", published March 19, 1999, ISBN 978-0672314377}}</ref> to a 1996 speech by Robert Wilensky stated, "We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." | |||
===Literature=== | |||
*]'s '']'' (1782) anticipates the central idea of the theorem, depicting a ] of the Grand Academy of Lagado who attempts to create a complete list of all knowledge of science by having his students constantly create random strings of letters by turning cranks on a mechanism (Part three, Chapter five): although his intention was more likely to parody ]. | |||
*In "Inflexible Logic" by ], a short story that appeared in '']'' in 1940, the protagonist felt that his wealth put him under an obligation to support the ]s, and so he tested the theory. His monkeys immediately set to work typing, without error, classics of fiction and nonfiction. The rich man was amused to see unexpurgated versions of ]'s diaries, of which he owned only a copy of a ]d edition. | |||
*]' "]" depicts a library which contains books consisting of every single possible permutation of characters. The narrator notes that every great work of literature is contained in the library; but these are outnumbered by the flawed works (which are themselves vastly outnumbered by works of pure gibberish). | |||
*In the one-act ] '']'' by ], three monkeys named ], ], and ] have been confined to a cage by a scientist until they can write ''Hamlet.'' | |||
*In a ]ous ] "Been a Long, Long Time" by ], an angel is punished by having to proofread all the output text until some future time (after trillions of Universes have been created and died) when the monkeys produce a perfect copy of Shakespeare's works. | |||
*In ]'s play '']'', one character says, "If six monkeys..." and then cannot continue, as the characters are actually ''within'' '']'', one possible topic of this rule. He then finishes the sentence on a different topic. | |||
*]'s '']'' included a chapter in which some persons play a game with some dice with alphabetic characters carved on the faces. Rules are not clear but supposedly the dice are thrown and the results of them are the words, which are then collected. Sometimes, a coherent word or sentence will be formed and eventually all the stories of the world will appear in this game. | |||
*In ]'s novel '']'' Elizabeth Costello's son John thinks: "''Sleep'', he thinks, ''that knits up the ravelled sleeve of care''. What an extraordinary way of putting it! Not all the monkeys in the world picking away at typewriters all their lives would come up with those words in that arrangement." | |||
*In ]'s short story "The Spade of Reason", the main character seeks to find meaning in the universe through text randomly generated through various means; the original program he uses to do so is something he dubs the "Motorola Monkey". | |||
*In ], Arthur, while under the effects of the ], discovers an infinite number of monkeys and tells Ford of their intentions; " want to talk to us about this new script for Hamlet they've worked out." | |||
The enduring, widespread popularity of the theorem was noted in the introduction to a 2001 paper, "Monkeys, Typewriters and Networks: The Internet in the Light of the Theory of Accidental Excellence".<ref>{{cite web |url=http://skylla.wz-berlin.de/pdf/2002/ii02-101.pdf |title=Monkeys, Typewriters and Networks |archive-url=https://web.archive.org/web/20080513012236/http://skylla.wz-berlin.de/pdf/2002/ii02-101.pdf |archive-date=2008-05-13 |first1=Ute |last1=Hoffmann |first2=Jeanette |last2=Hofmann |publisher=Wissenschaftszentrum Berlin für Sozialforschung gGmbH (WZB) |year=2001}}</ref> In 2002, an article in '']'' said, "Plenty of people have had fun with the famous notion that an infinite number of monkeys with an infinite number of typewriters and an infinite amount of time could eventually write the works of Shakespeare".<ref>{{cite news |first=Ken |last=Ringle |url=https://www.washingtonpost.com/ac2/wp-dyn/A28521-2002Oct27?language=printer |archive-url=https://web.archive.org/web/20021115230959/http://www.washingtonpost.com/ac2/wp-dyn/A28521-2002Oct27?language=printer |url-status=dead |archive-date=15 November 2002 |title=Hello? This is Bob |newspaper=] |date=28 October 2002 |page=C01}}</ref> In 2003, the previously mentioned ]−funded experiment involving real monkeys and a computer keyboard received widespread press coverage.<ref name=vivariaNotesShakespeare>{{cite web |url=http://www.vivaria.net/experiments/notes/documentation/press/ |title=Notes towards the complete works of Shakespeare |year=2002 |website=vivaria.net |archive-url=https://web.archive.org/web/20070716153346/http://www.vivaria.net/experiments/notes/documentation/press/ |archive-date=2007-07-16 }} – some press clippings.</ref> In 2007, the theorem was listed by '']'' magazine in a list of eight classic ]s.<ref>{{cite magazine |first=Greta |last=Lorge |url=https://www.wired.com/science/discoveries/magazine/15-06/st_best |title=The best thought experiments: Schrödinger's cat, Borel's monkeys |magazine=Wired |volume=15 |issue=6 |date=May 2007}}</ref> | |||
===Television and radio=== | |||
] | |||
*In '']'' episode '']'', ] has his own room with 1000 monkeys at typewriters, one of which he chastises for mistyping a word in the opening sentence of '']'' — "It was the best of times, it was the ''blurst of times''? You stupid monkey!" | |||
*On ''],'' ] promised that none of their material would be plagiarized (after a few stories on the subject) because their show would be written by monkeys. A monkey was then shown typing material for the show; Jon was handed the monkey's latest output, only to reject it. | |||
*In June of 2006, '']'' featured a humorous segment on how many monkeys it would take for various works. This was in response to comments made in the news on monkeys typing out the ] or the ]. According to Colbert, one million monkeys typing for eternity would produce a Shakespeare, ten thousand (drinking) monkeys typing for ten thousand years would produce a ], and ten monkeys typing for three days would produce a work of ]. | |||
*In an episode of '']'', Sheen makes a science project that is very similar: He puts a bug in a glass dome, and places it in front of a hungry lizard on a keyboard. The idea is that the lizard will hit the keys with its feet while trying to get the bug, and will eventually write a great American novel. | |||
*An episode of '']'' features a large room filled with several types of monkeys with typewriters who are working on a novel. When Weasel tries to pay them in bananas, they consider it an insult and quit their job, aside from '']''. | |||
*In an episode of the daytime soap opera ] (broadcast ], ]), when ] copies a scramble of letters obtained from the Grugeon ] onto a dry board, Professor ] jokingly asks if she's testing the Infinite Monkey Theorem. | |||
*In the 5th episode of the first season of ], a radio compilation put out by ], comedian ] to explain this theorem to ], who refused to believe it possible. In attempting to explain the mathematics behind the theorem, Gervais eventually gives up and storms out of the room when, after a long explication by Gervais and ], Karl says "if they haven't even read Shakespeare, how do they know what they're doin?" | |||
*In a sketch in the comedy show ] (BBC2 2001) ] tackles the million monkey theory, his best line is; "the million monkeys were given a million typewriters... why that would be the internet surely?" | |||
*In an episode of the tv-show Titus ] states that "If you let Dave hit at a typewriter eventually he would type the word monkey. In fact, he would only type the word monkey. 'Cause that's his favorite word." | |||
*In the ] episode ], Lois questions Peter's creativity, to which he replies, "Oh, art-schmart. Put enough monkeys in a room with a typewriter they'll produce Shakespeare.". The screen then cuts to several monkeys in a room, arguing over which flower is most appropriate in the famous line from Romeo and Juliet. | |||
American playwright ]' short ] '']'', from the collection '']'', pokes fun of the concept of the infinite monkey theorem. | |||
===Comics and graphic novels=== | |||
*In the comic strip '']'', Dogbert tells Dilbert that his poem would take "three monkeys, ten minutes". | |||
*The '']'' comic by ] contained an issue including a monkey who typed not only the works of Shakespeare, but comic books as well. The ] this is included in featured an "infinite" number of Grant Morrisons typing on the cover. | |||
*In one strip of '']'', Peter mentions the monkey theorem to Paige and tells her Jason wrote a program that generates random letters of the alphabet, adding "if it works for 'Hamlet' why not a 'Hamlet' book report?" | |||
In 2015 Balanced Software released Monkey Typewriter on the Microsoft Store.<ref>{{Cite web |date=2015-11-16 |title=Monkey Typewriter |url=https://apps.microsoft.com/store/detail/monkey-typewriter/9NBLGGH69FC8 |access-date=2022-02-14 |website=Microsoft Store Apps |publisher=Balanced Software |language=en-us |id=9NBLGGH69FC8}}</ref> The software generates random text using the Infinite Monkey theorem string formula. The software queries the generated text for user inputted phrases. However the software should not be considered true to life representation of the theory. This is a more of a practical presentation of the theory rather than scientific model on how to randomly generate text. | |||
===Stand-up comedy=== | |||
*] ] has a ] routine in which a lab technician monitoring an "infinitely many monkeys" experiment discovered that one of the monkeys has typed "To be, or not to be; that is the gezortenblatt." {{Fact|date=May 2007}} | |||
*] incorporates the theory into his act, saying that he actually has 100,000 monkeys, but unfortunately only one typewriter. {{Fact|date=May 2007}} | |||
== |
==See also== | ||
* {{annotated link|Boltzmann brain}} | |||
*''"It is said that if you place a million monkeys in front, of a million keyboards, they will eventually produce the works of Shakespeare. This is simply not true. They cannot even produce an encyclopedia."'' from ]. | |||
* {{annotated link|Borel–Cantelli lemma#Converse result|Second Borel–Cantelli lemma}} | |||
*In 2000, the ] Internet standards committee's ] proposed an "Infinite Monkey Protocol Suite (IMPS)", a method of directing a farm of infinitely many monkeys over the Internet.<ref>{{cite web | title=RFC 2795: The Infinite Monkey Protocol Suite (IMPS) | author=S. Christey | url=http://tools.ietf.org/html/2795 | date= 1 April 2000 | accessdate=2006-06-13}}</ref> | |||
* {{annotated link|Hilbert's paradox of the Grand Hotel}}, another thought experiment involving infinity | |||
*, the ] of author and actor ], uses the slogan, "50,000 monkeys at 50,000 typewriters can't be wrong." His witticism won him a ] in 2002 for the category "Best Tagline of a Weblog." Ironically,Mr. Weaton's blog was itself shut down for nine months when someone entering a comment typed a random series of letters which just so happened to be a signal used by his blogging software, causing massive server problems. | |||
* {{annotated link|Law of truly large numbers}} | |||
*] once jocularly remarked, "We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true." In a similar vein, '']'' stated, "If an infinite number of monkeys typed 24-hours a day on an infinite number of computers, the result would be not unlike an ] Chatroom." | |||
* {{annotated link|Murphy's law}} | |||
*''],'' a ] illustrated by ], featured <!--as of Aug 2005, is in the middle of --> a story line named '''' where several characters accidentally teleport to an alternate dimension. There they find that this dimension is populated by monkeys with typewriters, presumably typing the scripts of many other dimensions. | |||
* {{annotated link|Normal number}} | |||
*In 2006 the ] was launched by predictive text company T9. The Europe-wide project sees users, unknown to each other, text a word of their choosing to the Website. The text message is free and as it continues the words are combined to form lyrics. The lyrics are then made into a song by the Hip Hop artist Sparo which will be released as an album. If any of the tracks becomes a hit the people who texted in the words for the lyrics will receive royalties from the project.<ref>{{cite web|url=http://www.computermusic.co.uk/page/computermusic?entry=monkeys|title=The articulate monkeys|publisher=Computer Music|accessdate=2006-11-09}}</ref><ref>{{cite web|url=http://www.pocket-lint.co.uk/news/news.phtml/5299/6323/Infinite-Infinite-Project-t9-texting.phtml|title=Infinite Monkey Project wants your texts|publisher=Pocket-lint|accessdate=2006-11-09}}</ref><ref>{{cite web|url=http://www.caughtinthecrossfire.com/music/news/2445|title=The Infinite Monkey Project|publisher=Crossfire|accessdate=2006-11-09}}</ref> | |||
* {{annotated link|Stochastic parrot}} | |||
*] often names its article improvement projects '10,000 Monkeys Typing Hamlet'. Its French counterpart "Desencyclopedie" claims to be completely written by an infinite number of monkeys typing on keyboards. | |||
* {{annotated link|Texas sharpshooter fallacy}} | |||
*Online there is a game mocking the theorem called "Mojo the Monkey", in which a monkey types random keys that show up on the screen. When the monkey types an actual word, you highlight it and save it to the website's server and highscore list.<ref></ref> | |||
* {{annotated link|The Engine}} | |||
* {{annotated link|The Hidden Reality|''The Hidden Reality: Parallel Universes and the Deep Laws of the Cosmos''}} | |||
* {{annotated link|The Infinite Monkey Cage|''The Infinite Monkey Cage''}} | |||
* {{annotated link|The Library of Babel}} | |||
== |
==Notes== | ||
{{notelist|1}} | |||
*The 1979 debut album by Leeds ] band ] is called ''The Quality of Mercy is Not Strnen.'' Originally released on ] in the United Kingdom, its cover features a photo of a typing chimp (which, of course, is not a monkey at all). | |||
*In 1983, the Windbreakers, a power-pop band from Mississippi, released an EP called ''Any Monkey With a Typewriter.'' | |||
*In 1989, the band ] sampled ] on their album ] saying, "If you get enough monkeys, enough typewriters, and enough bread, one of them will eventually come up with the ] of the ]!!!" while to chants of "We don't have enough data. We just don't have enough data" said by a Japanese secretary. | |||
*In 2007, ], an electronic rock band on , recorded ''The Infinite Monkey Theorem'' featuring a chorus with the lyrics, "Got a pet monkey down in the basement, chained to a typewriter pounding away, churning out copies of the works of ]; halfway through ] he wrote me this song." | |||
==References== | |||
==Notes and references== | |||
{{reflist|25em}} | |||
<!--This article uses the Cite.php citation mechanism. If you would like more information on how to add references to this article, please see http://meta.wikimedia.org/Cite/Cite.php --> | |||
<div class="references-small" style="-moz-column-count:2; column-count:2;"> | |||
<references/> | |||
</div> | |||
==External links== | ==External links== | ||
* |
* {{cite web |url=http://mathforum.org/library/drmath/view/55871.html |title=Ask Dr. Math |id=article 55871 |date=August 1998 |first=Adam |last=Bridge |website=mathforum.org}} | ||
* |
* {{cite web |url=https://www.angelfire.com/in/hypnosonic/Parable_of_the_Monkeys.html |title=The Parable of the Monkeys |archive-url=https://web.archive.org/web/20030604032733/https://www.angelfire.com/in/hypnosonic/Parable_of_the_Monkeys.html |archive-date=2003-06-04 |via=angelfire}} – a bibliography with quotations | ||
* {{cite web |url=http://azureworld.blogspot.com/2007/04/planck-monkeys.html |title=Planck Monkeys|date=12 April 2007}} – on populating the cosmos with monkey particles | |||
* {{cite web |url=http://www.pixelmonkeys.org/ |title=PixelMonkeys.org}} – Matt Kane's application of the ''Infinite Monkey Theorem'' on pixels to create images. | |||
* {{cite IETF|rfc=2795 |title=The Infinite Monkey Protocol Suite (IMPS)|year=2000 |last1=Christey |first1=S. }} – ] on the implementation of the ''Infinite Monkey Theorem''. | |||
* {{cite journal | last1=Woodcock | first1=Stephen | last2=Falletta | first2=Jay | title=A numerical evaluation of the Finite Monkeys Theorem | journal=Franklin Open | publisher=Elsevier BV | volume=9 | year=2024 | issn=2773-1863 | doi=10.1016/j.fraope.2024.100171 | doi-access=free | page=100171}} | |||
{{Areas of mathematics}} | |||
{{Portal bar|Mathematics|North America}} | |||
{{DEFAULTSORT:Infinite Monkey Theorem}} | |||
{{featured article}} | |||
] | |||
] | |||
<!--{{Link FA|en}}--> | |||
<!--]--> | |||
] | |||
] | ] | ||
] | ] | ||
] | ] | ||
] | ] | ||
] | ] | ||
] | |||
] | ] | ||
{{Link FA|sv}} | |||
{{Link FA|da}} | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] | |||
] |
Latest revision as of 19:13, 4 January 2025
Counterintuitive result in probability
The infinite monkey theorem states that a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type any given text, including the complete works of William Shakespeare. In fact, the monkey would almost surely type every possible finite text an infinite number of times. The theorem can be generalized to state that any sequence of events that has a non-zero probability of happening will almost certainly occur an infinite number of times, given an infinite amount of time or a universe that is infinite in size.
In this context, "almost surely" is a mathematical term meaning the event happens with probability 1, and the "monkey" is not an actual monkey, but a metaphor for an abstract device that produces an endless random sequence of letters and symbols. Variants of the theorem include multiple and even infinitely many typists, and the target text varies between an entire library and a single sentence.
One of the earliest instances of the use of the "monkey metaphor" is that of French mathematician Émile Borel in 1913, but the first instance may have been even earlier. Jorge Luis Borges traced the history of this idea from Aristotle's On Generation and Corruption and Cicero's De Natura Deorum (On the Nature of the Gods), through Blaise Pascal and Jonathan Swift, up to modern statements with their iconic simians and typewriters. In the early 20th century, Borel and Arthur Eddington used the theorem to illustrate the timescales implicit in the foundations of statistical mechanics.
Solution
Direct proof
There is a straightforward proof of this theorem. As an introduction, recall that if two events are statistically independent, then the probability of both happening equals the product of the probabilities of each one happening independently. For example, if the chance of rain in Moscow on a particular day in the future is 0.4 and the chance of an earthquake in San Francisco on any particular day is 0.00003, then the chance of both happening on the same day is 0.4 × 0.00003 = 0.000012, assuming that they are indeed independent.
Consider the probability of typing the word banana on a typewriter with 50 keys. Suppose that the keys are pressed randomly and independently, meaning that each key has an equal chance of being pressed regardless of what keys had been pressed previously. 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. Therefore, the probability of the first six letters spelling banana is:
- (1/50) × (1/50) × (1/50) × (1/50) × (1/50) × (1/50) = (1/50) = 1/15,625,000,000.
The result is less than one in 15 billion, but not zero.
From the above, the chance of not typing banana in a given block of 6 letters is 1 − (1/50). Because each block is typed independently, the chance Xn of not typing banana in any of the first n blocks of 6 letters is:
As n grows, Xn gets smaller. For n = 1 million, Xn is roughly 0.9999, but for n = 10 billion Xn is roughly 0.53 and for n = 100 billion it is roughly 0.0017. As n approaches infinity, the probability Xn approaches zero; that is, by making n large enough, Xn can be made as small as is desired, and the chance of typing banana approaches 100%. Thus, the probability of the word banana appearing at some point in an infinite sequence of keystrokes is equal to one.
The same argument applies if we replace one monkey typing n consecutive blocks of text with n monkeys each typing one block (simultaneously and independently). In this case, Xn = (1 − (1/50)) is the probability that none of the first n monkeys types banana correctly on their first try. Therefore, at least one of infinitely many monkeys will (with probability equal to one) produce a text as quickly as it would be produced by a perfectly accurate human typist copying it from the original.
Infinite strings
This can be stated more generally and compactly in terms of strings, which are sequences of characters chosen from some finite alphabet:
- Given an infinite string where each character is chosen uniformly at random, any given finite string almost surely occurs as a substring at some position.
- Given an infinite sequence of infinite strings, where each character of each string is chosen uniformly at random, any given finite string almost surely occurs as a prefix of one of these strings.
Both follow easily from the second Borel–Cantelli lemma. For the second theorem, let Ek be the event that the kth string begins with the given text. Because this has some fixed nonzero probability p of occurring, the Ek are independent, and the below sum diverges,
the probability that infinitely many of the Ek occur is 1. The first theorem is shown similarly; one can divide the random string into nonoverlapping blocks matching the size of the desired text and make Ek the event where the kth block equals the desired string.
Probabilities
However, for physically meaningful numbers of monkeys typing for physically meaningful lengths of time the results are reversed. If there were as many monkeys as there are atoms in the observable universe typing extremely fast for trillions of times the life of the universe, the probability of the monkeys replicating even a single page of Shakespeare is unfathomably small.
Ignoring punctuation, spacing, and capitalization, a monkey typing letters uniformly at random has a chance of one in 26 of correctly typing the first letter of Hamlet. It has a chance of one in 676 (26 × 26) of typing the first two letters. Because the probability shrinks exponentially, at 20 letters it already has only a chance of one in 26 = 19,928,148,895,209,409,152,340,197,376 (almost 2 × 10). In the case of the entire text of Hamlet, the probabilities are so vanishingly small as to be inconceivable. The text of Hamlet contains approximately 130,000 letters. Thus, there is a probability of one in 3.4 × 10 to get the text right at the first trial. The average number of letters that needs to be typed until the text appears is also 3.4 × 10, or including punctuation, 4.4 × 10.
Even if every proton in the observable universe (which is estimated at roughly 10) were a monkey with a typewriter, typing from the Big Bang until the end of the universe (when protons might no longer exist), they would still need a far greater amount of time – more than three hundred and sixty thousand orders of magnitude longer – to have even a 1 in 10 chance of success. To put it another way, for a one in a trillion chance of success, there would need to be 10 observable universes made of protonic monkeys. As Kittel and Kroemer put it in their textbook on thermodynamics, the field whose statistical foundations motivated the first known expositions of typing monkeys, "The probability of Hamlet is therefore zero in any operational sense of an event ...", and the statement that the monkeys must eventually succeed "gives a misleading conclusion about very, very large numbers."
In fact, there is less than a one in a trillion chance of success that such a universe made of monkeys could type any particular document a mere 79 characters long.
An online demonstration showed that short random programs can produce highly structured outputs more often than classical probability suggests, aligning with Gregory Chaitin's modern theorem and building on Algorithmic Information Theory and Algorithmic probability by Ray Solomonoff and Leonid Levin. The demonstration illustrates that the chance of producing a specific binary sequence is not shorter than the base-2 logarithm of the sequence length, showing the difference between Algorithmic probability and classical probability, as well as between random programs and random letters or digits.
Almost surely
Main article: Almost surelyThis section does not cite any sources. Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed. (May 2024) (Learn how and when to remove this message) |
The probability that an infinite randomly generated string of text will contain a particular finite substring is 1. However, this does not mean the substring's absence is "impossible", despite the absence having a prior probability of 0. For example, the immortal monkey could randomly type G as its first letter, G as its second, and G as every single letter, thereafter, producing an infinite string of Gs; at no point must the monkey be "compelled" to type anything else. (To assume otherwise implies the gambler's fallacy.) However long a randomly generated finite string is, there is a small but nonzero chance that it will turn out to consist of the same character repeated throughout; this chance approaches zero as the string's length approaches infinity. There is nothing special about such a monotonous sequence except that it is easy to describe; the same fact applies to any nameable specific sequence, such as "RGRGRG" repeated forever, or "a-b-aa-bb-aaa-bbb-...", or "Three, Six, Nine, Twelve…".
If the hypothetical monkey has a typewriter with 90 equally likely keys that include numerals and punctuation, then the first typed keys might be "3.14" (the first three digits of pi) with a probability of (1/90), which is 1/65,610,000. Equally probable is any other string of four characters allowed by the typewriter, such as "GGGG", "mATh", or "q%8e". The probability that 100 randomly typed keys will consist of the first 99 digits of pi (including the separator key), or any other particular sequence of that length, is much lower: (1/90). If the monkey's allotted length of text is infinite, the chance of typing only the digit of pi is 0, which is just as possible (mathematically probable) as typing nothing but Gs (also probability 0).
The same applies to the event of typing a particular version of Hamlet followed by endless copies of itself; or Hamlet immediately followed by all the digits of pi; these specific strings are equally infinite in length, they are not prohibited by the terms of the thought problem, and they each have a prior probability of 0. In fact, any particular infinite sequence the immortal monkey types will have had a prior probability of 0, even though the monkey must type something.
This is an extension of the principle that a finite string of random text has a lower and lower probability of being a particular string the longer it is (though all specific strings are equally unlikely). This probability approaches 0 as the string approaches infinity. Thus, the probability of the monkey typing an endlessly long string, such as all of the digits of pi in order, on a 90-key keyboard is (1/90) which equals (1/∞) which is essentially 0. At the same time, the probability that the sequence contains a particular subsequence (such as the word MONKEY, or the 12th through 999th digits of pi, or a version of the King James Bible) increases as the total string increases. This probability approaches 1 as the total string approaches infinity, and thus the original theorem is correct.
Correspondence between strings and numbers
In a simplification of the thought experiment, the monkey could have a typewriter with just two keys: 1 and 0. The infinitely long string thusly produced would correspond to the binary digits of a particular real number between 0 and 1. A countably infinite set of possible strings end in infinite repetitions, which means the corresponding real number is rational. Examples include the strings corresponding to one-third (010101...), five-sixths (11010101...) and five-eighths (1010000...). Only a subset of such real number strings (albeit a countably infinite subset) contains the entirety of Hamlet (assuming that the text is subjected to a numerical encoding, such as ASCII).
Meanwhile, there is an uncountably infinite set of strings which do not end in such repetition; these correspond to the irrational numbers. These can be sorted into two uncountably infinite subsets: those which contain Hamlet and those which do not. However, the "largest" subset of all the real numbers is those which not only contain Hamlet, but which contain every other possible string of any length, and with equal distribution of such strings. These irrational numbers are called normal. Because almost all numbers are normal, almost all possible strings contain all possible finite substrings. Hence, the probability of the monkey typing a normal number is 1. The same principles apply regardless of the number of keys from which the monkey can choose; a 90-key keyboard can be seen as a generator of numbers written in base 90.
History
Statistical mechanics
In one of the forms in which probabilists now know this theorem, with its "dactylographic" monkeys (French: singes dactylographes; the French word singe covers both the monkeys and the apes), appeared in Émile Borel's 1913 article "Mécanique Statique et Irréversibilité" (Static mechanics and irreversibility), and in his book "Le Hasard" in 1914. His "monkeys" are not actual monkeys; rather, they are a metaphor for an imaginary way to produce a large, random sequence of letters. Borel said that if a million monkeys typed ten hours a day, it was extremely unlikely that their output would exactly equal all the books of the richest libraries of the world; and yet, in comparison, it was even more unlikely that the laws of statistical mechanics would ever be violated, even briefly.
The physicist Arthur Eddington drew on Borel's image further in The Nature of the Physical World (1928), writing:
If I let my fingers wander idly over the keys of a typewriter it might happen that my screed made an intelligible sentence. If an army of monkeys were strumming on typewriters they might write all the books in the British Museum. The chance of their doing so is decidedly more favourable than the chance of the molecules returning to one half of the vessel.
These images invite the reader to consider the incredible improbability of a large but finite number of monkeys working for a large but finite amount of time producing a significant work and compare this with the even greater improbability of certain physical events. Any physical process that is even less likely than such monkeys' success is effectively impossible, and it may safely be said that such a process will never happen. It is clear from the context that Eddington is not suggesting that the probability of this happening is worthy of serious consideration. On the contrary, it was a rhetorical illustration of the fact that below certain levels of probability, the term improbable is functionally equivalent to impossible.
Origins and "The Total Library"
In a 1939 essay entitled "The Total Library", Argentine writer Jorge Luis Borges traced the infinite-monkey concept back to Aristotle's Metaphysics. Explaining the views of Leucippus, who held that the world arose through the random combination of atoms, Aristotle notes that the atoms themselves are homogeneous and their possible arrangements only differ in shape, position and ordering. In On Generation and Corruption, the Greek philosopher compares this to the way that a tragedy and a comedy consist of the same "atoms", i.e., alphabetic characters. Three centuries later, Cicero's De natura deorum (On the Nature of the Gods) argued against the Epicurean atomist worldview:
Is it possible for any man to behold these things, and yet imagine that certain solid and individual bodies move by their natural force and gravitation, and that a world so beautifully adorned was made by their fortuitous concourse? He who believes this may as well believe that if a great quantity of the one-and-twenty letters, composed either of gold or any other matter, were thrown upon the ground, they would fall into such order as legibly to form the Annals of Ennius. I doubt whether fortune could make a single verse of them.
Borges follows the history of this argument through Blaise Pascal and Jonathan Swift, then observes that in his own time, the vocabulary had changed. By 1939, the idiom was "that a half-dozen monkeys provided with typewriters would, in a few eternities, produce all the books in the British Museum." (To which Borges adds, "Strictly speaking, one immortal monkey would suffice.") Borges then imagines the contents of the Total Library which this enterprise would produce if carried to its fullest extreme:
Everything would be in its blind volumes. Everything: the detailed history of the future, Aeschylus' The Egyptians, the exact number of times that the waters of the Ganges have reflected the flight of a falcon, the secret and true name of Rome, the encyclopedia Novalis would have constructed, my dreams and half-dreams at dawn on August 14, 1934, the proof of Pierre Fermat's theorem, the unwritten chapters of Edwin Drood, those same chapters translated into the language spoken by the Garamantes, the paradoxes Berkeley invented concerning Time but didn't publish, Urizen's books of iron, the premature epiphanies of Stephen Dedalus, which would be meaningless before a cycle of a thousand years, the Gnostic Gospel of Basilides, the song the sirens sang, the complete catalog of the Library, the proof of the inaccuracy of that catalog. Everything: but for every sensible line or accurate fact there would be millions of meaningless cacophonies, verbal farragoes, and babblings. Everything: but all the generations of mankind could pass before the dizzying shelves – shelves that obliterate the day and on which chaos lies – ever reward them with a tolerable page.
Borges' total library concept was the main theme of his widely read 1941 short story "The Library of Babel", which describes an unimaginably vast library consisting of interlocking hexagonal chambers, together containing every possible volume that could be composed from the letters of the alphabet and some punctuation characters.
Actual monkeys
In 2002, lecturers and students from the University of Plymouth MediaLab Arts course used a £2,000 grant from the Arts Council to study the literary output of real monkeys. They left a computer keyboard in the enclosure of six Celebes crested macaques in Paignton Zoo in Devon, England from May 1 to June 22, with a radio link to broadcast the results on a website.
Not only did the monkeys produce nothing but five total pages largely consisting of the letter "S", the lead male began striking the keyboard with a stone, and other monkeys followed by urinating and defecating on the machine. Mike Phillips, director of the university's Institute of Digital Arts and Technology (i-DAT), said that the artist-funded project was primarily performance art, and they had learned "an awful lot" from it. He concluded that monkeys "are not random generators. They're more complex than that. ... They were quite interested in the screen, and they saw that when they typed a letter, something happened. There was a level of intention there."
Applications and criticisms
Evolution
In his 1931 book The Mysterious Universe, Eddington's rival James Jeans attributed the monkey parable to a "Huxley", presumably meaning Thomas Henry Huxley. This attribution is incorrect. Today, it is sometimes further reported that Huxley applied the example in a now-legendary debate over Charles Darwin's On the Origin of Species with the Anglican Bishop of Oxford, Samuel Wilberforce, held at a meeting of the British Association for the Advancement of Science at Oxford on 30 June 1860. This story suffers not only from a lack of evidence, but the fact that in 1860 the typewriter was not yet commercially available.
Despite the original mix-up, monkey-and-typewriter arguments are now common in arguments over evolution. As an example of Christian apologetics Doug Powell argued that even if a monkey accidentally types the letters of Hamlet, it has failed to produce Hamlet because it lacked the intention to communicate. His parallel implication is that natural laws could not produce the information content in DNA. A more common argument is represented by Reverend John F. MacArthur, who claimed that the genetic mutations necessary to produce a tapeworm from an amoeba are as unlikely as a monkey typing Hamlet's soliloquy, and hence the odds against the evolution of all life are impossible to overcome.
Evolutionary biologist Richard Dawkins employs the typing monkey concept in his book The Blind Watchmaker to demonstrate the ability of natural selection to produce biological complexity out of random mutations. In a simulation experiment Dawkins has his weasel program produce the Hamlet phrase METHINKS IT IS LIKE A WEASEL, starting from a randomly typed parent, by "breeding" subsequent generations and always choosing the closest match from progeny that are copies of the parent with random mutations. The chance of the target phrase appearing in a single step is extremely small, yet Dawkins showed that it could be produced rapidly (in about 40 generations) using cumulative selection of phrases. The random choices furnish raw material, while cumulative selection imparts information. As Dawkins acknowledges, however, the weasel program is an imperfect analogy for evolution, as "offspring" phrases were selected "according to the criterion of resemblance to a distant ideal target." In contrast, Dawkins affirms, evolution has no long-term plans and does not progress toward some distant goal (such as humans). The weasel program is instead meant to illustrate the difference between non-random cumulative selection, and random single-step selection. In terms of the typing monkey analogy, this means that Romeo and Juliet could be produced relatively quickly if placed under the constraints of a nonrandom, Darwinian-type selection because the fitness function will tend to preserve in place any letters that happen to match the target text, improving each successive generation of typing monkeys.
A different avenue for exploring the analogy between evolution and an unconstrained monkey lies in the problem that the monkey types only one letter at a time, independently of the other letters. Hugh Petrie argues that a more sophisticated setup is required, in his case not for biological evolution but the evolution of ideas:
In order to get the proper analogy, we would have to equip the monkey with a more complex typewriter. It would have to include whole Elizabethan sentences and thoughts. It would have to include Elizabethan beliefs about human action patterns and the causes, Elizabethan morality and science, and linguistic patterns for expressing these. It would probably even have to include an account of the sorts of experiences which shaped Shakespeare's belief structure as a particular example of an Elizabethan. Then, perhaps, we might allow the monkey to play with such a typewriter and produce variants, but the impossibility of obtaining a Shakespearean play is no longer obvious. What is varied really does encapsulate a great deal of already-achieved knowledge.
James W. Valentine, while admitting that the classic monkey's task is impossible, finds that there is a worthwhile analogy between written English and the metazoan genome in this other sense: both have "combinatorial, hierarchical structures" that greatly constrain the immense number of combinations at the alphabet level.
Zipf's law
Zipf's law states that the frequency of words is a power law function of its frequency rank:where are real numbers. Assuming that a monkey is typing randomly, with fixed and nonzero probability of hitting each letter key or white space, then the text produced by the monkey follows Zipf's law.
Literary theory
R. G. Collingwood argued in 1938 that art cannot be produced by accident, and wrote as a sarcastic aside to his critics,
... some ... have denied this proposition, pointing out that if a monkey played with a typewriter ... he would produce ... the complete text of Shakespeare. Any reader who has nothing to do can amuse himself by calculating how long it would take for the probability to be worth betting on. But the interest of the suggestion lies in the revelation of the mental state of a person who can identify the 'works' of Shakespeare with the series of letters printed on the pages of a book ...
Nelson Goodman took the contrary position, illustrating his point along with Catherine Elgin by the example of Borges' "Pierre Menard, Author of the Quixote",
What Menard wrote is simply another inscription of the text. Any of us can do the same, as can printing presses and photocopiers. Indeed, we are told, if infinitely many monkeys ... one would eventually produce a replica of the text. That replica, we maintain, would be as much an instance of the work, Don Quixote, as Cervantes' manuscript, Menard's manuscript, and each copy of the book that ever has been or will be printed.
In another writing, Goodman elaborates, "That the monkey may be supposed to have produced his copy randomly makes no difference. It is the same text, and it is open to all the same interpretations. ..." Gérard Genette dismisses Goodman's argument as begging the question.
For Jorge J. E. Gracia, the question of the identity of texts leads to a different question, that of author. If a monkey is capable of typing Hamlet, despite having no intention of meaning and therefore disqualifying itself as an author, then it appears that texts do not require authors. Possible solutions include saying that whoever finds the text and identifies it as Hamlet is the author; or that Shakespeare is the author, the monkey his agent, and the finder merely a user of the text. These solutions have their own difficulties, in that the text appears to have a meaning separate from the other agents: What if the monkey operates before Shakespeare is born, or if Shakespeare is never born, or if no one ever finds the monkey's typescript?
Simulated and limited conditions
In 1979, William R. Bennett Jr., a profesor of physics at Yale University, brought fresh attention to the theorem by applying a series of computer programs. Dr. Bennett simulated varying conditions under which an imaginary monkey, given a keyboard consisting of twenty-eight characters, and typing ten keys per second, might attempt to reproduce the sentence, "To be or not to be, that is the question." Although his experiments agreed with the overall conclusion that even such a short string of words would require many times the current age of the universe to reproduce, he noted that by modifying the statistical probability of certain letters to match the ordinary patterns of various languages and of Shakespeare in particular, seemingly random strings of words could be made to appear. But even with several refinements, the English sentence closest to the target phrase remained gibberish: "TO DEA NOW NAT TO BE WILL AND THEM BE DOES DOESORNS CAI AWROUTROULD."
Random document generation
The theorem concerns a thought experiment which cannot be fully carried out in practice, since it is predicted to require prohibitive amounts of time and resources. Nonetheless, it has inspired efforts in finite random text generation.
One computer program run by Dan Oliver of Scottsdale, Arizona, according to an article in The New Yorker, came up with a result on 4 August 2004: After the group had worked for 42,162,500,000 billion billion monkey-years, one of the "monkeys" typed, "VALENTINE. Cease toIdor:eFLP0FRjWK78aXzVOwm)-‘;8.t" The first 19 letters of this sequence can be found in "The Two Gentlemen of Verona". Other teams have reproduced 18 characters from "Timon of Athens", 17 from "Troilus and Cressida", and 16 from "Richard II".
A website entitled The Monkey Shakespeare Simulator, launched on 1 July 2003, contained a Java applet that simulated a large population of monkeys typing randomly, with the stated intention of seeing how long it takes the virtual monkeys to produce a complete Shakespearean play from beginning to end. For example, it produced this partial line from Henry IV, Part 2, reporting that it took "2,737,850 million billion billion billion monkey-years" to reach 24 matching characters:
- RUMOUR. Open your ears; 9r"5j5&?OWTY Z0d
Due to processing power limitations, the program used a probabilistic model (by using a random number generator or RNG) instead of actually generating random text and comparing it to Shakespeare. When the simulator "detected a match" (that is, the RNG generated a certain value or a value within a certain range), the simulator simulated the match by generating matched text.
Testing of random-number generators
Main article: Diehard testsQuestions about the statistics describing how often an ideal monkey is expected to type certain strings translate into practical tests for random-number generators; these range from the simple to the "quite sophisticated". Computer-science professors George Marsaglia and Arif Zaman report that they used to call one such category of tests "overlapping m-tuple tests" in lectures, since they concern overlapping m-tuples of successive elements in a random sequence. But they found that calling them "monkey tests" helped to motivate the idea with students. They published a report on the class of tests and their results for various RNGs in 1993.
In popular culture
Main article: Infinite monkey theorem in popular cultureThe infinite monkey theorem and its associated imagery is considered a popular and proverbial illustration of the mathematics of probability, widely known to the general public because of its transmission through popular culture rather than through formal education. This is helped by the innate humor stemming from the image of literal monkeys rattling away on a set of typewriters, and is a popular visual gag.
A quotation attributed to a 1996 speech by Robert Wilensky stated, "We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true."
The enduring, widespread popularity of the theorem was noted in the introduction to a 2001 paper, "Monkeys, Typewriters and Networks: The Internet in the Light of the Theory of Accidental Excellence". In 2002, an article in The Washington Post said, "Plenty of people have had fun with the famous notion that an infinite number of monkeys with an infinite number of typewriters and an infinite amount of time could eventually write the works of Shakespeare". In 2003, the previously mentioned Arts Council−funded experiment involving real monkeys and a computer keyboard received widespread press coverage. In 2007, the theorem was listed by Wired magazine in a list of eight classic thought experiments.
American playwright David Ives' short one-act play Words, Words, Words, from the collection All in the Timing, pokes fun of the concept of the infinite monkey theorem.
In 2015 Balanced Software released Monkey Typewriter on the Microsoft Store. The software generates random text using the Infinite Monkey theorem string formula. The software queries the generated text for user inputted phrases. However the software should not be considered true to life representation of the theory. This is a more of a practical presentation of the theory rather than scientific model on how to randomly generate text.
See also
- Boltzmann brain – Philosophical thought experiment
- Second Borel–Cantelli lemma – Theorem in probability
- Hilbert's paradox of the Grand Hotel – Thought experiment of infinite sets, another thought experiment involving infinity
- Law of truly large numbers – Law of statistics
- Murphy's law – Adage typically stated as: "Anything that can go wrong, will go wrong"
- Normal number – Number with all digits equally frequent
- Stochastic parrot – Term used in machine learning
- Texas sharpshooter fallacy – Statistical fallacy
- The Engine – Fictional computational machine in Gulliver's Travels
- The Hidden Reality: Parallel Universes and the Deep Laws of the Cosmos – Book by Brian Greene
- The Infinite Monkey Cage – Science and comedy radio show
- The Library of Babel – Short story by Jorge Luis Borges
Notes
- In practice, for any realistic finite attempt, the probability of a monkey generating even a small part of a Shakespeare work is negligible.
- This shows that the probability of typing "banana" in one of the predefined non-overlapping blocks of six letters tends to 1. In addition the word may appear across two blocks, so the estimate given is conservative.
- The first theorem is proven by a similar if more indirect route in Gut (2005).
- Nearly 20 octillion
- Using the Hamlet text "from gutenberg.org"., there are 132680 alphabetical letters and 199749 characters overall
- For any required string of 130,000 letters from the set 'a'-'z', the average number of letters that needs to be typed until the string appears is (rounded) 3.4 × 10, except in the case that all letters of the required string are equal, in which case the value is about 4% more, 3.6 × 10. In that case failure to have the correct string starting from a particular position reduces with about 4% the probability of a correct string starting from the next position (i.e., for overlapping positions the events of having the correct string are not independent; in this case there is a positive correlation between the two successes, so the chance of success after a failure is smaller than the chance of success in general). The figure 3.4 × 10 is derived from n = 26 by taking the logarithm of both sides: log10(n) = 1300000×log10(26) = 183946.5352, therefore n = 10 × 10 = 3.429 × 10.
- 26 letters ×2 for capitalisation, 12 for punctuation characters = 64, 199749×log10(64) = 4.4 × 10 (this is generous as it assumes capital letters are separate keys, as opposed to a key combination, which makes the problem vastly harder).
- There are ≈10 protons in the observable universe. Assume the monkeys write for 10 years (10 years is when all stellar remnants will have either been ejected from their galaxies or fallen into black holes, 10 years is when all but 0.1% of protons have decayed). Assuming the monkeys type non-stop at a ridiculous 400 words per minute (the world record is 216 WPM for a single minute), that is about 2,000 characters per minute (Shakespeare's average word length is a bit under 5 letters). There are about half a million minutes in a year, this means each monkey types half a billion characters per year. This gives a total of 10×10×10 = 10 letters typed – which is still zero in comparison to 10. For a one in a trillion chance, multiply the letters typed by a trillion: 10×10 = 10. 10/10 = 10.
- As explained at "More monkeys". Archived from the original on 18 April 2015. Retrieved 4 December 2013. The problem can be approximated further: 10/log10(64) = 78.9 characters.
- Examples of the theorem being referred to as proverbial include: Schooler, Jonathan W.; Dougal, Sonya (1999). "Why creativity is not like the proverbial typing monkey". Psychological Inquiry. 10 (4).; and Koestler, Arthur (1972). The Case of the Midwife Toad. New York. p. 30.
Neo-Darwinism does indeed carry the nineteenth-century brand of materialism to its extreme limits – to the proverbial monkey at the typewriter, hitting by pure chance on the proper keys to produce a Shakespeare sonnet.
{{cite book}}
: CS1 maint: location missing publisher (link) The latter is sourced from "Parable of the Monkeys"., a collection of historical references to the theorem in various formats.
References
- ^ Borel, Émile (1913). "La mécanique statique et l'irréversibilité". Journal de Physique Théorique et Appliquée (in French). 3 (1): 189–196. doi:10.1051/jphystap:019130030018900. ISSN 0368-3893.
Concevons qu'on ait dressé un million de singes à frapper au hasard sur les touches d'une machine à écrire et que ces singes dactylographes travaillent avec ardeur dix heures par jour avec un million de machines à écrire de types variés. Au bout d'un an, volumes se trouveraient renfermer la copie exacte des livres de toute nature et de toutes langues conservés dans les plus riches bibliothèques du monde.
- Jorge Luis Borges, "The Total Library", 1939. Anthologized in Selected Non-fictions (1999). Edited by Eliot Weinberger. New York: Viking
- Isaac, Richard E. (1995). The Pleasures of Probability. New York: Springer. pp. 48–50. ISBN 0-387-94415-X. OCLC 610945749– Isaac generalizes this argument immediately to variable text and alphabet size; the common main conclusion is on page 50.
{{cite book}}
: CS1 maint: postscript (link) - Gut, Allan (2005). Probability: A Graduate Course. Springer. pp. 97–100. ISBN 0-387-22833-0.
- ^ Kittel, Charles; Kroemer, Herbert (1980). Thermal Physics (2nd ed.). San Francisco: W.H. Freeman Company. p. 53. ISBN 0-7167-1088-9. OCLC 5171399.
- Zenil, Hector and Soler-Toscano, Fernando (October 2013). "Infinite Monkey Theorem". Wolfram Demonstrations Project. Retrieved May 24, 2024.
{{cite web}}
: CS1 maint: multiple names: authors list (link) - Borel, Émile (1914). La hasard (in French). Paris: Félix Alcan. p. 164. Alt URL
- Arthur Eddington (1928). The Nature of the Physical World: The Gifford Lectures. New York: Macmillan. p. 72. ISBN 0-8414-3885-4.
- Eddington, Arthur. "Chapter IV: The Running-Down of the Universe". The Nature of the Physical World 1926–1927: The Gifford Lectures. Archived from the original on 2009-03-08. Retrieved 2012-01-22.
- Aristotle, Περὶ γενέσεως καὶ φθορᾶς (On Generation and Corruption), 315b14.
- Marcus Tullius Cicero, De natura deorum, 2.37. Translation from Cicero's Tusculan Disputations; Also, Treatises On The Nature Of The Gods, And On The Commonwealth, C. D. Yonge, principal translator, New York, Harper & Brothers Publishers, Franklin Square. (1877). Downloadable text.
- The English translation of "The Total Library" lists the title of Swift's essay as "Trivial Essay on the Faculties of the Soul". The appropriate reference is, instead: Swift, Jonathan, Temple Scott et al. "A Tritical Essay upon the Faculties of the Mind." The Prose Works of Jonathan Swift, Volume 1. London: G. Bell, 1897, pp. 291-296. Internet Archive
- Borges, Jorge Luis (August 1939). "La biblioteca total" [The Total Library]. Sur. No. 59. republished in Selected Non-Fictions. Translated by Weinberger, Eliot. Penguin. 1999. ISBN 0-670-84947-2.
- ^ "Notes towards the complete works of Shakespeare". vivaria.net. 2002. Archived from the original on 2007-07-16. – some press clippings.
- ^ "No words to describe monkeys' play". BBC News. 2003-05-09. Retrieved 2009-07-25.
- "Notes Towards the Complete Works of Shakespeare" (PDF). Archived from the original (PDF) on 2009-03-18.
- K., Alfred (April 2013). "Finite Monkeys Don't Type: A story about the interpretations of probability". Alfred K. Archived from the original on 2022-03-31. Retrieved 2023-05-11.
- "Monkeys don't write Shakespeare". Wired News. 2003-05-09. Archived from the original on 2004-02-01. Retrieved 2007-03-02.
- Padmanabhan, Thanu (2005). "The dark side of astronomy". Nature. 435 (7038): 20–21. Bibcode:2005Natur.435...20P. doi:10.1038/435020a. Platt, Suzy (1993). Respectfully quoted: a dictionary of quotations. Barnes & Noble. pp. 388–389. ISBN 0-88029-768-9.
- Rescher, Nicholas (2006). Studies in the Philosophy of Science: A Counterfactual Perspective on Quantum Entanglement. Ontos Verlag. p. 103. ISBN 978-3-11-032646-8.
- Powell, Doug (2006). Holman Quicksource Guide to Christian Apologetics. Broadman & Holman. pp. 60, 63. ISBN 0-8054-9460-X.
- MacArthur, John (2003). Think Biblically!: Recovering a Christian Worldview. Crossway Books. pp. 78–79. ISBN 1-58134-412-0.
- Dawkins, Richard (1996). The Blind Watchmaker. W.W. Norton & Co. pp. 46–50. ISBN 0-393-31570-3.
- As quoted in Blachowicz, James (1998). Of Two Minds: Nature of Inquiry. SUNY Press. p. 109. ISBN 0-7914-3641-1.
- Valentine, James (2004). On the Origin of Phyla. University of Chicago Press. pp. 77–80. ISBN 0-226-84548-6.
- Conrad, B.; Mitzenmacher, M. (July 2004). "Power laws for monkeys typing randomly: the case of unequal probabilities". IEEE Transactions on Information Theory. 50 (7): 1403–1414. doi:10.1109/TIT.2004.830752. ISSN 1557-9654. S2CID 8913575.
- p. 126 of The Principles of Art, as summarized and quoted by Sclafani, Richard J. (1975). "The logical primitiveness of the concept of a work of art". British Journal of Aesthetics. 15 (1): 14. doi:10.1093/bjaesthetics/15.1.14.
- John, Eileen; Dominic Lopes, eds. (2004). The Philosophy of Literature: Contemporary and Classic Readings: An Anthology. Blackwell. p. 96. ISBN 1-4051-1208-5.
- Genette, Gérard (1997). The Work of Art: Immanence and Transcendence. Cornell UP. ISBN 0-8014-8272-0.
- Gracia, Jorge (1996). Texts: Ontological Status, Identity, Author, Audience. SUNY Press. pp. 1–2, 122–125. ISBN 0-7914-2901-6.
- Boyce Rensberger (March 6, 1979). "Computer Says Monkeys Couldn't Write 'Hamlet'—At Least Not So Far". The New York Times.
- Acocella, Joan (9 April 2007). "The typing life: How writers used to write". The New Yorker. – a review of Wershler-Henry, Darren (2007). The Iron Whim: A fragmented history of typewriting. Cornell University Press.
- Inglis-Arkell, Esther (June 9, 2011). "The story of the Monkey Shakespeare Simulator Project". io9. gizmodo. Retrieved 24 February 2016.
- Marsaglia, George; Zaman, Arif (1993). "Monkey tests for random number generators". Computers & Mathematics with Applications. 26 (9). Elsevier, Oxford: 1–10. doi:10.1016/0898-1221(93)90001-C. ISSN 0898-1221.
- Susan Ratcliffe, ed. (2016), "Robert Wilensky 1951–American academic", Oxford Essential Quotations, Oxford University Press,
in Mail on Sunday 16 February 1997 'Quotes of the Week'
- Lewis, Bob (1997-06-02). "It's time for some zoning laws in today's version of the Old West: the Web". Enterprise Computing, IS Survival Guide. InfoWorld. Vol. 19, no. 22. InfoWorld Media Group, Inc. p. 84. ISSN 0199-6649. May also be in "Bob Lewis's IS Survival Guide", published March 19, 1999, ISBN 978-0672314377
{{cite news}}
: CS1 maint: postscript (link) - Hoffmann, Ute; Hofmann, Jeanette (2001). "Monkeys, Typewriters and Networks" (PDF). Wissenschaftszentrum Berlin für Sozialforschung gGmbH (WZB). Archived from the original (PDF) on 2008-05-13.
- Ringle, Ken (28 October 2002). "Hello? This is Bob". The Washington Post. p. C01. Archived from the original on 15 November 2002.
- Lorge, Greta (May 2007). "The best thought experiments: Schrödinger's cat, Borel's monkeys". Wired. Vol. 15, no. 6.
- "Monkey Typewriter". Microsoft Store Apps. Balanced Software. 2015-11-16. 9NBLGGH69FC8. Retrieved 2022-02-14.
External links
- Bridge, Adam (August 1998). "Ask Dr. Math". mathforum.org. article 55871.
- "The Parable of the Monkeys". Archived from the original on 2003-06-04 – via angelfire. – a bibliography with quotations
- "Planck Monkeys". 12 April 2007. – on populating the cosmos with monkey particles
- "PixelMonkeys.org". – Matt Kane's application of the Infinite Monkey Theorem on pixels to create images.
- Christey, S. (2000). The Infinite Monkey Protocol Suite (IMPS). doi:10.17487/RFC2795. RFC 2795. – April Fools' Day RFC on the implementation of the Infinite Monkey Theorem.
- Woodcock, Stephen; Falletta, Jay (2024). "A numerical evaluation of the Finite Monkeys Theorem". Franklin Open. 9. Elsevier BV: 100171. doi:10.1016/j.fraope.2024.100171. ISSN 2773-1863.
Major mathematics areas | |
---|---|
Foundations | |
Algebra | |
Analysis | |
Discrete | |
Geometry | |
Number theory | |
Topology | |
Applied | |
Computational | |
Related topics | |