Plane pendulum: Lagrangian, Hamiltonian and energy conservation

hicetnunc
Messages
13
Reaction score
5
Homework Statement
Consider a plane pendulum of mass m and string length s. After the pendulum is set into motion, the length of the string is shortened at a constant rate. The suspension point remains fixed. Compute the Lagrangian and Hamiltonian functions. Is energy conserved?
Relevant Equations
Equation for the Hamiltonian
Hello!

I need some help with this problem. I've solved most of it, but I need some help with the Hamiltonian. I will run through the problem as I've solved it, but it's the Hamiltonian at the end that gives me trouble.

pendulum.png

To find the Lagrangian, start by finding the x- and y-positions of the mass and their velocities (keeping in mind that s is not constant):
\begin{align*}
x=&s\sin(\theta)\\
y=&s\cos(\theta)\\
\\
\dot{x}=&\dot{s}\sin(\theta)+s\dot{\theta}\cos{\theta}\\
\dot{y}=&\dot{s}\cos(\theta)-s\dot{\theta}\sin{\theta}
\end{align*}
Then, the kinetic and potential energies of the system are
\begin{align*}
T=&\frac{1}{2}m(\dot{x}^2+\dot{y}^2)=\frac{1}{2}m(\dot{s}^2+s^2\dot{\theta}^2)\\
U=&-mgs\cos{\theta}
\end{align*}
and the Lagrangian will be
\begin{align*}
L=T-U=\frac{1}{2}m(\dot{s}^2+s^2\dot{\theta}^2)+mgs\cos{\theta}
\end{align*}
So far, so good. My solution agrees with the answer sheet I have. But, to calculate the Hamiltonian I use the equations
\begin{align*}
H=&\sum_{v}p_v\dot{q}_v-L\\
p_v=&\frac{\partial L}{\partial \dot{q}_v}
\end{align*}
where the factors in the sum are the generalized momentum and generalized coordinates, respectively. From this, I get the equation
\begin{align*}
H=&\frac{\partial L}{\partial \dot{\theta}}\dot{\theta}+\frac{\partial L}{\partial \dot{s}}\dot{s}-L\\
=&\frac{1}{2}m(\dot{s}^2+s^2\dot{\theta}^2)-mgs\cos{\theta}
\end{align*}
But this expression for the Hamiltonian is wrong! After some troubleshooting I find that if I drop the term
\begin{align*}
\frac{\partial L}{\partial \dot{s}}\dot{s}
\end{align*}
from the Hamiltonian, I get the correct answer. But why? The system needs both the coordinates theta and s to define it. Looking further at energy conservation of the system I see that in my (incorrect) solution, the Hamiltonian is expressable by T+U, and therefore energy would be conserved. But I can reason that this shouldn't be the case: Consider a small (negligible) initial angle theta and large initial string length s. Then, as time progresses, T won't change by much, but U will. Thus energy is not conserved (the answer sheet gives the reason that work is performed on the system). Why shouldn't the term above be included in the Hamiltonian?
 
  • Like
Likes PhDeezNutz
Physics news on Phys.org
I don't think ##s## is a degree of freedom. You don't have to determine its motion since it's already given to you. It says shortened at a constant rate so it's something like ##s \sim \alpha t##. And because you don't have to determine its motion it should not be an independent variable in your Lagrangian or Hamiltonian. This is why you emit the ##\frac{\partial L}{\partial \dot{s}} \dot{s}## term.That's my take on it.

You just have to be mindful at the end of everything ## s = - \alpha t## and it's not constant (however ##\dot{s}## is).
 
Last edited:
  • Like
Likes hicetnunc
Actually it should be included in your Lagrangian as ##s = - \alpha t##.

But you don't have to take derivatives with respect to it since it's already constrained as given to you.
 
  • Like
Likes hicetnunc
PhDeezNutz said:
Actually it should be included in your Lagrangian as ##s = - \alpha t##.

But you don't have to take derivatives with respect to it since it's already constrained as given to you.
Ok, so using ##s = -\alpha t## to rewrite the Lagrangian as ##L = \frac{1}{2} m(\alpha^2 + \alpha^2 t^2 \dot{\theta}^2)## makes ##s## disappear from the equation and makes it only dependent on time and ##\dot{\theta}##. And then ##\theta## becomes the only coordinate to use in the equation for the Hamiltonian.

Great! Thanks a lot!

Also, thanks for showing me how to insert latex notation inside text. Couldn't figure that out while writing the post. :)
 
  • Like
Likes PhDeezNutz
If it's any consolation I messed up on this question about a few years back in class. My professor asked "how many degrees of freedom this does this system have?" for the very same problem you presented in the OP. I naively also thought it was two degrees of freedom.

Keep doing the problem and show us what you get. Keep in mind when calculating the Hamiltonian that the Hamiltonian is not a function of ##q## and ##\dot{q}## it's a function of ##q## and ##p## so you once you compute it it in ##q## and ##\dot{q}## you have to convert.
 
  • Haha
Likes hicetnunc
PhDeezNutz said:
Keep doing the problem and show us what you get. Keep in mind when calculating the Hamiltonian that the Hamiltonian is not a function of ##q## and ##\dot{q}## it's a function of ##q## and ##p## so you once you compute it it in ##q## and ##\dot{q}## you have to convert.
Alright, here goes. To recap: ##s = -\alpha t##, giving ##L = \frac{1}{2} m (\alpha^2 + \alpha^2 t^2 \dot{\theta}^2) - m g \alpha t \cos{\theta}##. Then the Hamiltonian becomes:
\begin{align*}
H =&\ \frac{\partial L}{\partial \dot{\theta}} \dot{\theta} - L\\
=&\ m \alpha^2 t^2 \dot{\theta}^2 - \frac{1}{2} m (\alpha^2 + \alpha^2 t^2 \dot{\theta}^2) + m g \alpha t \cos{\theta}\\
=&\ \frac{1}{2} m \alpha^2 t^2 \dot{\theta}^2 - \frac{1}{2} m \alpha^2 + m g \alpha t \cos{\theta}
\end{align*}
Considering that ##p_\theta = \frac{\partial L}{\partial \dot{\theta}} = m \alpha^2 t^2 \dot{\theta}##, ##H## can be rewritten as
\begin{align*}
H =&\ \frac{p_\theta^2}{2 m \alpha^2 t^2} - \frac{1}{2} m \alpha^2 + m g \alpha t \cos{\theta}\\
=&\ \frac{p_\theta^2}{2 m s^2} - \frac{1}{2} m \alpha^2 -m g s \cos{\theta}
\end{align*}
and this agrees with my answer sheet (last expression with ##s## is the actual answer given). Comparing with the total energy:
\begin{align*}
T+U =&\ \frac{1}{2} m (\alpha^2 + \alpha^2 t^2 \dot{\theta}^2) + m g \alpha t \cos{\theta}\\
=&\ \frac{p_\theta^2}{2 m s^2} + \frac{1}{2} m \alpha^2 - m g s \cos{\theta}
\end{align*}
and total energy is not conserved, as should be.

Did an oopsie and posted mid-edit, oh well.

Thanks for all the help!
 
  • Like
Likes PhDeezNutz
That looks good to me!
 
  • Like
Likes hicetnunc
Back
Top