Subsections


A.1 Classical Lagrangian mechanics

Lagrangian mechanics is a way to simplify complicated dynamical problems. This note gives a brief overview. For details and practical examples you will need to consult a good book on mechanics.


A.1.1 Introduction

As a trivial example of how Lagrangian mechanics works, consider a simple molecular dynamics simulation. Assume that the forces on the particles are given by a potential that only depends on the positions of the particles.

The difference between the net kinetic energy and the net potential energy is called the “Lagrangian.” For a system of particles as considered here it takes the form

\begin{displaymath}
{\cal L}= \sum_j {\textstyle\frac{1}{2}} m_j \vert\vec v_j\vert^2 - V({\skew0\vec r}_1,{\skew0\vec r}_2,\ldots)
\end{displaymath}

where $j$ indicates the particle number and $V$ the potential of the attractions between the particles and any external forces.

It is important to note that in Lagrangian dynamics, the Lagrangian must mathematically be treated as a function of the velocities and positions of the particles. While for a given motion, the positions and velocities are in turn a function of time, time derivatives must be implemented through the chain rule, i.e. by means of total derivatives of the Lagrangian.

The canonical momentum $p^{\rm {c}}_{j,i}$ of particle $j$ in the $i$ direction, (with $i$ $\vphantom0\raisebox{1.5pt}{$=$}$ 1, 2, or 3 for the $x$, $y$, or $z$ components respectively), is defined as

\begin{displaymath}
p^{\rm {c}}_{j,i} \equiv \frac{\partial{\cal L}}{\partial v_{j,i}}
\end{displaymath}

For the Lagrangian above, this is simply the normal momentum $mv_{j,i}$ of the particle in the $i$-​direction.

The Lagrangian equations of motion are

\begin{displaymath}
\frac{{\rm d}p^{\rm {c}}_{j,i}}{{\rm d}t} = \frac{\partial{\cal L}}{\partial r_{j,i}}
\end{displaymath}

This is simply Newton’s second law in disguise: the left hand side is the time derivative of the linear momentum of particle $j$ in the $i$-​direction, giving mass times acceleration in that direction; the right hand side is the minus the spatial derivative of the potential, which gives the force in the $i$ direction on particle $j$. Obviously then, use of Lagrangian dynamics does not help here.


A.1.2 Generalized coordinates

One place where Lagrangian dynamics is very helpful is for macroscopic objects. Consider for example the dynamics of a Frisbee. Nobody is going to do a molecular dynamics computation of a Frisbee. What you do is approximate the thing as a solid body, (or more accurately, a rigid body). The position of every part of a solid body can be fully determined using only six parameters, instead of the countless position coordinates of the individual atoms. For example, knowing the three position coordinates of the center of gravity of the Frisbee and three angles is enough to fully fix it. Or you could just choose three reference points on the Frisbee: giving three position coordinates for the first point, two for the second, and one for the third is another possible way to fix its position.

Such parameters that fix a system are called “generalized coordinates.” The word generalized indicates that they do not need to be Cartesian coordinates; often they are angles or distances, or relative coordinates or angles. The number of generalized coordinates is called the number of degrees of freedom. It varies with the system. A bunch of solid bodies moving around freely will have six per solid body; but if there are linkages between them, like the bars in your car’s suspension system, it reduces the number of degrees of freedom. A rigid wheel spinning around a fixed axis has only one degree of freedom, and so does a solid pendulum swinging around a fixed axis. Attach a second pendulum to its end, maybe not in the same plane, and the resulting compound pendulum has two degrees of freedom.

If you try to describe such systems using plain old Newtonian mechanics, it can get ugly. For each solid body you can apply that the sum of the forces must equal mass times acceleration of the center of gravity, and that the net moment around the center of gravity must equal the rate of change of angular momentum, which you then presumably deduce using the principal axis system.

Instead of messing with all that complex vector algebra, Lagrangian dynamics allows you to deal with just a single scalar, the Lagrangian. If you can merely figure out the net kinetic and potential energy of your system in terms of your generalized coordinates and their time derivatives, you are in business.

If there are linkages between the members of the system, the benefits magnify. A brute-force Newtonian solution of the three-di­men­sion­al compound pendulum would involve six linear momentum equations and six angular ones. Yet the thing has only two degrees of freedom; the angular orientations of the individual pendulums around their axes of rotation. The reason that there are twelve equations in the Newtonian approach is that the support forces and moments exerted by the two axes add another 10 unknowns. A Lagrangian approach allows you to just write two equations for your two degrees of freedom; the support forces do not appear in the story. That provides a great simplification.


A.1.3 Lagrangian equations of motion

