# Lagrangian of a 2D double pendulum system with a spring In the figure above (please excuse my Picasso drawing skills), we have the general 2D double pendulum system with a slight modification, there's a spring connecting the masses instead of the usual wire.

A few statements on the system:

• The wire connecting $m_1$ to the pivot point is massless and has a fixed length $l$.
• The spring connecting $m_1$ and $m_2$ is massless, has a constant $k$, an unstretched length $l_0$ and can only extend/contract in the $m_1$-$m_2$ direction, here called $r$.
• The angles of $m_1$ and $m_2$ with respect to the $y$-axis are $\theta$ and $\phi$, respectively.
• There's no friction involved.

Now, I've considered using $(r, \theta, \phi)$ as my generalized coordinates, however, I'm not so sure if $r$ should really be one of them. The cartesian coordinates would relate to them as

$$\left \{ \begin{array}{lcl}x_1 = l \sin \theta \\ x_2 = l \sin \theta + r \sin \phi \\ y_1 = l \cos \theta \\ y_2 = l \cos \theta + r \cos \phi \end{array} \right.$$

I believe that is pretty straight forward. Now, the lagrangian would be

$$L = T - U = \left \{ \frac{1}{2}m_1 \left(\dot{x}_1^2 + \dot{y}_1^2 \right) - m_1gy_1 \right \} + \left \{ \frac{1}{2}m_2 \left(\dot{x}_2^2 + \dot{y}_2^2 \right) - m_2gy_2 \right \} - \frac{1}{2}k r^2$$

And if we rewrite this lagrangian in terms of our generalized coordinates $(r,\theta, \phi)$ we get, after some algebra,

$$L = \Bigg\{ \frac{1}{2}l^2 \dot \theta^2 \left(m_1 + m_2 \right) + \frac{1}{2}m_2 \dot r^2 + \frac{1}{2}m_2 r^2 \dot \phi^2 \\ + m_2 l \dot r \dot \theta \sin \left( \theta - \phi \right) + m_2 l \dot r \dot \theta \dot \phi \cos \left( \theta - \phi \right) \\ -gl \cos \theta \left( m_1 + m_2\right) +m_2gr \cos \phi - \frac{1}{2} kr^2 \Bigg\}$$

Which is precisely reminiscent of the lagrangian for the general case, as seen in (9) here, with two modifications:

• there's a spring of length $r$ connecting the masses instead of another fixed length wire.
• there's an additional potential energy $\frac{1}{2}kr^2$ due to the spring.

My question is:

1. Is $r$ really a generalized coordinate or can it be expressed in terms of the angles alone, and if so how?

I haven't done the calculation by myself but as far as I can tell you have forgotten to take the derivative of $r$ when you wrote $\dot x_2^2$ since $r$ is a variable (it contracts and stretches) you have to have something like:

$$\dot x_2= \dot r \sin \phi + \cdots$$

I don't know whether these terms cancel out but my intuition is that they shouldn't.

Think of it this way. If I gave you the $\phi,\theta$ as initial conditions can you tell me what $r$ should be? You obviously cannot because you don't know how much I've stretched the spring and since this is the initial state I can do whatever I want. Thus you must have $r$ as a generalised coordinate.

• That makes a lot of sense, I knew there was something missing, but I couldn't really tell what. So it is fair to say $r=r(t)$? My intuiton says $r$ should be something like $r(t) = \dot{\phi} t + l_0$ Oct 15 '16 at 15:51
• well that cannot be the case right? since for that the length of the spring goes to infinity as $t\to \infty$ but apart from that, for $t=0$ you said that the length of the spring should be $l_0$. Why is that maybe I like stretched springs or maybe you like contracted springs (initially). Oct 15 '16 at 15:56
• I prematurely posted the comment, as I was saying, I believe $r$ would depend on the angles as the spring would contract/extend as the pendulum swung, therefore $r$ would also depend on $t$ as you stated, but I suppose to straightforward claim it would depend on $\dot{\phi}$ alone as I previously commented wouldn't be entirely correct. Oct 15 '16 at 15:57
• I usually like to count the degrees of freedom from initial conditions. Since if it were the case that $r = f(\theta, \phi, \dots)$ then this should also hold for the initial conditions. Namely for $t=0$ but given any $\theta$ and $\phi$ I can choose any $r$ I want. Thus you cannot express $r$ in terms of $\theta,\phi, \dots$ Oct 15 '16 at 16:00
• Note that you can also specify $\dot \theta$ etc. for initial conditions. Oct 15 '16 at 16:01