In this notebook I’m going to walk through a really neat problem pointed out to me by Dylan Madisetti and use it as an excuse to talk at moderate length about Jacobi elliptic functions!
The problem is as follows:
Question: From the fantastical land of Central Earth comes a physics riddle that will break down your doors:
In an effort to break open the gates of the city Tinas Mirith, an army of orcs first tried using a battering ram, but to no avail. They next erected a 100-foot pole with a very massive weight at the top (i.e., the weight is much, much heavier than the rest of the pole). The pole is also anchored at the bottom, so that as the weight falls the entire pole rotates around its bottom without slipping.
How far away should the orcs position the vertical pole from the gates so that when the weight comes crashing down on the gates, its horizontal speed is as great as possible?
The easiest way to think of this is as a simple gravity pendulum with a rigid, massless bar, and which starts at the unstable equilibrium directly above the pivot before being slightly disturbed and falling. Then our goal is to find the point at which it reaches the maximum horizontal velocity on its way down.
This problem may be solved with a straightforward energy argument, but let’s brute force it from the equations of motion instead! This is essentially a Calculus I problem: compute the horizontal position as a function of time, then differentiate twice and compute the zeros to determine the time at which velocity is maximized. Then plug the computed time back in to determine the position.
Now I just want to be clear; what you’ll find in this notebook is a bad approach. A basic energy argument turns this problem into a couple lines of algebra. Energy arguments often simplify problems dramatically. Use them. Love them. See, for example, Josh Silverman’s solution, Speedy Hammer.
But let’s disregard this advice and start off our brute force solution by considering our pendulum. The force diagram below illustrates the problem setup. Parameter parameterizes the kinetic energy of the pendulum, from rest () to a pendulum with exactly enough energy to start at the bottom and come to rest at the top ().
Upon working out forces in the above diagram, the governing equation of motion for a simple gravity pendulum is
Although we call it a “simple” gravity pendulum, we sort of have the sense that a pendulum is only really simple in the linear regime at the bottom where and the solution is just a sine wave. Once the swing gets large, the simplicity goes away. The pendulum may even get totally stuck at the top. At least in any class I ever took, we throw our hands up in frustration and look the other way.
However we can represent the solution exactly, just not with the functions we’re probably most familiar with. The solution of the above equation can be expressed as
Here, is the Jacobi elliptic function with . Unfortunately we have a bit too much work ahead of us to work through the derivation of this solution and subsequent discovery of elliptic functions, but that needn’t stop us from using it. (It’s actually quite an interesting story. If we throw our usual differential equation tools at it, we find that we quite accidentally solve for time as a function of position rather than position as a function of time, and it takes a bit of work to rectify the situation!)
The use of Jacobi elliptic functions requires an extra word or two. There are three Jacobi elliptic functions, and They take argument and parameter . They are similar in behavior to the trigonometric functions, and in fact for reduce to them:
This shouldn’t be too surprising since in the small-displacement linear regime, a pendulum oscillates as a plain old sine wave. On the other end of the spectrum for ,
Recall that So in this sense they sort of interpolate between the trigonometric and hyperbolic functions. Very cool. See Jacobi Elliptic Functions in the Complex Plane for an even lovelier view of how this generalization works.
So we’ve succeeded in writing down the solution, but transcendental functions aren’t inherently interesting. We can take any old problem for which we can’t express a closed form solution and, as long as we can somehow express its solution, assign it a name and deem it a function. I mean that’s how sine and cosine work, right? Such functions only become interesting when they solve a variety of problems and open the door to new insights. To that end, the Jacobi elliptic functions are very interesting.
The Jacobi elliptic functions solve a wide variety of problems, from number theory to astrodynamics. They have half-angle formulas, double-angle formulas, addition formulas, and many more relationships. It’s a deep rabbit hole. In this notebook we’ll stick to what we need, starting with the trigonometry-like identities,
As is customary when unambiguous, I’ve omitted the parameters, writing in place of and so forth.
They also have nice trigonometry-like derivatives,
Returning to the equation of motion of the pendulum, for simplicity we’ll write the elliptic function term as
rescaling time to write and with the dependence on implied. Then the trajectory of the pendulum is given by
Let’s plot it!
Note that as approaches , the period diverges to infinity. This just reflects the fact that if the pendulum (asymptotically) makes it all the way to the top, , it takes forever to get there, equivalent to an infinitely long period.
So our goal is to compute the horizontal component of the velocity, then maximize it. Using trig identities and above elliptic function identities we can simplify
A promising start! Differentiating to find the horizontal velocity, we find
To maximize this horizontal velocity, we differentiate once more, yielding
It’s still not intractable! The plot below shows the horizontal position along with its first and second derivatives. Recall that the extrema of a function correspond to zeros of its derivative, thus the horizontal velocity extrema correspond to zeros of the third plot.
It’s not lost on me that our pendulum so far starts at the bottom of its swing with nonzero velocity, when what the orcs want is for it to start at the top of its swing with zero velocity. Fortunately, we can consider when the pendulum starts at the bottom and has exactly enough energy to approach unstable equilibrium at the top of the swing and come to a rest. We simply consider the same motion in reverse. Mathematically speaking it then takes an infinite amount of time for the pendulum to move away from its initial unstable equilibrium at the top of its swing, though realistically it would of course only take the tiniest push to get things started. The time of maximum velocity is not requested, so we thus set and continue our goal of finding the maximum horizontal velocity.
We’ve fought this for a long time, but to make further progress, we must finally start to simplify. We substitute , therefore replacing Jacobi elliptic functions with hyperbolic functions using the above identities
The second derivative is thus
The situation looks grim, so we pull on the most tenuous of threads by setting this equal to zero and factoring into
Seizing upon the last term (and recalling = “”), the most likely candidate for an interesting horizontal velocity extremum looks like
Using the inverse hyperbolic cosine , we have
Let’s plot in terms of scaled time to see if this looks plausible.
const u_max = Math.log(Math.sqrt(6) + Math.sqrt(5))
Success! That looks like an extremum in the horizontal velocity! And so we arrive at the endgame. At last, we plug scaled time into the equation for to compute the angle at which the horizontal velocity is maximized. For , the equation of motion is
Then substituting
This is the angle at which we reach maximum horizontal velocity. To compute the horizontal component of position, we multiply by and take the sine, applying along the way the double angle formula .
This is the horizontal distance from the pivot to the mass when the mass reaches its maximum horizontal velocity. This is also therefore the distance from the gates at which we—er, the orcs—should place the pivot of the pole. Substituting some numbers, we get
Success! I think it’s kinda remarkable that after all this math, we actually manage to get a closed form solution. Let us only hope that some day the orcs and their hundred foot pole adopt the metric system. And that we find a job which doesn’t involve consulting for orcs.