I Spring Pendulum

1. Apr 19, 2017

nneutrino

Hi guys,
I need to transform Newtonian solution of motion equation for spring (elastic) pendulum into Matlab or Microsoft Excel. I want to use Euler´s Method (or Runge Kutta Method) of numerical solution for that problem. I know all the equations but I have a problem with making some code from them. In which order should I write those equations to some of those programs and which equations are necessary?

2. Apr 20, 2017

BvU

Hi nn,

Here at PF we encourage folks to start something so we can help them by asking questions, giving hints and perhaps propose some corrections. So it would be best if you made a start and then we'll help you along.

So: what are the equations, how do you work them around to an algorithm ?

And some free advice: use a simple euler integrator

3. Apr 20, 2017

vanhees71

Using a simple Euler integrator is only good advice if you want to provide insight into what can go wrong in integrating differential equations. It's important to check (at least) the conservation laws (in this case energy conservation) to at least see whether things go wrong due to accumulation of errors. Using a low-order solver usually forces you to make the time-step size small, but then you often cumulate numerical errors!

4. Apr 20, 2017

BvU

First things first; we can always concentrate on the integrator later on.
nn started several threads and by now I don't know what the plan is, nor what has already been covered and what is to be picked up next.
Contradicts post #1 here somewhat (at least for me).

Do you already have a working simulation of a pendulum and now want to allow for stretch (spring instead of rod) in the equations ?

@nneutrino : Or is your problem that you have a full set of equations and don't know how to discretize them ?

Also: are you clear now on the small angle approximation for the pendulum ? Do you want it in or out ?

5. Apr 20, 2017

nneutrino

1. I already have simulation of a pendulum with rod but my problem is how I have already said elastic pendulum with spring.
2. Yes, I have full set of equations and I find it useless to write them all here. So I am asking for order of those equations in my code (I know how programing in Matlab works or how functions in Microsoft Excel are written) I need to know the sequence of concrete equations. M. Excel example: 1. step (time) t_n=t_n-1+dt; 2. step (acceleration) a_1= some formula... 3. step (velocity) formula 4. step (position) etc. (I am asking for sequence of concrete formulas which I understand because I understand the problem of elastic pendulum. If something is not clear about formulas I will ask)
3. Initial angle should be 90°
By the way I prefer Microsoft Excel solution