A demon in your coffee

Americano, Maxwell's demon
So innocent looking. But could an imaginary demon lurking within help us to understand more fully a major theory in physics?

Is there a way of preparing an Americano that can reveal a particularly knotty problem in physics with implications for information theory?

The question arises out of a field of physics, developed through the nineteenth century, that deals with energy and temperature: thermodynamics. It is the theory that describes how a hot coffee, left in a cold room, will eventually cool to the temperature of the (ever so slightly warmer) room. And though this may seem a trivial example, the theory is immensely powerful with applications from steam engines to superconductors. But it is back with the cooling coffee that we may find a demon, and it is worth finding out a bit more about him.

There are four laws of thermodynamics (the original three and then what is known as the ‘zeroth’ law). But it is the second that concerns us here. It can be phrased in a number of different ways but essentially says that there is no process for which the only result is the transfer of heat from a cold object to a hot one. To think about our coffee, the coffee will cool down to the same temperature as the room, but as the law describes, the room cannot get colder by giving its heat to the coffee cup (so the coffee gets hotter)!

It is in fact, one of the few places in physics where there is a ‘direction’ to time. For most of the laws of physics, time could run in the opposite direction without changing the effect, but not so for this one. The second law of thermodynamics is a definite provider for an arrow of time.

coffee clock, Rosslyn coffee
The clock at Rosslyn Coffee in the City of London. But the image alludes to a fundamental truth: the way that coffee cools is one of the few areas of physics for which it matters which way time ‘flows’.

But that is a digression. We ought to return to the demon in the coffee. The second law of thermodynamics seems to be based on our common sense (though perhaps that is because our common sense is formed within the laws of physics that determine the second law of thermodynamics). But with confidence in our common sense to understand the second law of thermodynamics, let’s do a thought experiment in which we make a strange type of Americano. Imagine a cup of coffee with an impermeable partition cutting through it. Into one half of the cup we pull a lovely, single origin, espresso. The crema rising onto the surface with some brilliant tiger striping on show. Into the other half of the cup we pour some water, initially at the same temperature as the coffee. We drill a small hole in the partition and watch what happens. Of course we know what happens. Ever so slowly, the coffee starts to get into the water and the water into the coffee until we are left with a balanced Americano on both sides with both sides at the same temperature.

Great, but now let us introduce the demon. Actually, he’s called “Maxwell’s Demon” because it was Maxwell who first proposed him (in ~1871), but we can call him anything we like. Perhaps he’s not a he at all. Our demon sits next to the small hole we have made in the partition and watches as the molecules travel towards the hole from the water’s side and the side holding the coffee. This demon is a bit of a trouble maker and so any fast moving molecules (hot) from the water he allows to get into the coffee and any slow moving molecules (cold) from the coffee he allows to get into the water. He does not allow slow molecules from the water into the coffee or fast molecules from the coffee into the water. Just to add to the mix, any coffee solubles he returns to the coffee allowing only water molecules through the hole in the partition.

If our demon exists, we would end up with a lot of very fast molecules on the coffee side (which will therefore be hotter) while the water would hold slower molecules (and be colder). We’d have a very hot espresso on one side of the partition and some luke warm water on the other. It’s not only a terrible Americano but a violation of the second law of thermodynamics! Which is worse?

Although he was proposed as a thought experiment, it is a problem with serious implications for the second law of thermodynamics (which otherwise seems to be a very good model of how things work). Because while we may not seriously consider an actual demon in the coffee, what stops some mechanical tool that we make from violating the second law, if the demon, in principle, could exist? Could the second law be wrong? Could there be a way of getting heat into our coffee from a cold room?

3D hot chocolate art on an iced chocolate, Mace, Mace KL, dogs in a chocolate
Art on a hot chocolate at Mace in KL. Well, what is your mental image of Maxwell’s demon?

