{"id":8741,"date":"2013-10-24T09:48:00","date_gmt":"2013-10-24T13:48:00","guid":{"rendered":"http:\/\/scienceblogs.com\/principles\/?p=8741"},"modified":"2013-10-24T09:48:00","modified_gmt":"2013-10-24T13:48:00","slug":"free-as-in-energy","status":"publish","type":"post","link":"http:\/\/chadorzel.com\/principles\/2013\/10\/24\/free-as-in-energy\/","title":{"rendered":"Free, As In Energy"},"content":{"rendered":"<p>Via social media, John Novak cashes in a Nobel Betting Pool win from a while back, asking:<\/p>\n<blockquote>\n<p>Please explain to me the relationship between energy, entropy, and free energy.  Like you would explain it to a two year old child. <\/p>\n<p>Why?  There is a statistical algorithm called Expectation Maximization which is often explained in terms of those three quantities.  But apparently entropy is hard to understand because all the detail in the analogy is heaped on entropy part (with some side tracks in Kullback-Leibler divergences.)  Since I have a background in communication theory, entropy is a perfectly natural thing to me, even divorced from physical quantities.  Energy, and especially free energy aren&#8217;t nearly as natural to me in a statistical context.<\/p>\n<\/blockquote>\n<p>Sadly, I am one of the worst people you could possibly ask about this. I&#8217;m primarily an atomic physicist, meaning most of the time I&#8217;m worried about single atoms or very small groups of atoms. I rarely if ever deal with atoms in the kind of quantity where thermodynamic quantities are really necessary. Most of the time, when I think about changing energy states, I&#8217;m thinking about internal energy states of an individual atom in response to something like a narrow-band laser field applied to excite the atom. That&#8217;s not really a thermodynamic process, even when the laser is on for long enough to establish some sort of equilibrium distribution.<\/p>\n<p>As a result, despite having taken thermo\/statmech multiple times, I&#8217;m pretty hazy about a lot of this stuff. It always seemed kind of weird and artificial to me, and never all that relevant to anything I was doing. Taking it at 8:30am didn&#8217;t help anything, either.<\/p>\n<p>What you really want here is a chemist or a mechanical engineer, because they&#8217;re used to dealing with this stuff on a regular basis. I know some of my wise and worldly readers come from those fields, and maybe one of them can shed some additional light. I can tell you what little I do know, though explaining it as if to a two year old will end up sounding a bit like SteelyKid telling The Pip about movie plots (&#8220;&#8230;and then Darkrai showed up but also there were these purple things and if they touched anything it disappeared, but the kids had to defeat Darkrai except Darkrai had to battle the other Pokemon and they went [<i>miscellaneous battle noises<\/i>] and&#8230;&#8221;), because my understanding of the subject is around the five-year-old level.<\/p>\n<p>Anyway, the primary concern of thermodynamics is the &#8220;internal energy&#8221; of a system, by which we mean basically any energy that&#8217;s too complicated to keep track of in detail. This is stuff like the kinetic, rotational, and vibrational energy of macroscopic numbers of particles&#8211; you&#8217;re not going to individually track the instantaneous velocity of every single atom in a box full of gas, so all of that stuff gets lumped together into the &#8220;internal energy.&#8221; The &#8220;external energy&#8221; would presumably be something like the center-of-mass kinetic energy of the box full of gas if you shot it out of a cannon, but that&#8217;s classical mechanics, not thermodynamics.<\/p>\n<p>Internal energy in thermodynamics gets the symbol <i>U<\/i> because God only knows. (Confusingly, <i>U<\/i> is generally used for potential energy in quantum mechanics, so I spent a lot of time operating under significant misconceptions on this front.) Of course, you never really measure the total internal energy of a real system, only <em>changes<\/em> in the internal energy, which can be broken down into two pieces: energy flow due to heat entering or leaving the system, and energy flow due to work being done on or by the system. Because the apparatus for dealing with this stuff in a mathematical manner primarily is built around systems in equilibrium, we generally consider infinitesimal changes in everything, and handle time evolution by saying that each infinitesimal step results in a new equilibrium, and as long as nothing happens too quickly, that works reasonably well.<\/p>\n<p>The change in internal energy is the difference between heat in and work out (the conventional definitions of positive heat flow and positive work meaning heat coming in and work going out), given by:<\/p>\n<blockquote>\n<p>$latex dU = dQ &#8211; dW $<\/p>\n<\/blockquote>\n<p>where <i>Q<\/i> is heat (God knows why), and <i>W<\/i> is work (finally, a quantity whose symbol makes sense in English). These can be further broken down in terms of other quantities: for a sample of gas to do work (or have work done upon it) you generally need to change the volume, in which case the work can be written in terms of the pressure driving the volume change and the change in volume (Work is force times distance, so pressure (force per area) times volume (distance cubed) has the right units). Heat flow is associated with temperature, and at a given temperature, for heat to flow there must be something else changing, which was dubbed &#8220;entropy.&#8221; Given this, we can re-write th change in internal energy as:<\/p>\n<blockquote>\n<p>$latex dU = TdS &#8211; PdV $<\/p>\n<\/blockquote>\n<p>where <i>S<\/i> is entropy, and the other symbols ought to be self-explanatory. Everything in thermodynamics starts with this relationship.<\/p>\n<p>The original question had to do with the relationship between these quantities, which can (sort of) be seen from this fundamental equation, by holding various bits constant. The cleanest relationship between internal energy and entropy comes thorough temperature. If you hold the volume constant (doing no work), then the change in internal energy is just the temperature times the change in entropy. If you&#8217;re a physicist, you can re-arrange this into a derivative:<\/p>\n<blockquote>\n<p>$latex \\frac{1}{T} = \\frac{dS}{dU} $<\/p>\n<\/blockquote>\n<p>(at which point the mathematicians in the audience all break out in hives), telling you that the temperature is related to the change in entropy with changes in internal energy, which is one way to understand the <a href=\"http:\/\/scienceblogs.com\/principles\/2013\/01\/08\/what-does-negative-temperature-mean-anyway\/\">negative<\/a> <a href=\"http:\/\/scienceblogs.com\/principles\/2013\/01\/14\/how-do-you-make-negative-temperatures-anyway\/\">temperature<\/a> experiment from earlier this year. If you set up a system where the entropy decreases as you increase the energy, that corresponds to a negative temperature. This happens for a system where you have a maximum possible energy, because at the microscopic level, entropy is a measure of the number of possible states with a given total energy, and if there&#8217;s a cap on the energy of a single particle, that means there&#8217;s only one way to get that maximum energy, and thus it&#8217;s a state of very low entropy.<\/p>\n<p>Unfortunately, that&#8217;s about all you can cleanly say about a relationship between energy and entropy. They&#8217;re not really directly related in an obvious way&#8211; you can have high-entropy-low-energy states and low-entropy-high-energy states, and everything in between. The only thing you can say for certain is that the total entropy of a closed system will never decrease, no matter what happens to the energy.<\/p>\n<p>&#8220;Free energy&#8221; is a different quantity, which gets its name because it&#8217;s a sort of measure of the useful work that can be done by a system. This is a good illustration of the basic process of thermodynamics classes that I always found sort of bewildering. Basically, you can define a new quantity that&#8217;s the difference between internal energy and the product of entropy and temperature (<i>U &#8211; TS<\/i>). Physicists tend to give this the symbol &#8220;F,&#8221; and using the above definition of change in internal energy and a little algebraic sleight of hand (and the product rule from calculus), you get:<\/p>\n<blockquote>\n<p>$latex dF = d(U-TS) = SdT &#8211; PdV $<\/p>\n<\/blockquote>\n<p>This new quantity is the &#8220;Helmholtz Free Energy.&#8221; What&#8217;s the point of this? Well, if you consider an isothermal process, for which <i>dT<\/i> is by definition zero, then the change in this free energy is exactly equal to the negative of the work done by the system. So the free energy is a measure of the energy that is available to be extracted as work, which makes it a useful quantity for thinking about pushing things around with hot gases.<\/p>\n<p>The relevance to the Expectation Maximization business would probably have to do with the fact that for a system in equilibrium, <i>F<\/i> must be a minimum. Physically, this makes sense: if there&#8217;s extra free energy available above the minimum value, then you can extract useful work from the system, and it&#8217;s not really an equilibrium state in that case. Systems with excess free energy will tend to spontaneously give that energy up and change their volume in the process. Most discussions of this helpfully note that the only time chemists use the Helmholtz free energy (they prefer the Gibbs free energy, which includes the pressure and volume term and only changes when components of the system react to change their chemical identity) is when they&#8217;re talking about explosives.<\/p>\n<p>These are all very general and abstract relationships between things. The part that I always found kind of bewildering about this stuff is that completely separate from the above math, you tend to also be able to define an &#8220;equation of state&#8221; that relates various variables together&#8211; the &#8220;ideal gas law&#8221; <i>PV = nRT<\/i> is about the simplest example of an equation of state. These tended to basically drop out of the sky, usually turning up for the very first time in an exam problem, and I would get hung up on just where the hell they were coming from or what I was supposed to do with them. Which is a big part of why I&#8217;ve mostly avoided thinking about this since about 1995.<\/p>\n<p>So that&#8217;s all I&#8217;ve got. Sorry I couldn&#8217;t be more helpful, but maybe somebody else reading this will have some light to shed on this stuff as it relates to the maximization of expectations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Via social media, John Novak cashes in a Nobel Betting Pool win from a while back, asking: Please explain to me the relationship between energy, entropy, and free energy. Like you would explain it to a two year old child. Why? There is a statistical algorithm called Expectation Maximization which is often explained in terms&hellip; <a class=\"more-link\" href=\"http:\/\/chadorzel.com\/principles\/2013\/10\/24\/free-as-in-energy\/\">Continue reading <span class=\"screen-reader-text\">Free, As In Energy<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,11,138,471],"tags":[],"class_list":["post-8741","post","type-post","status-publish","format-standard","hentry","category-physics","category-science","category-theory","category-thermostatmech","entry"],"_links":{"self":[{"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/posts\/8741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/comments?post=8741"}],"version-history":[{"count":0,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/posts\/8741\/revisions"}],"wp:attachment":[{"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/media?parent=8741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/categories?post=8741"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/tags?post=8741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}