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

d2rdt2=rθ˙2μ1M1gsinθ+Qrk(rl0)M1d2θdt2=2r˙θ˙rμ1gcosθM1r+QθM1r2.\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

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

  • θ\theta is the angle of the pendulum relative to the positive xx-axis.

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

  • l0l_0 is the rest length of the pendulum.

  • Qr=(bb+cbvb)r˙(br+crvr)r˙4Q_{r} = -(b_b+c_b v_b)\dot{r} - (b_r + c_r v_r)\dfrac{\dot{r}}{4}.

  • vb=r˙2+r2θ˙2v_b = \sqrt{\dot{r}^2+r^2\dot{\theta}^2} and vr=12vbv_r = \dfrac{1}{2}v_b.

  • Qθ=(bb+cbvb)r2θ˙(br+crvr)r2θ˙4Q_{\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 (ms2\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 rr (m).
Initial value of r˙\dot{r} (ms1\mathrm{m}\cdot \mathrm{s}^{-1}).
Initial value of θ\theta in radians (r).
Initial value of θ˙\dot{\theta} (rs1\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. tScale=1.0t_{\mathrm{Scale}}=1.0 means animation and real time match. tScale<1.0t_{\mathrm{Scale}}<1.0 means the animation is going more slowly than real time. tScale>1.0t_{\mathrm{Scale}}>1.0 means it is going more rapidly.