The consensus has been that even were the demon to exist, ultimately he is powerless against the second law which does not get overturned by his presence. Because even if we could end up with a super hot espresso on one side of the barrier and cold water on the other side, this is not the whole system; the whole system includes the demon. And the second law applies to the whole system not the system minus the demon. So when we consider the energy (and entropy) of the demon in doing the work necessary to decide which molecules to let through and which to filter out, we find that work is done on the system (by the demon) and the entropy, the disorder if you like, of the whole system has increased (which is another way of phrasing the second law). Calm is restored, we get our Americano back, the laws of physics as we understand them are retained.

But Maxwell’s demon has not been completely exorcised yet, or at least, he is proving to be quite helpful. Because it turns out that there are methods for which the energy cost for the demon is minimal and the argument above no longer works. It seems we are back to square one. But even in that situation, it was realised that the demon has to record, make a note of, which molecules are fast and which are slow, which are coffee and which are water. It has led to an understanding that information has to be part of our consideration of thermodynamics. And as our ability to manipulate nanostructures and individual atoms improves, so experiments are able to explore how information ties into thermodynamics and why Maxwell’s demon still has not undone the second law yet. But it is here that we encounter another demon, the one that is found in the details, so if you are interested you can read more about it here.

Making coffee work

Cogs, Wimbledon Common, Windmill, Contact S2b, instant coffee and washing soda developer
Cogs on Wimbledon Common, taken using a film based camera and developed using (instant) coffee. A way to make coffee ‘work’ but not the one linked to Helmholtz.

Search online and you can find videos of machines that lift cogs or turn wheels that are powered by the steam rising off a coffee. You can see an example here and find instructions for how to build your own here (a “stay at home” hobby project perhaps?).

Although such machines are very much for the hobbyist, the principle of the steam engine drove the industrial revolution. And, even now, much of our power network relies on somehow heating water which then drives a turbine that generates electricity. Underlying this is the principle that energy can be transformed from one type to another but is, ultimately, always conserved.

The concept is easiest to visualise with a pendulum or a swing. At its height, the pendulum has a maximum of potential energy but is not moving (so its kinetic energy is zero). As it passes through its minimum height point, the speed of the swing (or pendulum) is maximum and the potential energy at a minimum. Indeed, the amount of potential energy lost by the pendulum is equal* to the amount of kinetic energy gained. The same can be extended to “work” which, in the language of physics is always energy. If a certain amount of energy is put in, a certain amount of work can be produced. In a closed system and without loss, the amount of energy you put in is the amount of energy you get out. In any real system, some of that energy is lost to heat or other methods of loss.

Press Room coffee Twickenham
Whether you make your coffee as a pour over or an espresso, the principle of conservation of energy is always the same. The energy you put in will equal the energy you get out (with some lost as heat as the coffee cools). Pour over at the Press Room, Twickenham.

To use a more coffee related example, in an espresso machine, work is done to put the water under high pressure (and separately to heat it). This pressurised water is then allowed to escape through the coffee puck where the work originally done pressurising it gets transformed into the kinetic energy (speed) of the water going through the group head. Changing the pressure changes the speed at which the water goes through the puck in an analogous way to how changing the height of the pendulum drop affects the speed as it goes through its central point. Of course you won’t always see this because changing things like the grind size in the espresso puck will also affect the route that the water takes as it travels through the puck and so the actual speed at which you see the coffee-infused water leaving the espresso basket will be affected by that too. The real world is never quite so easy as the ideal.

A pour over works in a different way. Here, the energy is stored in the water ‘bath’ in the filter as gravitational potential energy. As the water falls, it gains kinetic energy at the expense of this gravitational energy (or height). As the espresso machine also works with gravity, the conclusion would be that the water will move much faster through the espresso puck than the pour over bed. That this often doesn’t seem to be so is again because of the effects of the resistance of the coffee bed or espresso puck, on the espresso and the pour over.

This concept of the conservation of energy has been engrained into us from an early age. And so it may be surprising that it is a fairly recent principle in physics. For although versions of this principle had been considered for many years, it had not been recognised until the 1840s (by James Joule and Robert Mayer in 1843 and 1842 respectively) that work and heat were interchangeable. And it wasn’t until 1847 that Helmholtz recognised that all energy was conserved. Although at that time he was using the word ‘force’ for what we now call ‘energy’, and what we now call kinetic energy was thought of as a ‘living’ energy. He wrote:

