Double elastic pendulum problem 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 double elastic pendulum. The equations that will be integrated here are derived in this article.
Figure 1: Diagram of the double elastic pendulum.
The ordinary differential equation system being solved is \[ \begin{aligned} \begin{bmatrix} \ddot{r}_1 \\ \ddot{r}_2 \\ \ddot{\theta}_1 \\ \ddot{\theta}_2 \end{bmatrix} &= \begin{bmatrix} 1 & \dfrac{m_2\cos{\Delta}}{m_1+m_2} & 0 & -\dfrac{m_2r_2\sin{\Delta}}{m_1+m_2} \\ \cos{\Delta} & 1 & r_1\sin{\Delta} & 0 \\ 0 & \dfrac{m_2\sin{\Delta}}{(m_1+m_2)r_1} & 1 & \dfrac{m_2r_2\cos{\Delta}}{(m_1+m_2)r_1} \\ -\dfrac{\sin{\Delta}}{r_2} & 0 & \dfrac{r_1\cos{\Delta}}{r_2} & 1 \end{bmatrix}^{-1} \begin{bmatrix} r_1\dot{\theta}_1^2-g\sin{\theta_1} + \dfrac{m_2}{m_1+m_2}\left(r_2\dot{\theta}_2^2\cos{\Delta} + 2\dot{r}_2\dot{\theta}_2\sin{\Delta}\right) + \dfrac{Q_{r_1}-k_1(r_1-l_1)}{m_1+m_2}\\ r_2\dot{\theta}_2^2-g\sin{\theta_2} + r_1\dot{\theta}_1^2\cos{\Delta} - 2\dot{r}_1\dot{\theta}_1\sin{\Delta} + \dfrac{Q_{r_2}-k_2(r_2-l_2)}{m_2} \\ -\dfrac{2\dot{r}_1\dot{\theta}_1}{r_1} - \dfrac{g\cos{\theta_1}}{r_1} - \dfrac{m_2}{(m_1+m_2)r_1}\left[2\dot{r}_2\dot{\theta}_2\cos{\Delta} -r_2\dot{\theta}_2^2\sin{\Delta}\right] + \dfrac{Q_{\theta_1}}{(m_1+m_2)r_1^2} \\ -\dfrac{2\dot{r}_2\dot{\theta}_2}{r_2}- \dfrac{g\cos{\theta_2}}{r_2} - \dfrac{2\dot{r}_1\dot{\theta}_1\cos{\Delta}}{r_2} - \dfrac{r_1\dot{\theta}_1^2\sin{\Delta}}{r_2} + \dfrac{Q_{\theta_2}}{m_2r_2^2} \end{bmatrix}. \end{aligned} \]

Simulation inputs

Parameter Value Explanation
Acceleration due to gravity in \(\mathrm{m}\cdot \mathrm{s}^{-2}\).
Rest length of pendulum 1 in metres.
Rest length of pendulum 2 in metres.
Mass of pendulum bob 1 in kilograms.
Mass of pendulum bob 2 in kilograms.
Coefficient for first pendulum spring.
Coefficient for second pendulum spring.
Linear dissipation coefficient for pendulum 1.
Linear dissipation coefficient for pendulum 2.
Quadratic dissipation coefficient for pendulum 1.
Quadratic dissipation coefficient for pendulum 2.
Starting time for the simulation in seconds (s).
End time for the simulation in seconds.
Value of \(r_1\) at \(t_0\) in metres.
Value of \(\dot{r}_1\) at \(t_0\) in \(\mathrm{m}\cdot \mathrm{s}^{-1}\).
Value of \(r_2\) at \(t_0\) in metres.
Value of \(\dot{r}_2\) at \(t_0\) in \(\mathrm{m}\cdot \mathrm{s}^{-1}\).
Value of \(\theta_1\) at \(t_0\) in radians.
Value of \(\dot{\theta}_1\) at \(t_0\) in radians per second.
Value of \(\theta_2\) at \(t_0\) in radians.
Value of \(\dot{\theta}_2\) at \(t_0\) in radians per second.
Absolute error tolerance. Equation solver can fail if too small.
Initial guess for step size.
Minimum limit for step size.
Time you want to add to animation.
Time you want to skip ahead to in the animation.


The buttons below pertain to the animation immediately below them.