My question has two parts. But let's first introduce the problem:

In Lagrangian mechanics, a central part is the Lagrangian

$$ \mathcal L\left(t, q,\dot{q}\right) = T\left(t, q,\dot{q}\right) - V\left(t, q,\dot{q}\right), $$

where $t$ is the time, $q$ are the generalized coordinates and $\dot q$ are the corresponding time derivatives, $T$ is the total kinetic energy of the system, and $V$ is the total potential energy of the system. Alternatively, in a field theory, the Lagrangian would be the density

$$ \mathcal L\left(t, q(\vec{x}),\dot{q}(\vec{x}), \vec{\nabla}q(\vec{x})\right) = T\left(t, q(\vec{x}),\dot{q}(\vec{x}), \vec{\nabla}q(\vec{x})\right) - V\left(t, q(\vec{x}),\dot{q}(\vec{x}), \vec{\nabla}q(\vec{x})\right), $$

where $q$ are now the fields and $\dot{q}$ and $\vec{\nabla}q$ are the corresponding time- and spatial derivatives, respectively, and $T$ and $V$ are now the kinetic and potential energy densities, respectively. The equations of motion of the system are then given by the Euler–Lagrange equations.

However, if the system contains a gas, the gas may vary in temperature and will become hotter if it is compressed, which means that some kinetic energy was converted to thermal energy, which should increase the pressure of the gas more than if it was just the density of the gas that was considered, hence changing the behavior of the system.

Besides, since sound waves traveling in a gas will not only create pressure waves but also temperature waves, since an increase in pressure is accompanied by an increase in temperature, we will have a varying temperature within the gas. This variation will give rise to thermal diffusion, causing thermal energy to diffuse from the pressure tops to the pressure valleys, in turn causing the sound waves to weaken over time (the "life expectancy" is proportional to the wavelength squared).

My questions are:

  1. How do we take thermal energy into account in the Lagrangian? Should this be counted as just a form of potential energy, since macroscopically, it doesn't directly cause anything to move? Or should it be counted as partially potential energy and partially kinetic energy, since microscopically, it both makes the gas particles move faster, which increases the total kinetic energy, and makes particles press against each other harder during collisions which, during the collision between two particles, temporarily causes a higher potential energy?

  2. How do we model thermal diffusion in the Lagrangian of a field theory?

Note that I'm still only interested in macroscopic systems, as temperature is an inherently macroscopic property, not to mention that treating each individual fluid particle would become too complex.

  • $\begingroup$ Something about your question reminds me of Nose-Hoover dynamics. If you are unfamiliar, I would suggest this as one route to temperature control within the context of Hamiltonian/Lagrangian systems. $\endgroup$
    – Matt P.
    Nov 9, 2021 at 2:35

1 Answer 1


If you want to look at individual atoms and molecules, then thermal energy is just particle motion. Thus, if you have represented your particle motion in your Lagrangian, you have represented thermal motion. In the ordinary case it would be seriously impractical to use such. You are talking something in the range of $10^{22}$ particles in a gram of air. (More or less depending on the type of atoms.) So you can't really do it that way.

If you wanted to treat the system as whole and include thermal energy that is very different. For example, if you wanted to do a Lagranian representation of thermal energy in a fluid. Then you bring in the equation of state for the fluid. That will relate temperature and pressure, and possibly chemical identity if you wanted to include chemical processes. The equation of state will let you do things like relate pressure, temperature, and density. Depending on what you are doing, that can come into the system in a variety of ways.

For example, the equation of state might enter as a constraint. You would add the equation of state to the Lagrangian with a Lagrange multiplier. Then you treat the Lagrange multiplier as a new system variable, the equation of motion of which is the equation of state. You might get some incite into that process by looking at the Dirac method of dealing with constrained systems. Just don't get bogged down since he's doing it to head towards quantum systems.

Diffusion is going to be a gnarly problem in a Lagrangian formulation. I like Lagrangians, but they would not be my first choice for it. Diffusion does not really have anything like cannoncial coords or momentum.

  • $\begingroup$ Thanks for the answer, Dan! Indeed, treating each individual particle would be infeasible, and there would no longer be any notion of temperature as the system would become microscopic and temperature is a macroscopic property. Do you think you could give an example of how to use the equation of state to obtain the equations of motion? It is not immediately clear to me how that would work. When it comes to diffusion, I'm mainly considering field theories. It's maybe possible to include heat diffusion in a discrete system as well, but that is not what I had in mind. $\endgroup$ Nov 9, 2021 at 1:47
  • 1
    $\begingroup$ You basically write the eqn of state in a form G(x,y,z) = 0. Then you add G to the Lagrangian, multiplied by a parameter L. Here, x, y, and z, need to be parameters both in your Lagrangian and such that they can represent the equation of state. That may be the hardest step. Then you treat L as a new system variable and derive its equation of motion just as you would other system coords. It usually winds up having a canonical momentum of zero so you get a new constraint, which is the G=0 you just entered. Check the Dirac citation. $\endgroup$
    – Dan
    Nov 9, 2021 at 1:54
  • $\begingroup$ Do you mean that I should introduce pressure and temperature as extra generalized coordinates into the Lagrangian, since they would appear in the equation of state $G(x,y,z) = 0$? Doing that would lead to invalid Euler–Lagrange equations for those parameters since the Lagrangian doesn't depend on the partial time derivatives of those parameters. $\endgroup$ Nov 9, 2021 at 2:24
  • $\begingroup$ For example, if I have a cylinder with a constant amount of gas (constant mass) in it with pressure $P$ and temperature $T$, and for which the volume $V$ depends on $q$, the ideal gas law looks like $PV(q)=nRT$ (where $n$ and $R$ are constants). So we could write the equation of state on the form $G(q,P,T) = PV(q) - nRT = 0$. Do you mean that I should treat $P$ and $T$ as extra generalized coordinates and modify the Lagrangian as follows $L \mapsto L + G(q,P,T)$? Or how do you mean I should get equations of motion for $P$ and $T$? $\endgroup$ Nov 9, 2021 at 2:34
  • $\begingroup$ (The detailed approach in my last comment won't work since there is no "inertial" associated with $P$ or $T$, so the Euler–Lagrange equations for these parameters have no solutions.) $\endgroup$ Nov 9, 2021 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.