I Solving for the Motion of a Spring Pendulum

Click For Summary
The discussion focuses on the dynamics of a spring pendulum, analyzing the motion of a mass attached to a spring that swings at an angle. The equations of motion are derived using torque and Newton's second law, leading to a second-order ordinary differential equation for the radial position of the mass. Participants explore the coupling of the pendulum's swing and the spring's oscillation, suggesting that the system exhibits complex behavior rather than simple periodic motion. The conversation also touches on the potential use of Lagrangian mechanics to derive the equations of motion and the importance of considering changing parameters like the spring length. Overall, the complexity of the system suggests that there may not be a straightforward solution, and numerical simulations could be beneficial for further analysis.
  • #61
bob012345 said:
What you need perhaps is advice on what techniques to start with and where to go to learn them quickly.
Well, I guess there is really no rush. I'm going to try and program the numerical solution in VBA and see what happens. If it fails, it fails. The bottom line was to learn something, and I've already done that.

Sitting down and trying to learn something completely new always sucks the life out of me. Also, I rarely have uninterrupted free time to do so (I take care of my young children...stay at home dad isn't as carefree as it sounds!), but I'll see what I can dig up and welcome any suggestions.
 
  • Like
Likes bob012345
Physics news on Phys.org
  • #62
erobz said:
If it fails, it fails. The bottom line was to learn something, and I've already done that.
Of course one of the problems for this system is that it may be difficult to parse the numerical issues from the intrinsic instabilities of the system. While I like your bottom line, I find it a little bit counterintuitive that you cannot learn the numerical technique from others but think it easier to figure it out yourself. There is no overarching utility in reinventing the wheel, so I suggest a combination approach.
 
  • Like
Likes erobz
  • #63
hutchphd said:
Of course one of the problems for this system is that it may be difficult to parse the numerical issues from the intrinsic instabilities of the system. While I like your bottom line, I find it a little bit counterintuitive that you cannot learn the numerical technique from others but think it easier to figure it out yourself. There is no overarching utility in reinventing the wheel, so I suggest a combination approach.
I think there is utility in it though. Sometimes I find that if I try to develop it myself, I'm positioned to better understand what others are trying to tell me about it. Other times I just get horribly lost! 🤷‍♂️

I think it's been said, "Through hardship comes enlightenment" and it resonated with me.
 
Last edited:
  • Like
Likes hutchphd
  • #64
If anyone is interested, Iv'e done some manual iteration in PTC Mathcad. I've set the spring constant ##k## to be very large and initial angle ## \theta_o## to be very small in hopes to recover the small angle approximation fixed length pendulum:

$$ \ddot \theta + \frac{g}{l_o} \theta = 0 \implies \theta = \theta_o \cos \left( \sqrt{ \frac{g}{l_o} } t\right) $$

That has a quarter period ##t## of about:

$$ t = \sqrt{ \frac{l_o}{g} } \frac{\pi}{2} \approx 0.158 \rm{s} $$

The model has a qaurter period (with a somewhat large timestep) ## \Delta t = 0.01 \rm{s}## in between ## 0.14 \rm{s} - 0.15 \rm{s} ##.

So it is undershooting just a bit, but it has a larger timestep than I would do in the actual numerical solution, and it would be approximating:

$$ \ddot \theta + \frac{g}{l_o} \sin \theta = 0 \neq \ddot \theta + \frac{g}{l_o} \theta $$

So, is the "error" in the proper direction?

If its not too much trouble would @bob012345 be able to compare some other sets of parameters like (and this set) this for short durations of time to see were they end up relative to each other?
 

Attachments

  • #65
erobz said:
If its not too much trouble would @bob012345 be able to compare some other sets of parameters like (and this set) this for short durations of time to see were they end up relative to each other?
I'd be happy to try. Give me a few minutes to set it up...
 
  • Like
Likes erobz
  • #66
bob012345 said:
I'd be happy to try. Give me a few minutes to set it up...
Thank You. No hurry!
 
Last edited:
  • #67
erobz said:
Thank You. No hurry!
Here are my numbers. I had to use k=100000 which I think is effectively infinity.

time Theta (deg) Omega
0.00e-00 9.740283e-01 -1.699498e-08
1.00e-02 9.691587e-01 -1.697514e-02
2.00e-02 9.545089e-01 -3.385784e-02
3.00e-02 9.302843e-01 -5.036643e-02
4.00e-02 8.969097e-01 -6.628610e-02
5.00e-02 8.544609e-01 -8.159551e-02
6.00e-02 8.034811e-01 -9.608209e-02
7.00e-02 7.444282e-01 -1.096150e-01
8.00e-02 6.784094e-01 -1.219674e-01
9.00e-02 6.052226e-01 -1.331803e-01
1.00e-01 5.258211e-01 -1.430802e-01
1.10e-01 4.414393e-01 -1.515175e-01
1.20e-01 3.524622e-01 -1.584575e-01
1.30e-01 2.602780e-01 -1.637955e-01
1.40e-01 1.650533e-01 -1.675184e-01
1.50e-01 6.910897e-02 -1.695483e-01
 
  • #68
I changed my ##\Delta t = 0.005 \rm{s}## because I wasn't sure what level of precision your simulator was using.

You are the black plot ## \theta_b## , mine is the red plot ## \theta##

Spring Pendulum - Result Table.JPG


Not a perfect match, but there seems to be some aberrations that could be blurring it. I don't know...I guess It is probably worth the full treatment.

Yours has that slight offset from ##1 ^\circ ## and seeing them plotted, I found that I had double defined my all my parameters on the first step. The tangent to the graph at ##t=0## should be horizontal (I can see that the red curve is not), I'll fix that.
 
Last edited:
  • #69
erobz said:
I changed my ##\Delta t = 0.005 \rm{s}## because I wasn't sure what level of precision your simulator was using.

You are the black plot ## \theta_b## , mine is the red plot ## \theta##

View attachment 303602

Not a perfect match, but there seems to be some aberrations that could be blurring it. I don't know...I guess It is probably worth the full treatment.
I wasn't sure about degree/radian conversion as far as precision. I used exactly 0.017 rads as starting angle. Also, the last data point is 0.07 not 0.007. My timesteps less that 0.1ms. My numbers don't change much if I use 10ms as the max timestep.
 
  • #70
bob012345 said:
I wasn't sure about degree/radian conversion as far as precision. I used exactly 0.017 rads as starting angle. Also, the last data point is 0.07 not 0.007. My timesteps less that 0.1ms. My numbers don't change much if I use 10ms as the max timestep.
Mine was whatever was store in PTC software for 1 degree. I don't think I'm going to bother to change it. Its time consuming to manually go through all the iterations to update the table.

Fixed

1656698848560.png


Now I'm feeling much better! What do you think? Maybe I should change mine though, it looks like it will dive under yours if I do.
 
Last edited:
  • #71
erobz said:
Mine was whatever was store in PTC software for 1 degree. I don't think I'm going to bother to change it. Its time consuming to manually go through all the iterations to update the table.

Fixed

View attachment 303608

Now I'm feeling much better! What do you think? Maybe I should change mine though, it looks like it will dive under yours if I do.
Why don't you just try carrying it through one complete cycle and see if it tracks. I can send you data for the rest of the cycle.
 
  • #72
I'm doing it "manually" right now, the number of computations are getting too large for the program.

I've corrected the offset.

Spring Pendulum - Result Table-rev1.JPG


Given that its reasonably in agreement, I probably will write the numerical solution with traditional programming. Going away for the holiday weekend though. Maybe next week?

It will be neat to see if that amount of disagreement given the potential of chaotic motion will spell disaster. Then again, when I am able to decrease my timestep perhaps they will get better.
 
Last edited:
  • Like
Likes bob012345
  • #73
If anyone wants to examine what produced the latest graph see the attached PDFEDIT:
I just decreased my time step to 0.001 s for up to time 0.01 s and it is moving closer to your simulation. Thats a good sign. I'll let it at that for now.
 

Attachments

Last edited:
  • Like
Likes bob012345
  • #74
I tried to program it, I think it has major theoretical issues that are tied to the assumed form of ##(2)##.

$$ \ddot r + \left( \frac{k}{m} - {\dot \theta}^2 \right) r = g\cos \theta +\frac{k l_o}{m} \tag{2}$$

For the solution of ##2## to be of the form:

$$ r(t) = C_1 \sin( \beta t ) + C_2 \cos ( \beta t ) + \frac{\gamma}{\beta^2} $$

the condition is:

$$ \beta = \sqrt{ \frac{k}{m} - \dot{ \theta }^2 } > 0 \quad \rm{condition 1}$$

So, it is quickly failing for any sizeable angle ( non-real under the root, violating ##\rm{condition 1}## )

how about those standard numerical techniques? Any good information?
 
Last edited:
  • #75
erobz said:
I tried to program it, I think it has major theoretical issues that are tied to the assumed form of ##(2)##.

$$ \ddot r + \left( \frac{k}{m} - {\dot \theta}^2 \right) r = g\cos \theta +\frac{k l_o}{m} \tag{2}$$

For the solution of ##2## to be of the form:

$$ r(t) = C_1 \sin( \beta t ) + C_2 \cos ( \beta t ) + \frac{\gamma}{\beta^2} $$

the condition is:

$$ \beta = \sqrt{ \frac{k}{m} - \dot{ \theta }^2 } > 0 \quad \rm{condition 1}$$

So, it is quickly failing for any sizeable angle ( non-real under the root, violating ##\rm{condition 1}## )

how about those standard numerical techniques? Any good information?
Some basic information is here;

https://en.wikipedia.org/wiki/Numerical_methods_for_ordinary_differential_equations

But I think you really would need to put in some effort to be able to do this problem numerically from scratch. You should start with much simpler problems or the limiting cases of this problem in which the equations reduce to simpler forms. Alternatively, you can learn to use Mathematica, Matlab or some other simulator to do it for you and explore the solution space.
 
  • #76
bob012345 said:
Some basic information is here;

https://en.wikipedia.org/wiki/Numerical_methods_for_ordinary_differential_equations

But I think you really would need to put in some effort to be able to do this problem numerically from scratch. You should start with much simpler problems or the limiting cases of this problem in which the equations reduce to simpler forms. Alternatively, you can learn to use Mathematica, Matlab or some other simulator to do it for you and explore the solution space.
Yeah, solving a coupled system of second order non-linear ODE is not covered in my textbook...
 
  • #77
erobz said:
Yeah, solving a coupled system of second order non-linear ODE is not covered in my textbook...
I think you can turn the second order equations into first order equations of different variables.

See if this numerical treatment makes any sense for you;

http://www.wiu.edu/cas/mathematics_and_philosophy/graduate/main.pdf

You will have to look up the unfamiliar terms such as the ERK method but that shouldn't be too difficult.
 
Last edited:
  • Like
Likes erobz

Similar threads

  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
2
Views
1K
  • · Replies 24 ·
Replies
24
Views
2K
Replies
1
Views
2K
  • · Replies 17 ·
Replies
17
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K