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 triple pendulum. See this article for the derivation of the equations of motion.
Diagram of the triple pendulum. The equations being solved in this simulation are
\[\begin{aligned} \begin{bmatrix} M_1 l_1^2 & \mu_2 l_1 l_2 \cos{\Delta_{21}} & \mu_3 l_1 l_3\cos{\Delta_{31}} \\ \mu_2 l_1 l_2 \cos{\Delta_{21}} &M_2 l_2^2 & \mu_3 l_2 l_3\cos{\Delta_{32}} \\ \mu_3 l_1 l_3 \cos{\Delta_{31}} & \mu_3 l_2 l_3 \cos{\Delta_{32}} & M_3 l_3^2 \end{bmatrix} \begin{bmatrix} \ddot{\theta}_1 \\ \ddot{\theta}_2 \\ \ddot{\theta}_3 \end{bmatrix} &= \begin{bmatrix} Q_{\theta_1} - \mu_1 g l_1 \cos{\theta_1} + \mu_2 l_1 l_2 \dot{\theta}_2^2 \sin{\Delta_{21}} + \mu_3 l_1 l_3 \dot{\theta}_3^2 \sin{\Delta_{31}} \\ Q_{\theta_2} - \mu_2 l_2(l_1\dot{\theta}_1^2\sin{\Delta_{21}}+g\cos{\theta_2}) + \mu_3 l_2 l_3 \dot{\theta}_3^2 \sin{\Delta_{32}}\\ Q_{\theta_3} - \mu_3 l_3 (l_1\dot{\theta}_1^2 \sin{\Delta_{31}} + l_2\dot{\theta}_2^2 \sin{\Delta_{32}} + g\cos{\theta_3}) \end{bmatrix} \end{aligned}\]
Where \(M_1 = m_{1b} + \dfrac{m_{1r}}{3} + m_{2b} + m_{2r} + m_{3b} + m_{3r}\), \(M_2 = m_{2b} + \dfrac{m_{2r}}{3} + m_{3b} + m_{3r}\), \(M_3 = m_{3b} + \dfrac{m_{3r}}{3}\), \(\mu_1 = m_{1b} + \dfrac{m_{1r}}{2} + m_{2b} + m_{2r} + m_{3b} + m_{3r}\), \(\mu_2 = m_{2b} + \dfrac{m_{2r}}{2} + m_{3b} + m_{3r}\), \(\mu_3 = m_{3b} + \dfrac{m_{3r}}{2}\) and \(\Delta_{ij} = \theta_i - \theta_j\).