Thursday, December 18, 2008

Math Lesson

You ever have one of those moments where everything aligns just so and you're positive it couldn't just be a coincidence, that something greater is at work? This is one of those moments.

Whilst doing my usual blog reading and coffee-drinking this morning, I came across this statement in yet another one of GQH's seemingly endless posts:
You're not exactly dealing with a chimp here! Because if I were a chimp, I'd've produced a Shakespearean play by now, what with all this random typing I do. And I haven't.
Not five minutes earlier my co-worker had shown me the answer to a statistical mechanics problem we had been discussing earlier this week (yes, we're all a bunch of nerds, you wanna make something of it?).

The statistics problem in question?
Suppose that 10^(10th) monkeys have been seated at typewriters throughout the age of the universe, 10^(18th) seconds. This number of monkeys is about three times greater than the present human population of the earth. We suppose that a monkey can hit 10 typewriter keys per second. A typewriter may have 44 keys; we accept lower case letters in place of capital letters. Assuming that Shakespeare’s Hamlet has 10^(5th) characters, will the monkeys hit upon Hamlet?

a) Show that the probability that any given sequence of 10^(5
th) characters typed at random will come out in the correct sequence of Hamlet is of the order of (1/44) to the power of (10^5) = 10^(-164,345), where log base 10 of 44 =1.64345.

b) Show that the probability that a monkey Hamlet will be typed in the age of the universe is 10^(-164,316). The probability of Hamlet is therefore zero in any operational sense of an event.

Do you see, dear readers, how the heavens (or some approximation thereof) suddenly aligned, and a beam of light shone down and a voice said, You have the answers to all of the statistical mechanics questions in the universe. You have the power to bring this knowledge to the people. Or, one person in particular who thinks that, if he were a chimp, he should have somehow randomly created a work of Shakespeare by now even though he's only been blogging since September of this year.

Overly complicated answers, I has them. Let me show you them.

Note: I am not solving the problem for the probability that a bunch of chimps (or one chimp) will be able to reproduce Shakespeare. I'm only proving what has already been stated, to wit, the probability of such an event occurring within the time frame of the age of the universe is "therefore zero in any operational sense of an event." (gotta love that math language!) I'm proving that GQH, if he were a chimp, could not possibly be able to reproduce a work of Shakespeare, so he should just stick to continuing to be human(?) and writing excessively long posts with lots of footnotes (and maybe, in a few billion years, he'll get lucky).

Part a): 44^(N) possible typewriter key combinations, a sequence of 10^5 keys pressed at random required to duplicate Hamlet, so N = 10^5 and the total number of possible sequences is 44^(10^5)

One possible correct sequence to recreate Hamlet being typed at random by a chimp:

1/(44^(10^5)) = 10^N = (1/44)^(10^5)

Log base 10^N = log(1/44)^(10^5)

Solve for N:

N = -10^5 log(44)

N= -10^5 * (1.64345)

N = -164345

(1/44)^(10^5) = 10^(-164345) which is the probability that even 10^10 monkeys sitting at typewriters throughout the age of the universe (10^18 seconds) would be able to reproduce Hamlet. In case you're wondering, 10 to the negative anything is a small number. 10 to the negative 164,345 is, like, absolute zero1.

Part b): 10^10 monkeys typing for 10^18 seconds, each hitting 10 keys per second

In 10^18 seconds, 10^29 keys are hit (10^10 + 10^18 + 10^1)

Begin a new sequence each time a key is hit except (10^5)-1

At end of a 10^29 character sequence each 1 character long such that monkeys type 10^29 sequences

Hamlet = 10^5 characters long. Monkeys type (10^29)-(10^5) sequences

Probability of monkey-created Hamlet typed in 10^18 seconds = (10^29) * (10^(-164345)) = 10^(-164316)

(1): Yes, I know absolute zero is a measurement of temperature (-459.67 degrees F, -273.15 deg Celsius, and 0 Kelvin, in case you're wondering). Absolute zero is a state of matter where said matter's molecular energy is minimal; that is, it is characterized by zero entropy and cannot transfer its energy to other systems. What does this have to do with the probability that a chimp will recreate Hamlet? Well, not much, really, (though it might be how y'all are feeling by now after reading energy whatsoever) but I think the concept of absolute zero is fascinating because of what happens to matter when it approaches absolute zero. Y'all ever hear of Bose-Einstein condensates? Superfluidity? NO? OMG, people, Bose-Einstein condensates are SO COOL (literally, HA HA HA...they're cooled to a few billionths of a degree above absolute zero). At that temperature, an entirely new state of matter is created! We're talking quantum mechanics in action, total weirdness! Really awesome, amazing stuff that makes me wish I was a theoretical physicist so I could play with supercooled atoms all day. But I suck at math. :)


Glaven Q. Heisenberg said...

I stand corrected, sister. Or b*tched-slapped. Whichever. It's all good.

But you realize I was talking about the 1603 Quarto of Hamlet, the so-called "Bad quarto"?

Does that change the equation?

Of course, If I were talking about Titus Andronicus, that would change everything. Because I'm pretty sure even an under-motivated invertebrate could produce THAT piece of sh*t in a year or two with random key strokes.

Now go - GO! - Sarah, and prove mathematically that invertebrates lack the necessary rigidity of body structure even to TYPE. Because until I see in the form of a mathematical FORMULA I will continue to sincerely believe that Giant Squids can TYPE!!1!

Glaven Q. Heisenberg said...

Oops! Meant to include this:

in brackets sup ... /sup

Whatever you include in between will be superscript.

Have fun with it, Sister!

Now stop b*tch-slapping me!

tfh said...

You have done us all a great service indeed. I will make printouts and hand them out individually to anybody who dares talk to me about chimps and Shakespeare. Darn, I miss a time when math was fun. Hasn't been fun for me since about the time they began handing out graphing calculators.

Sun Runner said...

You learn something new every day. In this case, it's how to make superscripts in Blogger. Thanks a bunch!

B. Kramer said...

uh ...

Good job.

joyRuN said...

Whoa! A post I can understand less than Glaveypoo's!

Fritz said...

"Assuming that Shakespeare’s Hamlet has 10^(5th) characters, will the monkeys hit upon Hamlet?"

It's actually easier than that. All of them. Monkeys are known for their loose sexual morays. (If we can define "hit on" as "offering to pick fleas off of")

Sun Runner said...

tfh-- Math is fun...when someone else does it! I never made it past Calculus II in graduate school. :)

fritz-- sexual morays?

Now that would be something to see! Eel sex? I think you mean morals. :)

Glaven Q. Heisenberg said...

Randomly hitting keys, here, I managed to type "mores", which is pronounced "morays" (more-ays or less-ays HAR!), and is, I think, what Fritz was really going for.

Horny Morays is really more Marvin Gaye territory, what with his hit song "Sexual Eeling" and all.

Angela said...

OK you lost me at coffee drinking. You can't possibly think that's normal to think that way? I don't know what you do for a living but I'm glad you stick to writing about running.

Hope you have a Merry Christmas Sarah.