“… the loss in the quantity of potential force is always equal to the gain in living force, and the gain of the first is the loss of the second. Thus, the sum of the existing living and potential forces is always constant.”**

So, among the many contributions to physics that he made, Helmholtz also has a claim to being among those who developed the field of thermodynamics which remains crucial both for physics and for our industrial and technological progress.

Rag&Bone, Rag & bone, coffee Victoria, coffee Westminster
Rag & Bone Coffee in front of St Matthew’s Church. Much of our understanding is based on our assumptions about how the world works. The challenge for us is to identify those assumptions that underlie our thinking.

There is perhaps a cautionary note here for any who are tempted to think that science and religion are always somehow in opposition. For the British scientists who contributed to the development of the idea of conservation of energy (such as Joule and William Thomson (Lord Kelvin)), the concept was founded on the idea of a Creator God: as only God could create or destroy, so it followed that energy of itself, could never be either created nor destroyed, it could only be transformed from one form to another. The idea of a God was, for them, implicit in the idea of the conservation of energy**.

Helmholtz had a philosophical disagreement here. For him, the principle was founded on a Kantian understanding of philosophy***. Certainly certain things had to be assumed at the beginning (such as the principle of causality and the existence of matter outside of our perception of it). But once these assumptions had been made, the principle of conservation of energy followed in a deterministic manner.

Does this matter? In our everyday experience of engines and the way things work, conservation of energy certainly seems to be crucial. We no longer question the principle but assume that one form of energy is transformed into another and is continuously conserved even as it is dissipated into the universe as heat as our coffee cools. But nonetheless, Helmholtz’s understanding was founded on certain assumptions, beliefs, just as Joule and Kelvin’s. It helps to be aware of the philosophical underpinning of our science so as to ensure we don’t have over confidence in what we can, and cannot, know.

So Helmholtz can teach us something else as we gaze into our coffee. Our world is multifaceted, and what we believe about what the world is, influences and informs our understanding of how the world works. Our challenge is to look into ourselves as we sip our coffee and to start to see what we believe we know and what we can actually know. And if we were to really do that, what conflicts would we find?

*With the usual caveats of no energy being lost to friction etc.

**”Helmholtz and the British Scientific Elite: from force conservation to energy conservation”, David Cahan, Notes Rec. R. Soc (2012), 66, 55-68

***”Helmholtz: from enlightenment to neuroscience”, M Meulders, MIT press, 2010

Life at the Coffee Jar

CoffeeJar_exteriorI had been waiting for an opportunity to try the Coffee Jar for a fair while. It is not that it is in a remote location, it is in fact situated on Parkway just five minutes walk from Camden or Primrose Hill. Nonetheless it feels as if it needed a special trip to get there (and, though this is pre-empting the end of this cafe-physics review, it does deserve such a ‘special trip’). Inside, there is seating at the window and running along one wall, and although it is not the smallest of cafés, it is certainly a ‘cosy’ one. This is not intended as an estate agent’s euphemism but instead to emphasise the additional meanings of this word to convey a warmth and friendliness about the space that the Coffee Jar definitely has. So far, we have been twice (see, the ‘special trip’ is worth it!). The coffee comes from Monmouth and so unsurprisingly, on the two occasions I had a coffee there (Americano and Soya Latte), it was very well done and enjoyable. At the front of the counter are a wide selection of home made cakes and cookies. While this presentation can be awkward for allergy sufferers (nutty cakes or cakes with loose nuts on top are placed side by side with the nut free options which could give contamination issues), the cookies were very good (more on the cookies later).

As befits the name, hand painted jars and coffee mugs decorate the end of the tables (and can be purchased should you wish). Individual art pieces decorate the walls while the window is painted with a scene that is somehow mirrored (shadowed?) in the ink prints on the take-away cups. All in all, there is plenty to notice in this “cosy” space. And so it took a fairly long time before I noticed the fish that was dangling above my head.

robot fisherman, robot fisherwoman, coffee jar camden

Apologies for the blurry photo but you can see the robot fisherman on the shelf.

