Finding the Lagrangian for a 3D Spring Pendulum

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
38 replies · 11K views
jdwood983 said:
Hmm, I got

[tex]\ddot{\theta}=\sin\theta\cos\theta\dot{\phi}-\frac{g\sin\theta}{r}-\frac{2\dot{r}\dot{\theta}}{r}[/tex]



[tex]\ddot{r}=r\dot{\theta}^2+r\sin^2\theta\dot{\phi}^2+g\cos\theta-\frac{k}{m}\left(r-1\right)[/tex]

and

[tex]\ddot{\phi}=-\dot{\phi}\left[\frac{2\dot{r}}{r}+2\cot\theta\right][/tex]

I keep getting the same result I had. Did you start with the same motion equations as mine? My [tex]\ddot \theta[/tex] is worth [tex]- \ddot \theta[/tex] of yours. The same apply for [tex]\ddot r[/tex]. And for [tex]\ddot \phi[/tex], I still get this "r" term in front of the [tex]\cot (\theta )[/tex] term.
 
Physics news on Phys.org
Well your Lagrangian is

[tex]L=\frac{1}{2}m\left(\dot{r}^2+r^2\dot{\theta}^2+r^2\sin^2\theta\dot{\phi}^2\right)+mgr\cos\theta-\frac{1}{2}k\left(r-1\right)^2[/tex]

So then the Euler-Lagrange equations come from

[tex]\frac{d}{dt}\left(\frac{\partial L}{\partial\dot{q}}\right)-\frac{\partial L}{\partial q}=0[/tex]

where q is your coordinate. Looking at [itex]\phi[/itex] (because it's the most simple)

[tex]\frac{d}{dt}\left(\frac{\partial L}{\partial\dot{\phi}}\right)-\frac{\partial L}{\partial\phi}=\frac{d}{dt}\left(mr^2\sin^2\theta\dot{\phi}\right)=0[/tex]

Clearly m doesn't change, this gives that

[tex]\frac{d}{dt}\left(mr^2\sin^2\theta\dot{\phi}\right)=2mr\dot{r}\sin^2\theta\dot{\phi}+2mr^2\sin\theta\cos\theta\dot{\theta}\dot{\phi}+mr^2\sin^2\theta\ddot{\phi}=0[/tex]

So then solving for [itex]\phi[/itex]-double-dot:

[tex]mr^2\sin^2\theta\ddot{\phi}=-2mr\dot{r}\sin^2\theta\dot{\phi}-2mr^2\sin\theta\cos\theta\dot{\theta}\dot{\phi}[/tex]

Canceling m and dividing by r-squared & sine-squared

[tex]\ddot{\phi}=-2\frac{\dot{r}\dot{\phi}}{r}-2\cot\theta\dot{\theta}\dot{\phi}[/tex]

So it seems (being more careful now) that I forgot a term ([itex]d\theta/dt[/itex]), but that r does not belong in front of the cotangent term.
 
[tex]L=\frac{1}{2}m\left(\dot{r}^2+r^2\dot{\theta}^2+r^2\sin^2\theta\dot{\phi}^2\right)+mgr\cos\theta-\frac{1}{2}k\left(r-1\right)^2[/tex]

Then looking at the r-coordinate,

[tex]\frac{d}{dt}\left(\frac{\partial L}{\partial\dot{r}}\right)-\frac{\partial L}{\partial r}=0[/tex]

we get

[tex]\frac{d}{dt}\left(m\dot{r}\right)-mr\dot{\theta}^2-mr\sin^2\theta\dot{\phi}^2-mg\cos\theta+k\left(r-1\right)=0[/tex]

Which gives

[tex]\ddot{r}=r\dot{\theta}^2+r\sin^2\theta\dot{\phi}^2+g\cos\theta-\frac{k}{m}\left(r-1\right)[/tex]

Similarly for [itex]\theta[/itex]:

[tex]\frac{d}{dt}\left(mr^2\dot{\theta}\right)-mr^2\sin\theta\cos\theta\dot{\phi}^2+mgr\sin\theta=0[/tex]

[tex]\ddot{\theta}=\sin\theta\cos\theta\dot{\phi}^2-\frac{g\sin\theta}{r}-\frac{2\dot{r}\dot{\theta}}{r}[/tex]
 
Last edited:
Hey jdwood983, I agree with your 2 last posts. To convince myself I've redone all the arithmetic from the Lagrangian and I get exactly the same result as yours now. My previous errors were in applying E-L equation.
I think the problem is solved. The remaining part is numerical.
Thanks for all to both. :wink:
 
Not a problem, glad I (we) could help!
 
Ok before putting an end to this thread, I'd like some help to get the initial conditions.
The initial position of the mass is (0,1,0) in Cartesian coordinates. So it makes [tex](1,\pi /2,\pi /2)[/tex] in spherical.
The initial velocity of the mass is (0,0,-1/2) in Cartesian coordinates. I'm not sure how to convert this into spherical ones.
An attempt of mine is to write [tex]\vec v_0=-\frac{1}{2}\hat z=\frac{\sin (\theta) \hat \theta}{2}-\frac{\cos (\theta)\hat r}{2}[/tex]. I don't know how to proceed from here.

Edit: Hmm, is it just [tex](1/2,0, \pi)[/tex]?
Edit 2: Well I think so. This would mean [tex]\dot r (0)=1/2[/tex], [tex]\dot \phi (0)=0[/tex] and [tex]\dot \theta (0)=\pi[/tex]. I hope someone can confirm this.
 
Last edited:
Any idea? I'm not sure I have the right initial conditions. I hope someone can confirm if they're good.
 
It does look fine to me, the (0.5,0,pi):

[tex]r=\sqrt{x^2+y^2+z^2}=\sqrt{1/4}=1/2[/tex]

[tex]\theta=\cos^{-1}\left[\frac{z}{r}\right]=\cos^{-1}\left[1\right]=0[/tex]

[tex]\phi=\tan^{-1}\left[\frac{x}{y}\right]\rightarrow\pi[/tex]EDIT: Technically, [itex]\phi[/itex] is undefined because x=0 divided by y=0 is undefined, but given your position it should be okay (note that my [itex]\phi[/itex] is your [itex]\theta[/itex], I was taught coordinates this way and always use it)
 
Ok thank you jdwood983. Problem solved. I'll now tackle the numerical part!