- A.1.1 Introduction
- A.1.2 Generalized coordinates
- A.1.3 Lagrangian equations of motion
- A.1.4 Hamiltonian dynamics
- A.1.5 Fields

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

where indicates the particle number and 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

of particle
in the direction, (with 1, 2, or 3 for the
, , or components respectively), is defined as

For the Lagrangian above, this is simply the normal momentum of the particle in the -direction.

The Lagrangian equations of motion are

This is simply Newton’s second law in disguise: the left hand side is the time derivative of the linear momentum of particle in the -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 direction on particle . 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-dimensional 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 , , ...and their time derivatives , , .... The number of generalized coordinates is the number of degrees of freedom in the system. A generic canonical coordinate will be indicated as .

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

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

There is one such equation for each generalized coordinate , 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 .

The terms are called generalized forces, and are only needed if
there are forces that cannot be modeled by the potential .
That includes any frictional forces that are not ignored. To find the
generalized force at a given time, imagine that the system is
displaced slightly at that time by changing the corresponding
generalized coordinate by an infinitesimal amount
. Since this displacement is imaginary, it is
called a virtual displacement.

During such a
displacement, each force that is not modelled by produces a small
amount of “virtual work.” The net virtual work divided by
gives the generalized force . 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 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 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 is defined as the time integral of
the Lagrangian:

(A.3) |

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

A.1.4 Hamiltonian dynamics

For a system with generalized coordinates the Lagrangian approach
provides one equation for each generalized coordinate .
These equations involve second order time derivatives of the
unknown generalized coordinates . However, if you consider
the time derivatives as additional unknowns, you get
first order equations for these unknowns. An
additional equations are:

These are no longer trivial because they now give the time derivatives of the first unknowns in terms of the second 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 first order equations
in unknowns, and it is particularly close to concepts in quantum
mechanics. Define the “Hamiltonian” as

(A.4) |

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 in terms of the , things could become messy. But in principle, the equations to solve are linear for given values of the .)

In terms of the Hamiltonian, the equations of motion are

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 . 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 , where the index indicates what particular potential it is. A single potential 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 . For example, if there is just one charged particle, , , and could represent the , , and components of the position of the particle. If there are more particles, just keep increasing .

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

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

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

The dot indicates the time derivative of the variable.

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

Here the subscripts on the field indicate partial derivatives:

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 with charge
in an electrostatic field .
Assuming that the particle is a point charge, that potential energy is
where is the
potential evaluated at the position 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 . In that case, the potential energy
takes the form:

Here is some chosen function that is zero except within some small distance of , and that integrates to one. Because this function is zero except very close to , you can approximate by 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 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}:

(A.6) |

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

(A.7) |

The canonical momenta are now

(A.8) |

The Hamiltonian is

(A.9) |

Hamilton’s equations for discrete variables are as before:

(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 as

In that case Hamilton’s equations are

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 instead of a
Hamiltonian density . At the end of every differentiation,
you will then need to drop an and a . In
particular, differentiate the Hamiltonian until you have to start
differentiating inside an integral, like, say,

At that time, make the substitution

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.