Translating Pendulum
Translating Pendulum
Translating Pendulum
In this note we will derive the equations of motion for a compound pendulum being driven by external motion
at the center of rotation. A compound pendulum is a pendulum consisting of a single rigid body rotating around a
fixed axis. In contrast to the simple pendulum we studied in class, a compound pendulum can have an arbitrary
distribution of mass, which means that it better models real-world objects. In the context of our animation tool, it
means that the shape and size of each joint will have an effect on the dynamics of our character. The fact that the
pendulum is moving means that we can have pendulums hanging from our character (e.g., feathers, scales, or
other gadgets).
Let’s first review our procedure for deriving equations of motion using Lagrangian mechanics. For any system
described by a configuration q and velocity q̇ in generalized coordinates, we can take the following approach:
• The equations of motion can then be found by plugging L into the Euler-Lagrange equations
d ∂L ∂L
= .
d t ∂ q̇ ∂q
2 Basic Pendulum
Consider a pendulum of length L with mass m concentrated at its endpoint, whose configuration is completely
determined by the angle θ made with the vertical, and whose velocity is the corresponding angular velocity θ̇ .
Recall that the kinetic energy of any system is one-half the mass times the velocity squared. Suppose we use y to
denote the endpoint of the pendulum, and let ẏ denote the corresponding linear velocity. Then the kinetic energy
1
is
K = 21 m| ẏ|2 ,
where | · | denotes the usual Euclidean norm. We would now like to express the kinetic energy in terms of our
original angular velocity θ̇ . What is the relationship between linear and angular velocity? To answer this question,
we can first ask ourselves,
How far does the endpoint move if the pendulum makes one full revolution?
The answer, of course, is that it moves around the circumference of a circle of radius L, i.e., it moves along a linear
distance 2πL. So then what’s the amount of angular distance traveled relative to the amount of linear distance?
I.e., how far does y move for a given change in θ ? Well, we move a distance 2πL for every 2π change in angle,
which means the amount of linear motion per angle is
2πL/2π = L.
In other words, if we double the length of our pendulum, the endpoint will move twice as fast (for the same speed
of rotation). This makes sense, because the circumference of the circle is linear in the length of the bar. Thus, the
relationship between linear and angular speed is
| ẏ| = |L θ̇ |.
Returning to our kinetic energy, that means we have
K = 12 m|L θ̇ |2 = 12 mL 2 θ̇ 2 .
This formula may look familiar: the quantity I := mL 2 is sometimes referred to as the moment of inertia for a
point mass, and if we use the variable ω := θ̇ to denote the angular velocity, then we get the usual expression for
the kinetic energy of a rotating point mass: K = 12 Iω2 . (Note, however, that we are not making an “appeal to
authority” here—we really just derived this formula for ourselves, from scratch! Not too hard, right?) This line of
thinking will come in handy later, when we derive the equations of motion for a compound pendulum.
There are many different sources of potential energy, but for our pendulum we will be concerned only with the
influence of gravity. The gravitational potential energy for any point mass is
U = mgh,
where the constant g is the acceleration due to gravity, and h is the height relative to some fixed “ground,” though
it does not matter where this “ground” is—as we will see in a moment, we are going to take the derivative of this
quantity, hence any constant we add or subtract will make absolutely no difference.
So, what is the height h for the endpoint of our pendulum? If we assume that the center of rotation is at the
origin (h = 0), then the height of the endpoint is
h = −L cos(θ ).
Let’s do some quick sanity checks to make sure we got this expression right: if θ = 0, i.e., the pendulum is hanging
straight down, then −L cos(θ ) = −L cos(0) = −L(1) − L, i.e., the endpoint is at a distance L below the ground.
Great. And if θ = π, i.e., the pendulum is pointing straight up, then −L cos(θ ) = −L cos(π) = −L(−1) = L, i.e.,
the endpoint is at a distance L above the ground. Finally, if θ = π/2, i.e., the pendulum is sticking out to the right,
then −L cos(θ ) = −L cos(π/2) = −L(0) = 0, i.e., the endpoint is also sitting right along the ground. Perfect. So,
we can write our gravitational potential energy as
U = mgh = −mg L cos(θ ).
This line of thinking will also come in handy when we consider a general compound pendulum.
2
2.3 Lagrangian
Using the kinetic and potential energies derived above, we find that our Lagrangian can be expressed explicitly in
terms of the angle θ and the angular velocity θ̇ via
L = K − U = 12 mL 2 θ̇ 2 + mg L cos(θ ).
The only other variables in this equation are constants: the mass m, the length L, and the gravitational acceleration
g. It is important to get our Lagrangian in this form, so that we can easily differentiate it once we plug it into the
Euler-Lagrange equations.
It is perhaps worth stopping here to note a remarkable fact: the entire dynamical behavior of our pendulum
has been boiled down into a single scalar function, the Lagrangian, which takes as input the current position
and velocity, and splits out a number. In fact, almost any conservative system (i.e., system that does not gain or
lose energy) can be formulated this way: as a scalar function on positions and velocities, and one can then very
easily move to the corresponding equations of motion via the Euler-Lagrange equations. Moreover, by analyzing
symmetries of the Lagrangian (i.e., changes of coordinates that do not change its value), one can easily deduce
properties of the mechanical system like conservation of energy, conservation of momentum, etc. On the whole,
these questions are the focus of Lagrangian mechanics, and can provide a rather powerful perspective when
developing numerical simulation algorithms both from a systems perspective (i.e., many different systems can be
formally encoded and manipulated using one unified representation), and from a numerical analysis point of view
(in particular, it becomes reasonably easy to develop integrators that conserve energy and momentum, as we saw
in class with symplectic Euler).
Now that we have our Lagrangian L, we can derive the equations of motion via a completely mechanical procedure,
i.e., by taking derivatives with respect to the configuration, velocity, and time.1 The derivative with respect to the
configuration θ is
∂L ∂ 1 ∂
= mL 2 θ̇ 2 + mg L cos(θ ) = 0 + mg L cos(θ ) = −mg L sin(θ ).
∂θ ∂θ 2 ∂θ
The derivative with respect to the velocity θ̇ is
∂L ∂ 1 ∂
= mL 2 θ̇ 2 + mg L cos(θ ) = 21 mL 2 (θ̇ 2 ) = mL 2 θ̇ ,
∂ θ̇ ∂ θ̇ 2
∂ θ̇
and the time derivative of this expression is
d ∂L d
= mL 2 θ̇ = mL 2 θ̈ .
d t ∂ θ̇ dt
Putting it all together, our Euler-Lagrange equations
d ∂L ∂L
= .
d t ∂ q̇ ∂q
become
mL 2 θ̈ = −mg L sin(θ ),
or equivalently,
θ̈ = −g sin(θ )/L.
(This is the same equation we derived in class.)
1
Here, for instance, one could imagine designing an animation system that allows a user to simply describe a purely in terms of various
potentials, automatically performing symbolic differentiation to get the equations of motion.
3
3 Moving Pendulum
Suppose now that our pendulum is no longer rotating around a fixed point x, but that this point itself is translating,
i.e., x is a function of time x(t), and has an associated velocity ẋ(t) := ddt x(t). We will still let y denote the
position of the rotating endpoint relative to the current center of rotation x, so that at all times |x − y| = L. This
system is a bit more fun than the previous one, because we can get the pendulum to move by “shaking it around.”
In our animation tool, for instance, we can attach pendulums to joints of our character. How exactly do the
equations of motion change? Let’s find out.
4 Kinetic Energy
As before, kinetic energy is one-half the mass times the (linear) velocity squared. If the whole pendulum is moving,
and its endpoint is swinging, what’s the velocity v at the endpoint? It’s nothing more than
v = ẋ + ẏ.
In other words, it’s the sum of the motion at the endpoint with the overall motion. Then kinetic energy then
becomes
K = 21 m|v|2 = 21 m|ẋ + ẏ|2 .
Now here’s a very useful fact: the squared norm of a vector is the same as its inner product with itself. I.e., if u is
any vector, then
|u|2 = 〈u, u〉,
where 〈·, ·〉 denotes the inner product. (Do you believe it? If not, try writing this relationship out in components
u = (u1 , u2 ), using the standard Euclidean dot product.) Therefore, we can expand the final term in the kinetic
energy as
|ẋ + ẏ|2 = 〈ẋ + ẏ, ẋ + ẏ〉 = 〈ẋ, ẋ〉 + 〈ẋ, ẏ〉 + 〈 ẏ, ẋ〉 + 〈 ẏ, ẏ〉 = |ẋ|2 + 2〈ẋ, ẏ〉 + | ẏ|2 .
(Can you explain to yourself why the inner product of two vectors is symmetric, i.e., why we’re allowed to swap
the order of ẋ and ẏ? You could write it out in coordinates; you could also just think about what an inner product
means geometrically, in terms of the lengths and angles of the vectors. Likewise, why does the inner product
distribute over addition? Can you explain this fact geometrically, or can you only do by expanding the expression
into individual components?)
where in the final step we used a result from our analysis of the stationary pendulum (| ẏ|2 = L 2 θ̇ 2 ).
Earlier, we investigated the relationship between linear and angular speed, and discovered that | ẏ| = L|θ̇ |, i.e.,
that linear speed is just angular speed times the length of the bar (or equivalently, the radius of the circle). Here,
it will also be useful to understand the relationship between linear and angular velocity, i.e., in what direction does
y move as a result of changing θ ? Geometrically, the relationship is actually pretty clear: y is moving around in a
circle, so the velocity ẏ must be tangent to the circle; otherwise, y would necessarily fly off of the circle! And for
any point y on a circle, the tangent direction is just the orthogonal direction, which we can denote by y ⊥ ; here we
have to be careful about orientation: by convention, we will say that y ⊥ denotes a counter-clockwise rotation by a
quarter-turn (π/2 radians, or 90 degrees). Hence, the vector
y⊥ y⊥ y⊥
= =
| y ⊥| | y| L
4
is a unit vector tangent to the circle, i.e., it points in the direction of the linear velocity, but may not have the right
magnitude. Of course, we already know the magnitude: it’s the speed | ẏ| = L|θ̇ |. So, being careful to note that y ⊥
points in the counter-clockwise direction, we get
y⊥ y⊥
ẏ = L θ̇ = L θ̇ = θ̇ y ⊥ .
| y ⊥| L
ẏ = θ̇ y ⊥ ,
the linear velocity vector is just the position rotated by 90 degrees, times the angular velocity. Great2 .
Plugging this relationship back into our expression for kinetic energy, we get
1
K = 21 m |ẋ|2 + 2L θ̇ 〈ẋ, y ⊥ 〉 + L 2 θ̇ 2 = m |ẋ|2 + 2L θ̇ 〈ẋ, (cos(θ ), sin(θ ))〉 + L 2 θ̇ 2 .
2
The only reason for writing out the final expression in terms of cos(θ ) and sin(θ ) is that it makes it extremely
clear where and how K depends on the configuration θ and the velocity θ̇ . But if you are geometrically minded
(and careful), you can often avoid writing everything out long-hand like this. Alternatively, you might use the
complex expressions y = Le ıθ and y ⊥ = ı y, which are a bit more compact. In summary, we have
K = 21 m |ẋ|2 + 2θ̇ 〈ẋ, y ⊥ 〉 + L 2 θ̇ 2 ,
or equivalently,
1
K= m |ẋ|2 + 2L θ̇ 〈ẋ, (cos(θ ), sin(θ ))〉 + L 2 θ̇ 2 ,
2
or equivalently,
1
m |ẋ|2 + 2L θ̇ 〈ẋ, e ı(θ +π/2) )〉 + L 2 θ̇ 2 ,
K=
2
depending on how you like to work with vectors in the plane (as vectors, in terms of components, or using complex
numbers, respectively). We will keep working with the first expression, which is perhaps the most succinct.
How about the potential energy? Our height above the plane is no longer determined just by the angle θ , but also
by the height associated with the center of rotation x, which we will denote as simply h(x). (Again, if you prefer
coordinates you could say that x = (x 1 , x 2 ), in which case h(x) = x 2 . But in general, we’ll encourage you to do
your calculations without resorting to coordinates wherever possible.) Overall, then, the gravitational potential
energy is
U = mgh = mg(h(x) + h( y)) = mg(h(x) − L cos(θ )).
This time, really not much different from the stationary case: the potential energy just increases by a term mgh(x),
describing how far the center of the rotation is “off the ground.” As we’ll see in a moment, this extra term won’t
affect our equations of motion at all because when we differentiate the Lagrangian in terms of the configuration θ
and the velocity θ̇ , this term will disappear entirely.
2
If you really like working with explicit coordinates, you can also work this relationship out by writing y = L(cos(θ ), sin(θ )) and taking a
time derivative. Not surprisingly, you get the same result: ddt y = L θ̇ (− sin(θ ), cos(θ )) = θ̇ y ⊥ . You could also write it out in terms of complex
numbers: if y = Le ıθ , then ddt y = L θ̇ ıe ıθ = θ̇ y ⊥ , since the complex unit ı is just a rotation by a quarter-turn in the counter-clockwise direction.
As you can see, there are often many different ways to do it—though if you can reason geometrically you can often avoid grinding through a
lot of extra algebra, trigonometry, etc.
5
4.2 Lagrangian
Taking the difference between kinetic and potential energy yields the Lagrangian for our moving pendulum
L = K − U = 12 m |ẋ|2 + 2θ̇ 〈ẋ, y ⊥ 〉 + L 2 θ̇ 2 − mg(h(x) − L cos(θ )).
A bit more complicated than for our stationary pendulum, but not unmanageable. Let’s see how these changes to
the Lagrangian affect our equations of motion.
What’s the derivative of our Lagrangian with respect to the configuration θ ? Well, L has two terms that depend on
θ : one coming from the kinetic energy (mθ̇ 〈ẋ, y ⊥ 〉), and one coming from the potential energy (mg L cos(θ )).
Remember that y ⊥ depends on θ : it is the position of y, rotated by 90 degrees. And what’s the derivative of y ⊥
with respect to θ ? No big surprise: we rotate it again by 90 degrees, yielding
∂
∂θ
y ⊥ = − y.
or equivalently,
θ̈ = −〈ẍ, y ⊥ 〉/L 2 − g sin(θ )/L.
Here we can do a sanity check to make sure we got the right answer. First, if the pendulum isn’t moving then we
have no acceleration (ẍ = 0) and recover the same equations of motion as we did for the stationary pendulum.
Second, we can check the units on the new term: ẍ has units of meters per second squared; y ⊥ has units of meters,
and L 2 has units of meters squared. Overall, then we get units of 1/s2 , which is exactly what we should have for
angular acceleration since angles are unitless.
6
5 Compound Pendulum
So far our pendulum takes into account the effects of gravity and motion, but we do not have a particularly
realistic model of mass or inertia, i.e., we haven’t taken into account the specific shape or size of the swinging
object. For the moment, let’s again assume that the pendulum is just swinging around the origin (rather than a
moving point x(t)). Let Ω ⊂ R2 denote the shape of the swinging body, and let ρ : Ω → R denote its mass density.
Then the total mass m of the body is just the integral of its mass density:
Z
m= ρ(p) d p.
Ω
Finally, the moment of inertia I is the total moment of inertia of all point masses comprising the body (which we
considered for our original pendulum equation):
Z Z
I= ρ(p)L(p)2 d p = ρ(p)|p|2 d p,
Ω Ω
i.e., the “length” L from our point mass moment of inertia gets replaced by the distance to the origin |p|. In
general, the moment of inertia for a general rigid body can be very tricky to compute—but at the end of the day,
it still boils down to a single constant (in 2D). For your animation tool, we have already taken the trouble to
compute the moments of inertia for basic shapes like rectangles, ellipses, polygons, etc., assuming a constant mass
density ρ = 1. Note that you do not have to derive these expressions yourself! On the other hand, these formulas
are not too hard to derive: just take the expression above and plug in the specific geometry of your shape. If
the shape is simple enough, you can usually find a nice closed-form expression. Otherwise, you might have to
approximate the moment of inertia using numerical quadrature (as we discussed in our lecture on Monte Carlo
integration).
For a compound pendulum, we can get the total kinetic energy by integrating the kinetic energy of each point
mass over the entire body: Z Z
1 1
K= 2
ρ| ẏ|2 d p = 2
ρ|p|2 θ̇ 2 d p.
Ω Ω
Of course, since the body is rigid, the angular velocity θ̇ is the same at every point and we can simply pull it out of
the integral: Z
K = 12 θ̇ 2 ρ|p|2 d p = 12 I θ̇ 2 .
Ω
1
(Once again, the famous “K = 2
Iω2 ” appears. Starting to see where this formula comes from?)
The gravitational potential energy is likewise the integral of the gravitational potential of each particle:
Z Z
U= ρ gh(p) d p = g ρh(p) d p.
Ω Ω
7
Notice, then, that U is actually just the height h of the center of mass, up to a constant factor mg:
U = mgh(c).
Also, since rotating the body by an angle θ simply rotates its center of mass by θ (why?), the gravitational
potential of the rotated body is just g times the height of the rotated center:
U = mgh(e ıθ c).
5.3 Lagrangian
where again e ı(θ +π/2) means “rotate the center of mass by θ + π/2 radians in the counter-clockwise direction,”
and h(·) just extracts the vertical coordinate of the rotated vector (the “height”).
We can do a sanity check here by making sure this result agrees with our result for the simple pendulum. There,
the center of mass was at c = L(sin(θ ), − cos(θ )), and a rotation by 90 degrees yields L(cos(θ ), sin(θ )). The
moment of inertia was I = mL 2 . Hence, our general Euler-Lagrange equations simplifies to just θ̈ = −g sin(θ )/L,
as before.
One interesting thing to consider here is an object that does not have mirror symmetry across the vertical axis.
In this case the original (“un-rotated”) center of mass will not have a horizontal component of zero, and as a result
the height h(e ı(θ +π/2) c) also will not be zero. In other words, the object will accelerate even when θ = 0. But this
makes perfect sense: if the pendulum is heavier on one side than the other, we expect it to swing a little bit before
coming to rest.
8
6 Moving Compound Pendulum
The whole enchilada would be to finally write the equations of motion for a moving compound pendulum,
combining the ideas and techniques above. This derivation can certainly be done, but is strictly harder than
the previous two; in particular, it demands clever application of Stokes’ theorem to resolve a cross term in the
computation of kinetic energy—ambitious students who are well-versed in vector calculus are invited to attack
this derivation as extra credit on Assignment 4. Otherwise, in your assignment you may use the approximate
equations of motion
θ̈ = −〈ẍ, y ⊥ 〉/L 2 − mgh(e ı(θ +π/2) c)/I.
Here the first term comes from our derivation for a simple moving pendulum; the second term comes from our
analysis of a stationary compound pendulum. The only approximation we’re making here is that the acceleration
due to “shaking” the object will not be quite right, because it doesn’t properly account for the shape and size of
the object (instead treating it as a point mass). This approximation is unlikely to be noticed in cartoon animation,
but is unacceptable for engineering applications—in those situations, one should at very least use a computational
differentiation technique (like numerical, automatic, or symbolic differentiation) to get results that quantitatively
approximate the correct answer. These techniques are particularly important in situations where derivatives
cannot be practically computed by hand.