Elastic pendulum solver

This webpage uses the Runge-Kutta-Fehlberg fourth-order method with fifth-order error checking (RKF45) to approximate the solution to the problem of the elastic pendulum

\[\begin{aligned} \dfrac{d^{2}r}{dt^2} &= r \dot{\theta}^2 - \dfrac{\mu_1}{M_1} g\sin{\theta} + \dfrac{Q_r-k(r-l_0)}{M_1} \\ \dfrac{d^{2} \theta}{dt^2} &= -\dfrac{2\dot{r}\dot{\theta}}{r} - \dfrac{\mu_1 g\cos{\theta}}{M_1 r} + \dfrac{Q_{\theta}}{M_1r^2}. \end{aligned}\]

Where

  • \(r\) is the length of the pendulum rod (in metres).

  • \(\theta\) is the angle of the pendulum relative to the positive \(x\)-axis.

  • \(g\) is the acceleration due to gravity (in metres per second squared).

  • \(l_0\) is the rest length of the pendulum.

  • \(Q_{r} = -(b_b+c_b v_b)\dot{r} - (b_r + c_r v_r)\dfrac{\dot{r}}{4}\).

  • \(v_b = \sqrt{\dot{r}^2+r^2\dot{\theta}^2}\) and \(v_r = \dfrac{1}{2}v_b\).

  • \(Q_{\theta} = -(b_b+c_b v_b)r^2\dot{\theta} - (b_r + c_r v_r)\dfrac{r^2\dot{\theta}}{4}\).

In this calculation, we assumed that the dissipative forces on the rod could be calculated using a centre-of-mass approach.

Simulation parameter form.
Parameter Value Explanation
Acceleration due to gravity in metres (m) per second (s) squared (\(\mathrm{m}\cdot \mathrm{s}^{-2}\)).
Rest length (m) of pendulum rod.
Spring coefficient of pendulum.
Mass (kilograms or kg) of pendulum bob.
Mass (kilograms or kg) of pendulum rod.
Linear dissipation coefficient for the pendulum bob.
Linear dissipation coefficient for the pendulum rod.
Quadratic dissipation coefficient for the pendulum bob.
Quadratic dissipation coefficient for the pendulum rod.
End time (s) for the simulation.
Initial value of \(r\) (m).
Initial value of \(\dot{r}\) (\(\mathrm{m}\cdot \mathrm{s}^{-1}\)).
Initial value of \(\theta\) in radians (r).
Initial value of \(\dot{\theta}\) (\(\mathrm{r}\cdot \mathrm{s}^{-1}\)).
Error tolerance.
Tolerance type, can be either absolute (0) or relative (1).
Initial step size.
Minimum allowed step size.
Time increment for skipping ahead in animation.
Time you want to skip ahead to in animation when you press the skip button.
Width (in px) of Plotly windows used for plotting and animation below.
Height (in px) of Plotly windows used for plotting and animation below.
Proportion of animation time passed per real time. \(t_{\mathrm{Scale}}=1.0\) means animation and real time match. \(t_{\mathrm{Scale}}<1.0\) means the animation is going more slowly than real time. \(t_{\mathrm{Scale}}>1.0\) means it is going more rapidly.