# Spring pendulum

1. May 21, 2010

### fluidistic

1. The problem statement, all variables and given/known data
If I consider a 3 dimensional problem related to a spring pendulum (a mass attached to the end of a spring of constant k and the other end of the spring remains fixed) and I want to find the equations of motion of the mass (for several initial conditions), what system of coordinates would you choose? I'm trying to find the Lagrangian of the system and I chose spherical coordinates to express the position of the mass, its velocity and its kinetic energy. However the expression is really long (5 lines in my draft, I may post what I obtained here if you ask for it), I just wonder if I should have used another coordinate system.
I didn't get any term which canceled out with others. I'm going to redo the arithmetics tomorrow (it's 2 a.m. now) but I don't think I made some error. So is it normal to get an enormous expression for the Lagrangian of the system? Say a roughly 5 times longer Lagrangian than for the common double pendulum system?

2. Relevant equations

3. The attempt at a solution

2. May 22, 2010

### IPhO' 2008

I'm not sure but I think Cartesian coordinate in easier than Spherical coordinate.

3. May 22, 2010

### jdwood983

No, Cartesian coordinates are definitely not the way to go for this spherical pendulum problem.

Consider first the Lagrangian for a spherical pendulum with a rigid (but massless) rod:

$$L=\frac{1}{2}mr^2\left(\dot{\theta}^2+\sin^2\theta\dot{\phi}^2\right)+mgr\cos\theta$$

What would you need to change in this Lagrangian to include a spring?

Last edited: May 22, 2010
4. May 22, 2010

### fluidistic

Thanks to both for the help.
I think I'd need to subtract the potential energy stored within the spring from the Lagrangian you gave. Not sure it is all, but I think it's a good start. What else could I add? Maybe the influence on the velocity of the mass due to the movement of the spring.

Anyway, via my way I reached $$\dot \vec r = \left [ \dot \theta r \cos (\phi) \cos (\theta) + \dot r \sin (\theta) \cos (\phi )- r \dot \phi \sin (\phi) \sin (\theta) \right ] \hat i + \left [ \dot r \sin (\phi) \sin (\theta) + r \dot \phi \cos (\phi ) \sin (\theta ) + r \dot \theta \sin (\phi) \cos (\theta) \right ] \hat j + \left [ \dot r \cos (\theta) - r \dot \theta \sin (\theta) \right ] \hat k$$.
But for the Lagrangian I need the modulus squared of this expression. So I have to sum up each components squared... I got that no term cancel out, you can imagine how large the expression is.

5. May 22, 2010

### jdwood983

Don't forget that

$$\left|\vec{r}\right|^2=\vec{r}\cdot\vec{r}=r_i^2+r_j^2+r_k^2$$

and that

$$r^2\sin^2[\phi]\cos^2[\theta]+r^2\sin^2[\phi]\sin^2[\theta]=r^2\sin^2[\phi]\left(\cos^2[\theta]+\sin^2[\theta]\right)=r^2\sin^2[\phi]$$

There are specifically two terms you would need to add (or subtract) to the Lagrangian I gave to make it work for you (you pointed out one, and using the above, you should figure out the other).

6. May 22, 2010

### fluidistic

Yeah I'm not forgetting. That's why I said "So I have to sum up each components squared..."
Ok perfect, I didn't notice I could use this simplification. I'll be looking for it in the "giant" expression.

7. May 22, 2010

### jdwood983

Now I notice that statement, whoops

When you finish simplifying, you should pat yourself on the back and then memorize that form for the kinetic energy (assuming it is correct), as it is a very common formula in classical mechanics.

8. May 22, 2010

### fluidistic

No problem, your help is very much appreciated.

Ok, good to know. I just want to make sure I'll be memorizing a useful formula instead of an erroneous one!
After a lot of arithmetic and simplification, I reach $$|\vec{r}|^2=r^2 \left [ \dot \theta ^2 \cos ^2 (\theta) + (\dot \phi ^2 + \dot \theta ^2) \sin ^2 (\theta) \right ]+ \dot r ^2 + 2 \sin (\theta) \left { (r^2-1) \dot \theta \dot \phi \cos (\phi) \cos (\theta) \sin (\phi) + r \dot r \dot \theta \cos (\theta) \sin ^2 (\phi) \right }$$.
I doubt it's correct. Do you get something similar?

9. May 22, 2010

### jdwood983

I think you might have made a mistake somewhere. For ease, I'll look at each component individually:

$$\dot{r}_x^2=\dot{\theta}^2r^2\cos^2\phi\cos^2\theta+\dot{r}^2\sin^2\phi\cos^2\theta-r^2\dot{\phi}^2\sin^2\phi\sin^2\theta+2r\dot{r}\sin\theta\cos\theta\cos^2\phi-2r^2\dot{\theta}\dot{\phi}\cos\phi\sin\phi\cos\theta\sin\theta-2r\dot{r}\dot{\phi}\cos\phi\sin\phi\sin^2\theta$$

$$\dot{r}_y^2=\dot{r}^2\sin^2\theta\sin^2\phi+r^2\dot{\phi}^2\cos^2\phi\sin^2\theta+r^2\dot{\theta}^2\sin^2\phi\cos^2\theta+2r\dot{r}\dot{\phi}\cos\phi\sin\phi\sin^2\theta+2r\dot{r}\dot{\theta}\sin\theta\cos\theta\sin^2\phi+2rr^2\dot{\phi}\dot{\theta}\cos\theta\sin\theta\cos\phi\sin\phi$$

$$\dot{r}_z^2=\dot{r}^2\cos^2\theta-r^2\dot{\theta}^2\sin^2\theta-2r\dot{r}\dot{\theta}\sin\theta\cos\theta$$

You can see clearly that a couple terms will cancel. Another three terms will cancel when you use the sine-square plus cosine-square law:

$$2r\dot{r}\dot{\theta}\sin\theta\cos\theta\cos^2\phi+2r\dot{r}\dot{\theta}\sin\theta\cos\theta\sin^2-2r\dot{r}\dot{\theta}\sin\theta\cos\theta=2r\dot{r}\dot{\theta}\sin\theta\cos\theta\left(\cos^2\phi+\sin^2\right)-2r\dot{r}\dot{\theta}\sin\theta\cos\theta=2r\dot{r}\dot{\theta}\sin\theta\cos\theta-2r\dot{r}\dot{\theta}\sin\theta\cos\theta=0$$

This will then reduce your equation to

$$\dot{r}_{x}^{2}=\dot{\theta}^{2}r^{2}\sin^{2}\phi\cos^{2}\theta+\dot{r}^{2}\sin^{2}\phi\cos^{2}\theta-r^{2}\dot{\phi}^{2}\sin^{2}\phi\sin^{2}\theta$$

$$\dot{r}_{y}^{2}=\dot{r}^{2}\sin^{2}\theta\sin^{2}\phi+r^{2}\dot{\phi}^{2}\cos^{2}\phi\sin^{2}\theta+r^{2}\dot{\theta}^{2}\sin^{2}\phi\cos^{2}\theta$$

$$\dot{r}_{z}^{2}=\dot{r}^{2}\cos^{2}\theta-r^{2}\dot{\theta}^{2}\sin^{2}\theta$$

When you add these & simplify, you should get

$$\left|\dot{\vec{r}}\right|^2=\dot{r}^2+r^2\dot{\theta}^2+r^2\dot{\phi}^2\sin^2\theta$$

EDIT: I keep finding more errors each time I look at this (I wasn't too careful about minus signs and keeping my order straight of sines, cosines, thetas, & phis). The last line is correct, you should redo your math and convince yourself that it is because I could be here all night as well fixing my minor mistakes above.

Last edited: May 22, 2010
10. May 22, 2010

### fluidistic

Ok thank you very much for all this (I know how tedious it is to write so much latex and do the math). I'm going to redo the math to see if I can reach your last line.

11. May 22, 2010

### gabbagabbahey

A quicker method to calculating $\dot{\mathbf{r}}$, $(\dot{\mathbf{r}})^2$ and $\ddot{\mathbf{r}}$ in Spherical coordinates is to first calculate the time derivatives of the spherical unit vectors, and then use those results. For example,

\begin{aligned}\frac{d \hat{\mathbf{r}} }{dt} &= \frac{d}{dt} \left( \sin\theta \cos\phi \hat{\mathbf{x}}+\sin\theta \sin\phi \hat{\mathbf{y}}+\cos\theta \hat{\mathbf{z}} \right) \\ &= \left( \cos\theta \cos\phi \hat{\mathbf{x}}+\cos\theta \sin\phi \hat{\mathbf{y}}-\sin\theta \hat{\mathbf{z}} \right)\dot{\theta}+\left( -\sin\theta \sin\phi \hat{\mathbf{x}}+\sin\theta \cos\phi \hat{\mathbf{y}} \right)\dot{\phi} \\ &= \dot{\theta}\hat{\mathbf{\theta}}+\sin\theta\dot{\phi}\hat{\mathbf{\phi}}\end{aligned}

And so

$$\dot{\mathbf{r}}=\frac{d}{dt}\left(r\hat{\mathbf{r}}\right)=\dot{r}\hat{\mathbf{r}}+r\dot{\theta}\hat{\mathbf{\theta}}+r\sin\theta\dot{\phi}\hat{\mathbf{\phi}}$$

12. May 22, 2010

### fluidistic

Hey there . Thanks a lot for this shortcut, I was having a very hard time to simplify the expression I had to reach the answer.
I can understand 3 out of the 5 equal sign of your answer. I don't understand why do the 2nd and 3rd equal sign hold. For the second, it seems you considered the x, y and z unit vectors as constant. For the 3rd equal sign, how do you convert the x, y and z unit vectors into the phi and theta unit vectors?

13. May 22, 2010

### gabbagabbahey

Of course! The only reason that curvilinear unit vectors aren't constant is that they depend on position, which in turn depends on time. The Cartesian unit vectors are position independent.(Draw the spherical unit vectors for two different position vectors $\textbf{r}$, and you will see they point in different directions, while the Cartesian unit vectors remain unchanged)

Simple:

$$\hat{\mathbf{r}}=\sin\theta\cos\phi\hat{\mathbf{x}}+\sin\theta\sin\phi\hat{\mathbf{y}}+\cos\theta\hat{\mathbf{z}}$$

$$\hat{\mathbf{\theta}}=\cos\theta\cos\theta\hat{\mathbf{x}}+\cos\theta\sin\phi\hat{\mathbf{y}}-\sin\theta\hat{\mathbf{z}}$$

and

$$\hat{\mathbf{\phi}}=-\sin\phi\hat{\mathbf{x}}+\cos\phi\hat{\mathbf{y}}$$

14. May 23, 2010

### fluidistic

You're right, I missed those points.
I'll be trying to get the Lagrangian now.

15. May 23, 2010

### fluidistic

Someone correct me if I'm wrong: the Lagrangian of the system is worth $$\frac{m}{2} (\dot r ^2 + r ^2 \dot \theta ^2+ \dot \phi ^2 r ^2 \sin ^2 \theta )+mg \cos \theta +\frac{k}{2} (\Delta r)^2$$.
I'm not sure how to express $$\Delta r$$. I think it is $$\vec r - \vec r_0$$. I already have $$\vec r$$, I need to find out $$r_0$$. In Cartesian's coordinates I'd just take $$\vec r_0=(x_0, y_0, z_0)$$. I'm not sure in spherical coordinates. May I have a bit more of help?
Or maybe it's just $$(r, \phi , \theta)-(r_0, \phi _0 , \theta _0)=(r-r_0 , \phi - \phi _0 , \theta - \theta _0)$$? But I have nothing like the expression I have for $$\vec r$$ expressed with spherical unit vectors.

16. May 23, 2010

### gabbagabbahey

First, the kinetic energy should involve $(\dot{\mathbf{r}})^2$, not just $\dot{\mathbf{r}}$. Second, what is the equilibrium length of the spring?

17. May 23, 2010

### fluidistic

Yes, you're absolutely right, I corrected it a few minutes after I saw I made the error, just before you replied.
I wanted to solve the problem for an arbitrary equilibrium length. But in the problem it is 1 m, originally on the y axis. (and with an initial velocity different from 0).

18. May 23, 2010

### gabbagabbahey

Well, wouldn't the displacement of the spring from equilibrium just be $|r-d|$, where $d$ is the equilibrium length?

19. May 23, 2010

### fluidistic

Looks true.
So the Lagrangian is $$L=\frac{m}{2}(\dot r ^2 + r^2 \dot \theta ^2 + \dot \phi ^2 r^2 \sin ^2 \theta)+mg r \cos \theta - \underbrace{\frac{k}{2}(r^4-2r^2+1)}_{\geq 0}$$.
Is this right?

20. May 24, 2010

### fluidistic

From the Lagrangian I posted (I hope it's right), I reached 3 equations of motions. I'm not really sure what to do from them. Should I calculate the modulus of $$\ddot r$$?
Here they are: $$m[\dot \theta ^2 r + \dot \phi ^2 r \sin ^2 (\theta ) + g \cos (\theta) + \ddot r]+2kr (1-r^2)=0$$.
$$mr\sin (\theta)[(\ddot \phi r + \dot \phi 2 \dot r)\sin (\theta)+\dot \phi r^2 2 \cos (\theta)]=0$$.
Lastly, $$\cos (\theta ) \sin (\theta) \dot \phi r^2 -gr \sin (\theta)-2r \dot r \dot \theta+ r^2 \ddot \theta=0$$.
Now if I want to write a program to get say $$(r, \phi, \theta)$$ in function of time, should I reduce these equations? The exercise states to "integrate the motion equations", so I guess I should integrate with respect to time the 3 equations I just posted?