No, Jesse, monkeys will not type Shakespeare

This has to be the most pointless science “experiment” that I have ever come across. That article was in today’s print edition of The Times of India; the original researcher, Jesse Anderson’s report is here. The claim is that a bunch of computer-simulated “monkeys” have typed all of Shakespeare’s works — as, theoretically, it is widely claimed, is possible.

The reason it annoys me is that probability theory is already confusing enough, not just to lay people but even to experts, that there is no need for headlines like this to mess things up more. The probability of monkeys, typing insanely fast, reproducing a single page of Shakespeare accurately — let alone his entire oeuvre — is vanishingly small. If it is not likely to happen in the age of the universe, it is fair to say that it is impossible. This equally applies to virtual monkeys, on present-day computers (and any imaginable future computers).

And, if you read the TOI article, it turns out that this is not what is happening. The virtual monkeys are generating random text. Any sequence of 9 characters that happens to appear in Shakespeare is deemed to be “correct”. Once all “9-mers” in a Shakespeare work have been typed (in arbitrary order), that work is deemed to be complete.

Let’s simplify things and reduce the Shakespeare works to the uppercase and lowercase letters; the ten digits; the space; and nine punctuation marks (single and double quotes, full stop, comma, semicolon, colon, dash, question mark, exclamation point). That gives us 72 characters. How many 9-mers can be constructed of these characters? The answer is 729 = 51998697814228992. If the monkeys typed a million characters a second, they would need 1648 years to reproduce a single string of 9 characters.

So how do Anderson’s “monkeys” do it? By simplifying even further. Anderson considers only the 26 lowercase letters and no punctuation (not even spaces). Then there are 269 = 5.5 trillion possible 9-mers, a feasible number to explore exhaustively, which is all his monkeys are doing. Every time a 9-mer “agrees” with a 9-mer in Shakespeare, it is deemed a “hit”, and a Shakespeare work is deemed reproduced if it is entirely covered in “hits”.

In a little over a month, over 5 trillion of these 5.5 trillion 9-mers have been reproduced by the monkeys. Why 9-mers? Obviously to make it interesting. On the same computers, all possible 8-mers would have been produced in about 1-2(*) days — hardly very newsworthy. (And, to take a trivial example, all possible 1-mers or 2-mers would have taken a few milliseconds.) All possible 10-mers would have taken a couple of years(*) — perhaps the media would have lost interest, or perhaps the computer time would have been too expensive.

Having produced each one of the 5.5 trillion possible sequences of 9 letters, the monkeys will, by the author’s definition of “reproduced”, have reproduced not only all of Shakespeare, but all of the literature ever written in the English language (and other languages in the Roman script) since the beginning of time — and done that in barely a month. And if the authors had chosen 7-mers instead of 9-mers, it would have taken only a few hours. And by typing “a b c d e f g h i j k l m n o p q r s t u v w x y z”, I have reproduced all of Shakespeare in 1-mers: just strike off every character there against Shakespeare’s folio, ignoring case, space, punctuation and all non-letter symbols, and see what is left.

The only thought that occurs to me is — what a waste of computer resources.

(*)edit — these numbers corrected from first draft

The “single-slit experiment”: A thought experiment on superposing macroscopic states

After discussion, online and offline, relating to Dilip’s recent post and my rejoinder, here are some further thoughts on the question of putting a cat in a superposition of dead-alive states.

First, quantum mechanically a “superposition of states” is just a state, mathematically as valid as any other. It’s like choosing a different “basis vector” — that is, choosing to tilt your coordinate axes when taking measurements.

Second, a cat is of course in a superposition of states, as are we all — because we are made of quantum particles — but these states are very “nearby” in a sense.

Third, only something that is isolated from its environment is really in a “pure” state. In reality we all, including the cat, interact with our environments, and therefore a “true” quantum mechanical wavefunction must encompass both the cat and the environment. If we choose to focus only on the cat, it is in a “mixed state”.

It is because of this interaction that I asserted strongly that a cat will not be in a superposition of widely-separated (dead and alive) states. And if you did isolate the cat from the environment, by putting it in a vacuum, you’d anyway have a dead cat. But this is not a problem only with cats. The main problem with quantum computing is how to maintain the “coherence” of individual quantum bits, or “qubits”, which — in contrast to a cat — are quantum objects with just two states. If it is difficult to maintain coherence for qubits, it is impossible (in this sense of “impossible”) to do so for a cat.

It seems to me that the cat motif serves only to distract from the real question, of whether it is feasible to put a large macroscopic object in a superposition of states — and show experimentally that it is in fact in a superposition of states. With that in mind, here’s a thought experiment.

As in the Schroedinger cat experiment, you have a radioactive atom inside a closed box. If it decays, a detector swings into action — but instead of killing a cat, it moves a screen with a slit in it. On one side of the slit is a point light source. On the other side is a projection surface which is externally visible. So all that we can see is, initially, a patch of light on one side of the projection surface.

So we set up the experiment. Initially, the atom is supposed to be undecayed. But immediately it gains a finite probability of having decayed. So if the screen is truly isolated from the world, it ought to be in a superposition of states — so the slit in the screen, too, is in a superposition of two possible positions. This is a twist on the double-slit experiment but, if the screen is really in a superposition of states, should yield the same result: we should see an interference pattern on the projection surface. Since, as time goes by, the probability of the atom having decayed goes to 1, we should start with a patch of light on one side of the projection surface, progress through an interference pattern in the middle of the surface, and end with a patch of light on the other side of the surface.

