Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Can a large number of monkeys write Hamlet?

  1. Oct 26, 2007 #1
    I think if they were given enough time, and large means what it sounds like, then the expected value of number of monkeys that reproduce Hamlet, character for character, would be any number you like (so greater than 1 if there were enough monkeys).

    Let's say you give them a special keyboard that has only letters, space, and a shift key. Then there are 53 different keystrokes. Only one in 53 is the correct first character in Hamlet.

    So 1/53 of the monkeys will get the first character right.

    Of those, 1/53 will get the second character right.

    There are about 200,000 characters in Hamlet. So the probability a monkey will type out Hamlet is less than (1/53)^200000 which is around 1 times ten to the -344855 power. In other words, there are about 344850 ZEROS before the decimal point. So it's pretty unlikely.

    I think a google is 10^100. If you have one google raised to the 3449 power, or so, monkeys, all typing, then the expected value is that ONE of those (google)^3449 monkeys will produce Hamlet. Anything less than (google)^3449 monkeys will PROBABLY not produce Hamlet.

    This is to skirt the issue of how many of those monkeys will STOP at HAMLET and not keep going. If a monkey keeps going, that should DISQUALIFY it from being considered a real Hamlet.

    So let's revise it and give each monkey the option to stop. So let's model that by having 54 keys instead of 53, where the new 54th key is STOP WRITING.

    OK, now the probability that a monkey will type all the right characters in Hamlet and Stop at the right time, without adding extra stuff, is (1/54)^200000 or so which is about 10^(-346479), meaning that now you need (google)^16 times as many monkeys as before to get the expected value of 1 Halmet.

    Bottom line: you'll average one copy of Hamlet per every (google)^3465 monkeys you have.

    Given the comparison between a million, or even a trillion, to the sort of numbers involved here like needing (google)^3465 to get ONE Hamlet (on average), there is basically no way a million or trillion monkeys will do it, if everything is totally random. It's safe to say that (google)^3465 is incomprehensibly bigger than the number of monkeys that ever lived on earth or ever will and, so, realistically, no real group of monkeys will ever produce Hamlet.

    But since i added the 54th key, I have ignored the fact that all the monkeys who press key number 54 stop and if they stop before Hamlet is finished, there is NO change they will ever get Hamlet. So consider these numbers as upper bounds.
     
  2. jcsd
  3. Oct 26, 2007 #2
    Yes, this is an example of the "infinite monkey theorem".
     
  4. Oct 26, 2007 #3
    kewl
     
  5. Oct 27, 2007 #4
    Though it is doubtful that the monkeys would write "Hamlet" if the keyboard has no punctuation marks. :P
     
  6. Oct 27, 2007 #5
    oh yeah
     
  7. Oct 27, 2007 #6
    also.. how do you define "stop" wouldnt you have to wait infinitely long to see whether the monkey ever types again? ;)
     
  8. Oct 27, 2007 #7
    how is stop ambiguous? ;)
     
  9. Oct 27, 2007 #8

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    Terminology: Google is the search engine / advertising / general technology company. The number is googol.
     
  10. Oct 27, 2007 #9

    DaveC426913

    User Avatar
    Gold Member

    There's a flaw with the "STOP" key addition.

    All the other keys can be pressed an indefinite number of times. Your calculations have to factor in that the stop key is NOT pressed UNTIL the other 200,000 characters have been typed.
     
  11. Oct 27, 2007 #10

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    Under your restrictions (just letters and spaces) I get just under 163,000 characters, which gives about 10^-281057, admittedly pretty large. If capitalizations is ignored it's more like 10^-233312. This is similar to the probability of randomly selecting all the people in a large college out of the world.
     
  12. Oct 27, 2007 #11
    As I said: But since i added the 54th key, I have ignored the fact that all the monkeys who press key number 54 stop and if they stop before Hamlet is finished, there is NO change[*] they will ever get Hamlet. So consider these numbers as upper bounds.

    So how is STOP ambiguous?


    [*]Here is another "terminology" error: by change I meant chance. One could call that a typo or spelling error...to each his own.
     
    Last edited: Oct 27, 2007
  13. Oct 27, 2007 #12
    Terminology: Terminology has to do with definitions. Google vs googol is spelling.
     
    Last edited: Oct 27, 2007
  14. Oct 27, 2007 #13
    What college has 10^233312 students?

    OK, so I get really around 191000 characters but I think you might be missing the point which is that the probability is not zero. However, the way this statement is sometimes made, with numbers in the millions or trillions, the expected number of monkeys producing Hamlet is far less than one.
     
  15. Oct 27, 2007 #14

    DaveC426913

    User Avatar
    Gold Member

    Yes, I suppose the chances don't change.
     
  16. Oct 27, 2007 #15
    Why is that? I think it's obvious that if there is a stop key, the chances change. If there is no stop key, the probability is zero that a monkey will write hamlet while if there is a stop key, there is a chance, albeit small.
     
  17. Oct 27, 2007 #16
    I just checked and found the estimated hydrogen atoms in the universe is only 5x10^68.

    Obviously we have absolutely no space to accommodate the monkeys.
     
  18. Oct 27, 2007 #17
    Maybe in one parallel universe, there are a lot of monkeys banging away at keyboards...

    So practically speaking, it's basically impossible.
     
  19. Oct 28, 2007 #18

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    I was assuming 40,000 to 50,000 students -- a big college, but not unheard-of. There's one 2.5 hours away from me, for example; it seemed reasonable. How do you get 10^233312 students? There are ~6.6 billion people on earth, so

    [tex]{6,600,000,000 \choose 50,000}\approx3.9\times10^{277740}[/tex]

    It's rather insulting to suggest I don't know the probability is nonzero but small. I did the calculations just as you did, and even gave another example of an event with similar probability. Another example of an event with similar probability would be choosing (uniformly at random) the optimal tour for this TSP circuit.
     
  20. Oct 28, 2007 #19

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    I don't think anyone has called it practical. If you wanted practical, you should "lock in" correct characters, in which case the work (punctuation and all) could be finished in ~20,000,000 keystrokes.
     
  21. Oct 28, 2007 #20

    Chris Hillman

    User Avatar
    Science Advisor

    Point out a hidden assumption

    Someone should probably remark that phoenixthoth was trying to compute the probability of outputing the text of Hamlet assuming that each keystroke is made independently of the others. A more useful Markov chain model based on n-grams would product text which would wander but would statistically resemble the letter frequencies, digram frequencies, ... and n-gram frequencies of the text of Hamlet. This was in fact used by Shannon to suggest the meaning (and limitations) of his entropy measure. See http://www.math.uni-hamburg.de/home/gunesch/entropy.html

    Note that even obtaining "grammatical text" , much "ageless quality text" by a highly idealized stochastic simulation is implausible. This suggests the limitations of such simulations, not that Shakespeare could not have existed :rolleyes:

    I hopefully presume that this discussion has nothing to do with cranky claims about "blind watchmakers".
     
    Last edited: Oct 28, 2007
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Can a large number of monkeys write Hamlet?
  1. Law of Large Numbers (Replies: 1)

Loading...