This section describes the Lagrangian approach to dynamics in general. Assume that you have chosen suitable generalized coordinates that fully determine the state of your system. Call these generalized coordinates $q_1$, $q_2$, ...and their time derivatives $\dot{q}_1$, $\dot{q}_2$, .... The number of generalized coordinates $K$ is the number of degrees of freedom in the system. A generic canonical coordinate will be indicated as $q_k$.

Now find the kinetic energy $T$ and the potential energy $V$ of your system in terms of these generalized coordinates and their time derivatives. The difference is the Lagrangian:

\begin{eqnarray*}
\lefteqn{{\cal L}(q_1,q_2,\ldots,q_K,\dot q_1,\dot q_2,\ldot...
...dot q_1,\dot q_2,\ldots,\dot q_K,t)
- V(q_1,q_2,\ldots,q_K,t)
\end{eqnarray*}

Note that the potential energy depends only on the position coordinates of the system, but the kinetic energy also depends on how fast they change with time. Dynamics books give lots of helpful formulae for the kinetic energy of the solid members of your system, and the potential energy of gravity and within springs.

The canonical momenta are defined as

\begin{displaymath}
p^{\rm {c}}_k \equiv \frac{\partial{\cal L}}{\partial \dot q_k} %
\end{displaymath} (A.1)

for each individual generalized coordinate $q_k$. The equations of motion are
\begin{displaymath}
\frac{{\rm d}p^{\rm {c}}_k}{{\rm d}t} = \frac{\partial{\cal L}}{\partial q_k}
+ Q_k %
\end{displaymath} (A.2)

There is one such equation for each generalized coordinate $q_k$, so there are exactly as many equations as there are degrees of freedom. The equations are second order in time, because the canonical momenta involve first order time derivatives of the $q_k$.

The $Q_k$ terms are called generalized forces, and are only needed if there are forces that cannot be modeled by the potential $V$. That includes any frictional forces that are not ignored. To find the generalized force $Q_k$ at a given time, imagine that the system is displaced slightly at that time by changing the corresponding generalized coordinate $q_k$ by an infinitesimal amount $\delta{q}_k$. Since this displacement is imaginary, it is called a virtual displacement. During such a displacement, each force that is not modelled by $V$ produces a small amount of “virtual work.” The net virtual work divided by $\delta{q}_k$ gives the generalized force $Q_k$. Note that frictionless supports normally do not perform work, because there is no displacement in the direction of the support force. Also, frictionless linkages between members do not perform net work, since the forces between the members are equal and opposite. Similarly, the internal forces that keep a solid body rigid do not perform work.

The bottom line is that normally the $Q_k$ are zero if you ignore friction. However, any collisions against rigid constraints have to be modeled separately, just like in normal Newtonian mechanics. For an infinitely rigid constraint to absorb the kinetic energy of an impact requires infinite force, and $Q_k$ would have to be an infinite spike if described normally. Of course, you could instead consider describing the constraint as somewhat flexible, with a very high potential energy penalty for violating it. Then make sure to use an adaptive time step in any numerical integration.

It may be noted that in relativistic mechanics, the Lagrangian is not the difference between potential and kinetic energy. However, the Lagrangian equations of motion (A.1) and (A.2) still apply.

The general concept that applies both nonrelativistically and relativistically is that of “action.” The action ${\cal S}$ is defined as the time integral of the Lagrangian:

\begin{displaymath}
\fbox{$\displaystyle
{\cal S}\equiv \int_{t_1}^{t_2} {\cal L}{\,\rm d}t
$}
\end{displaymath} (A.3)

Here $t_1$ and $t_2$ are suitably chosen starting and ending times that enclose the time interval of interest. The action is unchanged by infinitesimal imaginary displacements of the system. It turns out that that is all that is needed for the Lagrangian equations of motion to apply.

See {D.3.1} for a derivation of the above claims.


A.1.4 Hamiltonian dynamics

For a system with $K$ generalized coordinates the Lagrangian approach provides one equation for each generalized coordinate $q_k$. These $K$ equations involve second order time derivatives of the $K$ unknown generalized coordinates $q_k$. However, if you consider the time derivatives $\dot{q}_k$ as $K$ additional unknowns, you get $K$ first order equations for these $2K$ unknowns. An additional $K$ equations are:

\begin{displaymath}
\qquad \frac{{\rm d}q_k}{{\rm d}t} = \dot q_k
\end{displaymath}

These are no longer trivial because they now give the time derivatives of the first $K$ unknowns in terms of the second $K$ of them. This trick is often needed when using canned software to integrate the equations, because canned software typically only does systems of first order equations.

However, there is a much neater way to get $2K$ first order equations in $2K$ unknowns, and it is particularly close to concepts in quantum mechanics. Define the “Hamiltonian” as

\begin{displaymath}
H(q_1,q_2,\ldots,q_K,p^{\rm {c}}_1,p^{\rm {c}}_2,\ldots,p^...
...al L}(q_1,q_2,\ldots,q_K,\dot q_1,\dot q_2,\ldots,\dot q_K,t)
\end{displaymath} (A.4)

In the right hand side expression, you must rewrite all the time derivatives $\dot{q}_k$ in terms of the canonical momenta

\begin{displaymath}
p^{\rm {c}}_k \equiv \frac{\partial {\cal L}}{\partial \dot q_k}
\end{displaymath}

because the Hamiltonian must be a function of the generalized coordinates and the canonical momenta only. (In case you are not able to readily solve for the $\dot{q}_k$ in terms of the $p^{\rm {c}}_k$, things could become messy. But in principle, the equations to solve are linear for given values of the $q_k$.)

In terms of the Hamiltonian, the equations of motion are

\begin{displaymath}
\frac{{\rm d}q_k}{{\rm d}t} = \frac{\partial H}{\partial p...
...}}_k}{{\rm d}t} = - \frac{\partial H}{\partial q_k}
+ Q_k %
\end{displaymath} (A.5)