We need to do this in as isolated a manner as possible — in a vacuum, near absolute zero — and even then I doubt very much that it is a feasible experiment. To me, it seems the probability of failure is overwhelming, and a failed experiment will tell us nothing. But if it worked and produced an interference pattern, it would be an astonishing result. Anyone care to try?

The Uncertainty Principle

The other day, Dilip D’Souza, a writer whom I enjoy reading, wrote an article that I did not enjoy reading. And it was not for the usual reasons, that it exposed some uncomfortable truths and made me question my assumptions on the society we live in. No, it was on a very familiar topic — the Heisenberg uncertainty principle and I found it not only disappointingly superficial but significantly misleading. So, even though we had a brief email exchange on this, I hope he will not mind my effort to set things straight.

The Heisenberg uncertainty principle is a principle in quantum mechanics, but that has not prevented its being misused and misquoted in popular culture. It says that, for any particle, the position and momentum cannot simultaneously have exact values (and puts a bound on the inexactness).

Now, it is natural to assume (and, in the early days, physicists did assume) that this is an incompleteness in our ability to observe these values: the particle has a position and a momentum, but we cannot know both of them. Why not? Because, if, for example, we determine its position by scattering off another particle, the impact changes its momentum. And this interpretation has invaded popular culture, as in Dilip’s (not original) example of an anthropologist who changes the society that he studies.

But this is really beside the point. It is not that we “cannot know” the particle’s position or momentum exactly: it has no exact position or momentum, and the more we try to define one, the less definite the other becomes.

Here’s the simplest analogy I can think of. Any extended macroscopic object — a slice of pizza, say — lacks a position, too. It has an average position, but how do you define that? The geometric average? The centre of mass? So the idea that a property of an object is not precisely defined should not be a total surprise.

Now suppose you are satisfied with a centimetre-scale definition of position, and your object is a metre rod, metre long and a millimetre thick, which you are forced to lay on the floor (you are not allowed to stand it on its end). If you line up this rod north-south, it does in fact have an exact east-west position (to the nearest centimetre, which is all you want). But it occupies a hundred centimetres in the north-south direction.

If you want it to have an exact north-south position, you can rotate it 90 degrees. Then it occupies a hundred centimetres in the east-west direction.

So this is a sort of uncertainty principle of the metre rod: you can give it a definite north-south position, or a definite east-west position, but not both. This is not a limitation of your ability to measure its position. But imagine, perhaps, that you believe that this rod is a point particle, and you cannot see it directly but only using sophisticated instruments. Then you may notice something odd: the more you localise this object in the east-west axis, the less it is localised in the north-south axis. You may think it is because of your measuring apparatus: the object is so light that squeezing it east-west makes it move about north-south. But the apparatus has nothing to do with it. The problem is your assumption that it is a point particle, when it is in fact a rod.

This is an analogy and not exact (perhaps some of my colleagues will think it very misleading). But I think it is useful. Classical particles are in states with exact positions and momenta. Quantum particles are in a different sort of state. Fundamentally, in those states, position and momentum are complementary. Paradoxes only arise when one tries to think of those states as “classical” states.(*)

Then Dilip brings in Schroedinger’s cat. It was, I believe, Stephen Hawking who said “When I hear of Schroedinger’s cat, I reach for my gun.” Einstein pioneered the use of “thought experiments”, but this cat is probably the most (in)famous thought-experiment of all.

In quantum mechanics, particles are not always in one state or another, but are in a “superposition of states”. Suppose you put a cat in a box with a radioactive atom. If the atom decays, the resulting gamma ray triggers a hammer that breaks a vial of poisonous gas, killing the cat. But a quantum mechanical description of the unobserved atom requires that, after any length of time, it is in a superposition of states — “decayed” and “not decayed”. Is the cat, too, in a superposition of states — “dead” and “not dead”?

Dilip says that it is, and worse, he confuses it with the obvious statement that we don’t know whether it is dead or alive. That is true but it is not quantum superposition. An unobserved electron really is in a superposition of states. A cat (or any macroscopic object) is not, and no serious physicist would claim that it is.

The question of how “superpositions of states” cease to occur as you go to larger objects is thorny but, today, fairly well understood. I won’t go into it here, but you could, if you like, think of a cat as a measuring device: if it dies (and we can detect this easily enough from outside the box), the fate of the atom is known too. But it does not matter whether we are observing the cat or not. (Parenthetically, a cat has zillions of states available to it, not just two; so even if you wanted to prepare a cat in a dead-alive superposition state, how would you isolate it to just two states of all those zillions?)

These are topics that confused physicists three generations ago. It is understandable that they confuse lay people today — but that does not, in my opinion, excuse journalists who write confused articles on the matter.

(*)For electrical engineers and others familiar with waves, I can give a much better analogy: the relation between the spatial “spread” of a wavepacket and the component wavelengths that it contains. A wave with only a single wavelength is infinitely long. If you want to compress it into a localised packet, you have to add together many different wavelengths, which will tend to interfere destructively over most of space, except in one particular region where they add up. The smaller and sharper that region, the greater the “spread” of wavelengths you need. The position of the wavepacket and the wavelengths (or their inverse, wavenumbers) are precisely analogous to position and momentum in quantum mechanics. For a slightly more technical explanation that I wrote many years ago for Resonance, the science education magazine (it requires only high school mathematics), go here.