fbpx

Making Monkeys Out of Shakespeare

An age old mathematical probability theory called the Infinite Monkeys Theorem hypothesized that with enough time, typewriters and monkeys, all the great literary works of the world can be recreated. Recently, US programmer Jesse Anderson set out to test this hypothesis as a means of learning Amazon's programming tool, Hadoop, and giving their EC2 cloud based computing service a bit of a stress test.

Mr. Anderson (or maybe we should call him Neo) created millions of virtual monkeys using small computer programs as a way to recreate the great works of William Shakespeare. Of course, Neo, er Anderson, is no fool. Amazon's cloud based computing services with his virtual monkeys mashing virtual keyboards was costing him nearly $20 a day - so he needed to modify the conditions somewhat to ensure a speedy resolution. In other words, his simulation wasn't completely random.

Mr. Anderson's approach uses a randomly generated string of nine characters with spaces and punctuation removed. The program takes the virtual monkey generated gibberish and searches through the entire works of Shakespeare which fills nearly 3.7 million words. Strings that match any section of text are kept, while non-matching portions are thrown away.

Tim Harford, popular science writer and presenter of the BBC's radio show about numbers More or Less states, "If he's running an evolutionary approach, holding on to successful guesses, then he'll get there." But without these constraints, Dr. Ian Stewart, emeritus professor of mathematics at the University of Warwick sums up any prospective efforts succinctly by stating, "Not a chance." According to Dr. Stewart:

"Along the way there would be untold numbers of attempts with one character wrong; even more with two wrong, and so on." he said. "Almost all other books, being shorter, would appear (countless times) before Shakespeare did."

The good professor had calculated that a random nine character string in all its permutations would result in about 5.5 trillion different combinations. Further his calculations also suggested that it would take an amount of time longer than the age of our universe to be able to randomly generate a flawless copy of all of Shakespeare's works.

Proof can be inferred from a 2003 experiment noted by Wikipedia in which a computer program was used to simulate completely randomly generated monkey business. After simulating billions and billions of monkey years worth of typing they had only assembled a small part of a line from Henry IV, Part 2.

Mr. Anderson has been running his experiment since August 21st and as of September 26th his very busy virtual monkeys have completed 99.990% of Shakespeare's complete works; the first work to be completed was the poem "A Lover's Complaint." It's a good thing Mr. Anderson's experiment is very nearly wrapping up because these virtual monkeys don't work for peanuts.


Source: BBC News

Share This With The World!
  •  
  •  
  •  
  •  
  •  
  •  
  •