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.