A hanging chain
I remember reading Feynman II back in my youth and being blown away by the calculus of variations chapter, and immediately trying to play with it in every single different context I could. This is one of them, slightly more complex than those in the gospel according to RPF. Weβre going to go on a route around the world and end up in a perhaps unexpected place.
Suppose youβve got a chain hanging under gravity. What shape does it take? Letβs parametrize the shape as where is arc length. Then its potential energy is
where is total length, is mass-per-unit-length and is, of course, gravity. When the chain is in steady state this will be at a minimum.
But, I hear you say, this clearly has no minimum because can be made arbitrarily negative. There is a trick β remember I said that is arc length. We need to include that constraint in our minimization; what we actually minimize is
where is a Lagrange multiplier to enforce the arc length constraint1. Itβll actually turn out to be the tension in the chain.
Now the calculus of variations trick. What weβre going to do is to say that is stationary with respect to first-order variations in , , and . This is exactly the same βstationary to first orderβ trick that works for minimization of functions, here played on this integral. Letβs set , , and and catch the first order terms. We get
and a bit of staring reveals that weβve got and terms that we donβt know what to do with. So we need to get rid of them. Fortunately we remember that we can integrate by parts to get
The endpoint terms go away because we require β the chain is fixed at its start and end and our variations and must respect that.
Differential equations for fun and profit
Our variational terms are otherwise arbitrary, so if we want first-order variations to be zero (i.e. stationary energy) we get
Weβll impose the conditions , , , so that our string hangs between and . Integrating the first two equations we get
in which and are constants of integration2. Now we substitute into the arc length constraint to get
and therefore3
giving
We are almost home and dry:
Make the change of variable to get , which we rewrite as
Continuing on our merry way we find and
We get by solving ; the simplest way to do this is to let and solve . Reassuringly, we see there is no solution if . A perhaps slightly surprising result is that the shape does not depend on or β all heavy chains hang the same way. (This is in fact not surprising: by redefining we can factor out of our Lagrangian.)
(Some years ago those nice guys Vella, Metcalfe, and Whittaker did something very much like this for floating rafts.)
Where this goes
Honestly, lots of places. One route ends up in Serious Numerical Analysis β the finite element methods that are the standard PDE solvers for solid mechanics and the Sobolev spaces that are the mathematical theory thereof4. Another route ends up in the very beautiful Lagrangian and Hamiltonian formulations of physics.
And one trivial and irrelevant byway that second route goes down is symplectic geometry, where you learn that the iteration
exactly preserves the 2-form . And that is the reason that Hamiltonian Monte Carlo methods are so effective, linking us neatly back to my usual beat5. Maths⦠gotta know it all.
- 1If I was a real man I would use , but we will in fact get the same differential equations back from our version.
- 2I have been cunning and scaled the constants appropriately because I know how this is going to go.
- 3There is a choice of sign here: our optimization has two solutions β a maximum in which the chain goes up and a minimum in which the chain goes down. We want the minimum and have chosen the positive square root, and, slight subtlety, this means that .
4If you try solving our problem this way, note that our Lagrangian integral needs and to have square integrable derivatives, and just has to be integrable. The simplest way of doing this is to let and be piecewise linear, and be piecewise constant. Youβll find (once you factor out of )
which you solve on with , , probably by using Newton iteration from some initial guess (the linear algebra is sparse).
- 5When the AI folk start muttering about βhidden structure on the latent manifoldβ I feel a strong urge to describe HMC as βiterated stochastic symplectic transformations on the cotangent bundle of the latent manifoldβ.