where the $Q_k$, if any, are the generalized forces as before.

If the Hamiltonian does not explicitly depend on time and the generalized forces are zero, these evolution equations imply that the Hamiltonian does not change with time at all. For such systems, the Hamiltonian is the conserved total energy of the system. In particular for a nonrelativistic system, the Hamiltonian is the sum of the kinetic and potential energies, provided that the position of the system only depends on the generalized coordinates and not also explicitly on time.

See {D.3.2} for a derivation of the above claims.


A.1.5 Fields

The previous subsections discussed discrete mechanical objects like molecules, Frisbees, and pendulums. However, the Lagrangian and Hamiltonian formalisms can be generalized to fields like the electromagnetic field. That is mainly important for advanced physics like quantum field theories; these are not really covered in this book. But since it does appear in one advanced addendum, {A.22}, this subsection will summarize the main points.

The simplest classical field is the electrostatic potential $\varphi$. However, there may be more than one potential in a system. For example, in electrodynamics there are also vector potentials. So the generic potential will be indicated as $\varphi_\alpha$, where the index $\alpha$ indicates what particular potential it is. A single potential $\varphi_\alpha$ is still characterized by infinitely many variables: there is a value of the potential at each position.

In addition there may be discrete variables. Electromagnetics would be pretty boring if you would not have some charged particles around. A generic coordinate of such a particle will be indicated as $q_k$. For example, if there is just one charged particle, $q_1$, $q_2$, and $q_3$ could represent the $x$, $y$, and $z$ components of the position of the particle. If there are more particles, just keep increasing $k$.

Under the above conditions, the Lagrangian will involve an integral:

\begin{displaymath}
{\cal L}= \Lag_0 + \int \pounds {\,\rm d}^3{\skew0\vec r}
\end{displaymath}

Here $\pounds $ is called the “Lagrangian density.” It is essentially a Lagrangian per unit volume. The integral is over all space.

The first part $\Lag_0$ is as before. It will depend on the discrete variables and their time derivatives:

\begin{displaymath}
\Lag_0 = \Lag_0(\ldots; q_k,\dot{q}_k;\ldots)
\end{displaymath}

The dot indicates the time derivative of the variable.

The Lagrangian density $\pounds $ will depend on both the fields and the discrete coordinates:

\begin{displaymath}
\pounds = \pounds (\ldots;\varphi_\alpha,\varphi_\alpha\st...
...trut_y,\varphi_\alpha\strut_z;
\ldots;q_k;\dot{q}_k;\ldots)
\end{displaymath}

Here the subscripts on the field indicate partial derivatives:

\begin{displaymath}
\varphi_\alpha\strut_t = \frac{\partial\varphi_\alpha}{\pa...
...hi_\alpha\strut_z = \frac{\partial\varphi_\alpha}{\partial z}
\end{displaymath}

In principle, there is no reason why the Lagrangian could not contain higher order derivatives, but fortunately you do not see such things in quantum field theories.

This brings up one practical point. Consider a contribution such as the potential energy of a particle called ${\rm {P}}$ with charge $\bar{q}_{\rm {P}}$ in an electrostatic field $\varphi$. Assuming that the particle is a point charge, that potential energy is $\bar{q}_{\rm {P}}\varphi_{\rm {P}}$ where $\varphi_{\rm {P}}$ is the potential evaluated at the position ${\skew0\vec r}_{\rm {P}}$ of the particle. But potentials evaluated at a point are problematic. You would really want the potentials to always appear inside integrals. To achieve that, you can assume that the particle is not really a point charge. That its charge is spread out just a little bit around the nominal position ${\skew0\vec r}_{\rm {P}}$. In that case, the potential energy takes the form:

\begin{displaymath}
\int \bar{q}_{\rm {P}} \delta^3_\varepsilon({\skew0\vec r}...
...\approx \bar{q}_{\rm {P}} \varphi({\skew0\vec r}_{\rm {P}};t)
\end{displaymath}

Here $\delta^3_\varepsilon({\skew0\vec r}-{\skew0\vec r}_{\rm {P}})$ is some chosen function that is zero except within some small distance $\varepsilon$ of ${\skew0\vec r}_{\rm {P}}$, and that integrates to one. Because this function is zero except very close to ${\skew0\vec r}_p$, you can approximate $\varphi({\skew0\vec r};t)$ by $\varphi({\skew0\vec r}_{\rm {P}};t)$ and then take it out of the integral. That gives the original expression for the potential energy. But the integral is easier to use in the Lagrangian. Its integrand becomes part of the Lagrangian density. And you can always take the limit $\varepsilon\to0$ at the end of the day to get point charges.

The Lagrangian equations for the discrete parameters are exactly the same as before, but of course now the Lagrangian includes the integral, {D.3.3}:

\begin{displaymath}
\frac{{\rm d}}{{\rm d}t} \left(\frac{\partial \Lag_0}{\par...
...ac{\partial \pounds }{\partial q_k} {\,\rm d}^3{\skew0\vec r}
\end{displaymath} (A.6)

There is one such equation for each discrete parameter $q_k$, valid at any time.

The Lagrangian equations for the field are based on the Lagrangian density instead of the Lagrangian itself. That is why you really want to have the terms involving the field as integrals. The equations are

\begin{displaymath}
\frac{\partial}{\partial t}
\left(\frac{\partial\pounds ...
...z}\right)
= \frac{\partial\pounds }{\partial\varphi_\alpha}
\end{displaymath} (A.7)

There is one such equation for each field $\varphi_\alpha$, valid at any position and time.

The canonical momenta are now

\begin{displaymath}
p^{\rm {c}}_k \equiv \frac{\partial \Lag_0}{\partial \dot{...
...equiv \frac{\partial\pounds }{\partial\varphi_\alpha\strut_t}
\end{displaymath} (A.8)

Note that the field momentum $\pi^{\rm {c}}_\alpha$ is per unit volume.

The Hamiltonian is

\begin{displaymath}
H = \sum_k p^{\rm {c}}_k \dot{q}_k +
\sum_\alpha \int \p...
... \varphi_\alpha\strut_t {\,\rm d}^3{\skew0\vec r}
- {\cal L}
\end{displaymath} (A.9)

The time derivatives $\dot{q}_k$ and $\varphi_\alpha\strut_t$ must again be expressed in terms of the corresponding canonical momenta.

Hamilton’s equations for discrete variables are as before:

\begin{displaymath}
\frac{{\rm d}q_k}{{\rm d}t} = \frac{\partial H}{\partial p...
...}p^{\rm {c}}_k}{{\rm d}t} = - \frac{\partial H}{\partial q_k}
\end{displaymath} (A.10)

The equations for the fields are a bit tricky. If there are no discrete variables, there is no problem. Then the Hamiltonian can be written in terms of a Hamiltonian density $h$ as

\begin{displaymath}
H = \int h {\,\rm d}^3{\skew0\vec r}
\end{displaymath}

In that case Hamilton’s equations are

\begin{displaymath}
\frac{\partial\varphi_\alpha}{\partial t}
= \frac{\parti...
...left(\frac{\partial h}{\partial\varphi_\alpha\strut_z}\right)
\end{displaymath}

Unfortunately, if there are discrete parameters, products of integrals will appear. Then there is no Hamiltonian density. So the only thing you can do do is differentiate the full Hamiltonian $H$ instead of a Hamiltonian density $h$. At the end of every differentiation, you will then need to drop an $\int$ and a ${\rm d}^3{\skew0\vec r}$. In particular, differentiate the Hamiltonian $H$ until you have to start differentiating inside an integral, like, say,

\begin{displaymath}
\frac{\partial}{\partial\varphi_\alpha}\int{\pounds }{\,\rm d}^3{\skew0\vec r}
\end{displaymath}

At that time, make the substitution

\begin{displaymath}
\frac{\partial}{\partial\varphi_\alpha}\int{\pounds }{\,\r...
...tarrow\quad
\frac{\partial\pounds }{\partial\varphi_\alpha}
\end{displaymath}

This will produce the right answer, although the left hand side above is mathematically complete nonsense.

See {D.3.3} for a justification of this procedure and the other claims in this subsection.