Programmer has fun with monkeys typing Shakespeare theory

September 28, 2011 by Bob Yirka report
Programmer has fun with monkeys typing Shakespeare theory

( -- Sometimes you just have to shake your head at some experiments done in the name of science, and go with the flow, or as Jesse Anderson puts it on his blog, “Keep Calm and Carry On.” He’s conducting an experiment, for fun, to see if he can reproduce some part of the old philosophy question of whether putting infinite numbers of monkeys before infinite numbers of typewriters, working indefinitely, would at some point result in the reproduction of the entire works of Shakespeare. Anderson’s efforts have created quite a stir on Internet, though for different reasons. Some see the humor in his approach, others point out how his efforts aren’t really proving anything at all.

Anderson isn’t testing the theory with real monkeys, that whole idea was pretty much laid to rest when researchers a while back gave a group of monkeys a keyboard and after month of effort found they had little more than an affinity for the letter “S” and disdain for modern contrivances (they urinated on it). Instead he’s using virtual monkeys on computers and a mathematical algorithm to pick out letter sequences typed at random.

He started last month, using Amazon's SC2 cloud computing system and has already put together one of the Bard’s poems, though it is difficult to ascertain from the experiment just what exactly is being proved. That typing nine random characters as a group will eventually reproduce a nine letter sequence that duplicates nine letters of something once wrote? That piecing such sequences together will eventually result in the whole work being reproduced? Interesting, but hardly science. But then, Anderson, a homespun , clearly isn’t trying to shake up the world. He’s just trying to have some fun.

Less Technical Explanation

Infinite Monkey Technical Discussion
What’s perhaps more interesting are the reactions to his efforts from bloggers and reporters for various media and science outlets, especially those that seem to want to point out how proving the theory right or wrong would take more time than we humans will ever have; which seems premature, when you consider that the theory does say something about using an infinite number of monkeys after all. Surely using some bit of calculus would show that as the number of monkeys approaches infinity, the number of completed works would be go up pretty quickly as well. Seems to me if you went that route, you could have the whole job done before breakfast. At any rate, the whole point is rather moot, isn’t it? After all, does it really matter if monkeys typing randomly could randomly reproduce anything all? A more important question would seem to be, if you could get to type, wouldn’t they eventually, given enough time, tell us all what they really think of us and our crazy use of them for our own experimental purposes?

Explore further: Modern society made up of all types

Related Stories

Modern society made up of all types

November 4, 2010

Modern society has an intense interest in classifying people into ‘types’, according to a University of Melbourne Cultural Historian, leading to potentially catastrophic life-changing outcomes for those typed – ...

The kids are alright

May 26, 2011

Children should be seen and not heard... who says? A Philosophy academic at The University of Nottingham is challenging the adage by teaching primary school children to argue properly.

Habit formation fine-tuned by experience

October 26, 2010

Most people have habits that guide them through daily life -- for example, their path to work in the morning, or their bedtime routine. The brain patterns that drive this behavior are not well-understood, but a new study ...

Recommended for you

New method analyzes corn kernel characteristics

November 17, 2017

An ear of corn averages about 800 kernels. A traditional field method to estimate the number of kernels on the ear is to manually count the number of rows and multiply by the number of kernels in one length of the ear. With ...

Optically tunable microwave antennas for 5G applications

November 16, 2017

Multiband tunable antennas are a critical part of many communication and radar systems. New research by engineers at the University of Bristol has shown significant advances in antennas by using optically induced plasmas ...


Adjust slider to filter visible comments by rank

Display comments: newest first

5 / 5 (7) Sep 28, 2011
"proving" the theory is both impossible and pointless. Infinite terms might not sit well in math proofs, but they make perfect sense in common understanding. Infinite monkeys Infinite time is infinitely overkill. If you have an infinite number of monkeys, you only need enough time for one of them to type it out on the first try. The odds are amazingly tiny, but you have an INFINTITE number of monkeys. In fact, so long as the odds are finite, the infinite number of monkeys will create an infinite number of perfect copies on the first try - because any small fraction of infinity is STILL infinity.

Infinity rant aside, I thought it was hilarious that someone tried to get actual monkeys to do this and only got a couple pages of the letter S and some destroyed type writers. -- not in this article, but it was fluff on a similar article I read off google news yesterday.
5 / 5 (1) Sep 28, 2011
The fact that we humans take interest in such things says more about our ever present need to find meaning and purpose in our seemingly random universe.

FMfbrestel... I too was laughing at a cage full of monkeys peeing on a some typewriters. That's pretty random.
1 / 5 (1) Sep 28, 2011
The glorious blurst of times.
5 / 5 (4) Sep 28, 2011
I'd rather see a conference room full of monkeys settle the Shakespeare authorship debate first.
5 / 5 (2) Sep 28, 2011
Eh, anyone could type random characters and produce shakespeare.... eventually... however, I'd like to see how long it would take the monkeys to type the question, "What do you get if you multiple six by nine?"
10 million years, perhaps?
1.1 / 5 (16) Sep 28, 2011
Surely using some bit of calculus would show that as the number of monkeys approaches infinity,

Idiot. You CANNOT approach infinity. Calculus will not help.
not rated yet Sep 28, 2011
Suppose he just tried to write the next great novel or a string of 100,000 random characters? If he didn't know what he was looking for, how would he know he had found it? Hindsight is 20-20
2 / 5 (8) Sep 28, 2011
What? why the two poor ratings? its true. You cant approach infinity. you can use calculus to determine infinite sequences, but those sequences all approach something finite. There is no convergence when you try to count to infinity.

George -- yeah, thats the point. It is pointless. He's just got some extra time and money and thought it would be fun to recreate Shakespeare's work using random number generators.
1 / 5 (5) Sep 28, 2011
ANIMAL RIGHTS!!! This is mean for the Monkeys!!
5 / 5 (7) Sep 28, 2011
The term "approach infinity" just means "as the number grows"; it's not to be taken literally, of course.

Calling someone an idiot got you some downvotes? I'm shocked!
5 / 5 (3) Sep 28, 2011
I should get some fives for a very relevant Hitchhiker's Guide reference.
5 / 5 (1) Sep 28, 2011
The point of this "theory," to me, is to reference human intelligence/cognition/consciousness; i.e. Are we capable of certain things, certain understandings, certain beauties by pure luck/endeavor alone, or are we more than just a machine?

Maybe you've heard the saying: you can't teach a dog physics. By the same notion, maybe we're just not wired to go beyond a certain capacity.

So, making a computer crunch out certain works by chance alone is pointless to the nature of the "theory."
3.7 / 5 (3) Sep 28, 2011
How would it be possible to know. There would be an infinite amount of data to check.
2 / 5 (5) Sep 28, 2011
There is no way, not in an infinity, that a chimpanzee could type out the works of Shakespeare. Math be damned, I don't need any algorithms to tell me that.
5 / 5 (1) Sep 28, 2011
Any event which has a non-zero chance of happening will occur an infinite number of times given an infinite number of chances. How is this difficult to understand?

That said, you could put every monkey that has ever existed in front of a typewriter for the entire duration of his life, and you would probably not even get a paragraph of Shakespeare. And if this guy wasn't generating 9 digits and checking to see if they fit ANYWHERE in the text, he wouldnt be anywhere close either.
3.7 / 5 (3) Sep 28, 2011
How would it be possible to know. There would be an infinite amount of data to check.

No. This is an artificial selection model. If words are generated that are in the story, they stay. Eventually, it collects all the words in the story. There are a finite number of words.
1 / 5 (1) Sep 29, 2011
It's worth noting that this proof is only valid in the case of an INFINITE number of monkeys with an INFINITE amount of time. Once we specify finite amounts of time and monkeys, the proof becomes subject to considerations such as how many monkeys would actually type on their typewriters instead of throwing them, or how many monkeys would type long enough to complete the work, or probability that the monkeys would figure out how to write in Renaissance English.
5 / 5 (2) Sep 29, 2011
I'm fairly certain you can teach monkeys to type, I see them working at the D.M.V. all the time.
not rated yet Sep 29, 2011
They blew a big opportunity by not presenting this straight. A good video shot in a lab, a lofty title before his name, a research institute after his name, and a subtle suggestion near the end that the "monkeys" might be fine-tuned to generate documents that no one has access to -- wow, we're talkin' big grant money.

I'm tellin' ya, play it straight like everyone else does. There's a sucker born every infinity.
not rated yet Sep 29, 2011
Right, but then you're expected to actually get results...
not rated yet Oct 01, 2011
A variant on the monkey theory deals with reading the future. If you write a program that randomly types alphanumeric characters with repetition on the screen varying the length of the text typed, the theory goes to say that at some point the writing of past and future documents (simple notes, letters entire books) should appear.
not rated yet Oct 01, 2011
@fmfbrestel : of course you can approach infinity, you just can't get infinitely close. I'm actually approaching 50 million dollars ...
1 / 5 (2) Oct 07, 2011
About this "approach infinity" nonsense...

No, you cannot LITERALLY approach infinity, but the person who said it originally did not mean it to be taken literally, more as a figure of speech.

You cannot approach infinity because if you start counting 1, 2, 3... you might say you are approaching infinity but you are not, because regardless of what number you count to you are always the same distance away from infinity... you are always infinite distance away from infinity.
1 / 5 (2) Oct 07, 2011
A variant on the monkey theory deals with reading the future. If you write a program that randomly types alphanumeric characters with repetition on the screen varying the length of the text typed, the theory goes to say that at some point the writing of past and future documents (simple notes, letters entire books) should appear.

It's much simpler than that.

Anything that can possibly be stored on a computer and therefore encoded in binary, can be arrived at simply by counting.

Say for example you want to make every possible combination of a 2x2 black and white image, you can calculate the number of possibilities by determining the bit length necessary to represent ONE such image and then raising 2 to that power. So if you know a 2x2x2 (2x2 B&W) image requires 1 bit per pixel * 4 pixels you know ONE such image can be represented in 4 bits (ignoring file format headers and stuff). So if you take 2^4 you have the total number of POSSIBLE images of that format, which is 16...
1 / 5 (2) Oct 07, 2011
So to make all possible combinations of those images you just count from 0 to 15 (of course you would have to append the correct bitmap header to it to make it readable by mspaint, or use a custom application to interpret it without a header)

But who cares about a tiny black and white image? Say you want to find the total number of images that can be represented in 1920x1080 HD resolution with a 24bit color depth? You do the same thing, determine how many bits it takes to represent that image and raise 2 to that power. 1920x1080 pixels is 2,073,600 pixels times 24 bits per pixel = 49,766,400... so 2^49,766,400 is the TOTAL number of images that can be represented at HD resolution. That's a HUGE number, but the important thing to note is that it is finite and the entire set can be generated by nothing more than COUNTING.... Think about what it means to be able to generate all possible images at HD resolution... you would have pictures of everyone who will ever exist in all possible...
1 / 5 (2) Oct 07, 2011

poses, all possible outfits, all possible hair styles etc... but not only that you will have images of everyTHING that will ever exist, of every vehicle that will ever be invented, of every building that will ever be built, of every animal that will ever evolve into existence. Furthermore, you will have images of all those things that will NEVER exists as well. You will have every possible image of every possible thing that could ever possibly exist... and the number is NOT infinite, it is finite, due to the resolution restriction.

This is just images, but e-books, music, movies, etc are all stored in binary and could all be generated in exactly the same way. A music file of a certain bitrate and a certain length is a certain number of bytes and every possible one that could ever exist could be generated by an algorithm as simple as:

for(x = 0; x < BITLENGTH; x*)

*physorg won't accept the plus plus here for some reason...

Please sign in to add a comment. Registration is free, and takes less than a minute. Read more

Click here to reset your password.
Sign in to get notified via email when new comments are made.