Yes, this seemed an odd thing to me too, so I checked and indeed, a wooden fish was suspended on a string from something hidden on the shelf above my seat. At this point, an opportunity arose to go and sit at the window and so I was able to turn and look properly at the cause of the suspended wooden fish which was actually a toy robot. It just gets more surreal. But indeed, on the shelf above the seats against the wall was a toy robot fishing, a wooden fish hanging at the end of his (her?) line.

A robot that is fishing can prompt a large number of questions which seem to me to be at the intersection of science and philosophy. To what extent has automation improved our lives? Is it a good or a bad thing to use robots in jobs traditionally done by humans? Moving away from robots and towards computers, what about artificial intelligence? Much has been written about artificial intelligence in recent years. There is some angst about whether robots will come to take-over the world with an ability to think that far surpasses our human ability. Alternatively, there are people who look to artificial intelligence with the hope that it will help us drive cars or investigate pollution or all manner of other (to a greater or lesser degree) useful things. One test that has been suggested as a way of establishing whether any particular computer, or artificial intelligence, can think is the Turing test proposed in 1950 by Alan Turing. A prize set up to reward the first computer “chatbot” that could reliably mislead human judges into thinking that it was itself a human (the Loebner prize) has so far not been won (a prize is awarded each year for the most convincing chatbot but so far, none has been so reliably convincing as a human to win the top, “gold” prize).

soya latte at the coffee jar camden

Unusually I had a soya latte.

But the robot on the shelf was not represented as thinking but as fishing, an occupation that is associated with relaxation. This robot was not just thinking, it was taking time out to relax; it was represented as being alive and sentient. This prompts a rather different question to that of merely intelligence: At what point do we say that something is living? How can we define life? As could perhaps be expected, NASA has taken some time to consider this question. As they say on their website:

“Comparing the semantic task [of defining life] to the ancient Hindu story of identifying an elephant by having each of six blind men touch only the tail, the trunk, or the leg, what answer a biologist might give can differ dramatically from the answer given by a theoretical physicist.”

Which may make you wonder well, what would a theoretical physicist say about how we could define life? Erwin Schrödinger (1887-1961) had a very interesting, physics-based, definition of life. Although he is now perhaps more famous for his equation or his cat, in 1944 he wrote a book called “What is Life” (opens as pdf). To very briefly summarise, the argument goes that the tendency of all inanimate objects is towards equilibrium. A hot cup of coffee will lose heat to its immediate environment and so reach the same temperature as its surroundings, a small amount of blue food colouring at the bottom of a glass of water will eventually colour the entire glass a paler blue. To be alive is to defer this state of equilibrium for to achieve equilibrium is the same thing as death. Schrödinger argued that rather than merely consume energy, living things consumed negative entropy from their food-stuff. Entropy is a quantity introduced with the theory of thermodynamics. It is often taken as a measure of the order in a system (though there are caveats to that). The second law of thermodynamics states that for a closed system, the entropy of the system will either increase or stay the same. This suggests that to avoid equilibrium, or equivalently to avoid death, the living thing must consume order (or negative entropy) and somehow stave off this tendency to maximum entropy. To answer the objection that it would be easy to consume negative entropy by eating diamonds (which are highly ordered crystals) and so therefore that there has to be more to life than this, Schrödinger expanded on the thermodynamics of his argument. That bit gets quite technical and so is another reason that, if you are interested, it is worth getting hold of the book.


So to return to one of the first questions but phrase it in a slightly different way. Could a robot cookie maker replace the “home-made” cookies that were on offer in the Coffee Jar? It turns out that this is a subject that my often-times cafe-physics review companion (let’s call them J) has quite an opinion about. We visited the Coffee Jar twice partly because of the cookies! It seems to me that J would not have been impressed by the cookies were they robotically mass manufactured. There was something very appealing in the home made quality of them. So, there we go, one of the questions answered neither scientifically nor philosophically but on the very reasonable basis that home made cookies taste and look better. Do let me know if you agree if and when you visit the Coffee Jar.
The Coffee Jar is at 83 Parkway, NW1 7PP
“What is life?” Erwin Schrödinger, Cambridge University Press, first published 1944, my edition published 2013