Derivation of the equations of motion of the triple pendulum

In this article, the equations of motion of the triple pendulum will be derived via the Euler-Lagrange equations with dissipation. See this article for a solver of this system of equations.

Positions, velocities and generalized basis vectors

Figure 1: Diagram of the triple pendulum.

Pendulum bob 1

x1b=l1cos⁡θ1,y1b=l1sin⁡θ1,x˙1b=−l1θ˙1sin⁡θ1,y˙1b=l1θ˙1cos⁡θ1∴v1b=l1θ˙1v⃗1b=l1θ˙1[−sin⁡θ1cos⁡θ1],e^1b,θ1=l1[−sin⁡θ1cos⁡θ1],e^1b,θ2=e^1b,θ3=0⃗\begin{aligned} & x_{1b} &= l_1 \cos{\theta_1}, & y_{1b} &= l_1 \sin{\theta_1}, & \dot{x}_{1b} &= -l_1 \dot{\theta}_1 \sin{\theta_1}, & \dot{y}_{1b} &= l_1 \dot{\theta}_1 \cos{\theta_1}\\ & \therefore v_{1b} &= l_1 \dot{\theta}_1 \\ & \vec{v}_{1b} &= l_1 \dot{\theta}_1\begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}, & \hat{e}_{1b, \theta_1} &= l_1 \begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}, & \hat{e}_{1b, \theta_2} &= \hat{e}_{1b, \theta_3} &= \vec{0} \\ \end{aligned}

Pendulum rod 1

x1r=l1cos⁡θ12,y1r=l1sin⁡θ12,x˙1r=−l1θ˙1cos⁡θ12,y˙1r=l1θ˙1cos⁡θ12∴v1r=l1θ˙12v⃗1r=l1θ˙12[−sin⁡θ1cos⁡θ1],e^1r,θ1=l12[−sin⁡θ1cos⁡θ1],e^1r,θ2=e^1r,θ3=0⃗\begin{aligned} & x_{1r} &= \dfrac{l_1 \cos{\theta_1}}{2}, & y_{1r} &= \dfrac{l_1 \sin{\theta_1}}{2}, & \dot{x}_{1r} &= -\dfrac{l_1 \dot{\theta}_1 \cos{\theta_1}}{2}, & \dot{y}_{1r} &= \dfrac{l_1\dot{\theta}_1 \cos{\theta_1}}{2} \\ & \therefore v_{1r} &= \dfrac{l_1 \dot{\theta}_1}{2} \\ & \vec{v}_{1r} &= \dfrac{l_1 \dot{\theta}_1}{2}\begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}, & \hat{e}_{1r, \theta_1} &= \dfrac{l_1}{2} \begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}, & \hat{e}_{1r, \theta_2} &= \hat{e}_{1r, \theta_3} &= \vec{0} \end{aligned}

Pendulum bob 2

Defining Δij=θi−θj\Delta_{ij} = \theta_i - \theta_j, we get

x2b=l1cos⁡θ1+l2cos⁡θ2,y2b=l1sin⁡θ1+l2sin⁡θ2x˙2b=−l1θ1˙sin⁡θ1−l2θ2˙sin⁡θ2,y˙2b=l1θ1˙cos⁡θ1+l2θ2˙cos⁡θ2∴v2b=l12θ˙12+2l1l2θ˙1θ˙2cos⁡Δ21+l22θ˙22v⃗2b=[−l1θ1˙sin⁡θ1−l2θ2˙sin⁡θ2l1θ1˙cos⁡θ1+l2θ2˙cos⁡θ2],e^2b,θ1=l1[−sin⁡θ1cos⁡θ1],e^2b,θ2=l2[−sin⁡θ2cos⁡θ2],e^2b,θ3=0⃗\begin{aligned} & x_{2b} &= l_1\cos{\theta_1} + l_2 \cos{\theta_2}, & y_{2b} &= l_1 \sin{\theta_1} + l_2 \sin{\theta_2} & \dot{x}_{2b} &= -l_1 \dot{\theta_1}\sin{\theta_1} - l_2\dot{\theta_2}\sin{\theta_2}, &\dot{y}_{2b} &= l_1 \dot{\theta_1} \cos{\theta_1} + l_2 \dot{\theta_2}\cos{\theta_2} \\ & \therefore v_{2b} &= \sqrt{l_1^2 \dot{\theta}_1^2 + 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\Delta_{21}} + l_2^2 \dot{\theta}_2^2} \\ & \vec{v}_{2b} &= \begin{bmatrix} -l_1 \dot{\theta_1}\sin{\theta_1} - l_2\dot{\theta_2}\sin{\theta_2} \\ l_1 \dot{\theta_1} \cos{\theta_1} + l_2 \dot{\theta_2}\cos{\theta_2} \end{bmatrix}, \hat{e}_{2b, \theta_1} &= l_1 \begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}, & \hat{e}_{2b, \theta_2} &= l_2 \begin{bmatrix} -\sin{\theta_2} \\ \cos{\theta_2} \end{bmatrix}, & \hat{e}_{2b, \theta_3} &= \vec{0} \end{aligned}

Pendulum rod 2

x2r=l1cos⁡θ1+l2cos⁡θ22,y2r=l1sin⁡θ1+l2sin⁡θ22x˙2r=−l1θ1˙sin⁡θ1−l2θ2˙sin⁡θ22,y˙2r=l1θ1˙cos⁡θ1+l2θ2˙cos⁡θ22∴v2r=l12θ˙12+l1l2θ˙1θ˙2cos⁡Δ21+l22θ˙224v⃗2r=[−l1θ1˙sin⁡θ1−l2θ2˙sin⁡θ22l1θ1˙cos⁡θ1+l2θ2˙cos⁡θ22],e^2r,θ1=l1[−sin⁡θ1cos⁡θ1],e^2r,θ2=l22[−sin⁡θ2cos⁡θ2],e^2r,θ3=0⃗\begin{aligned} & x_{2r} &= l_1\cos{\theta_1} + \dfrac{l_2 \cos{\theta_2}}{2}, & y_{2r} &= l_1 \sin{\theta_1} + \dfrac{l_2 \sin{\theta_2}}{2} & \dot{x}_{2r} &= -l_1 \dot{\theta_1}\sin{\theta_1} - \dfrac{l_2\dot{\theta_2}\sin{\theta_2}}{2}, &\dot{y}_{2r} &= l_1 \dot{\theta_1} \cos{\theta_1} + \dfrac{l_2 \dot{\theta_2}\cos{\theta_2}}{2} \\ & \therefore v_{2r} &= \sqrt{l_1^2 \dot{\theta}_1^2 + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\Delta_{21}} + \dfrac{l_2^2 \dot{\theta}_2^2}{4}} \\ & \vec{v}_{2r} &= \begin{bmatrix} -l_1 \dot{\theta_1}\sin{\theta_1} - \dfrac{l_2\dot{\theta_2}\sin{\theta_2}}{2} \\ l_1 \dot{\theta_1} \cos{\theta_1} + \dfrac{l_2 \dot{\theta_2}\cos{\theta_2}}{2} \end{bmatrix}, \hat{e}_{2r, \theta_1} &= l_1 \begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}, & \hat{e}_{2r, \theta_2} &= \dfrac{l_2}{2} \begin{bmatrix} -\sin{\theta_2} \\ \cos{\theta_2} \end{bmatrix}, & \hat{e}_{2r, \theta_3} &= \vec{0} \end{aligned}

Pendulum bob 3

x3b=l1cos⁡θ1+l2cos⁡θ2+l3cos⁡θ3,y3b=l1sin⁡θ1+l2sin⁡θ2+l3sin⁡θ3x˙3b=−l1θ1˙sin⁡θ1−l2θ˙2sin⁡θ2−l3θ3˙sin⁡θ3,y˙3b=l1θ1˙cos⁡θ1+l2θ˙2cos⁡θ2+l3θ3˙cos⁡θ3∴v3b=l12θ˙12+2l1l2θ˙1θ˙2cos⁡Δ21+l22θ˙22+2l2l3θ˙2θ˙3cos⁡Δ32+2l1l3θ˙1θ˙3cos⁡Δ31+l32θ˙32v⃗3b=[−l1θ1˙sin⁡θ1−l2θ2˙sin⁡θ2−l3θ3˙sin⁡θ3l1θ1˙cos⁡θ1+l2θ2˙cos⁡θ2+l3θ3˙cos⁡θ3],e^3b,θ1=l1[−sin⁡θ1cos⁡θ1],e^3b,θ2=l2[−sin⁡θ2cos⁡θ2],e^3b,θ3=l3[−sin⁡θ3cos⁡θ3]\begin{aligned} & x_{3b} &= l_1\cos{\theta_1} + l_2 \cos{\theta_2} + l_3 \cos{\theta_3}, & y_{3b} &= l_1 \sin{\theta_1} + l_2\sin{\theta_2} + l_3 \sin{\theta_3} & \dot{x}_{3b} &= -l_1 \dot{\theta_1}\sin{\theta_1} - l_2 \dot{\theta}_2\sin{\theta_2} - l_3\dot{\theta_3}\sin{\theta_3}, &\dot{y}_{3b} &= l_1 \dot{\theta_1} \cos{\theta_1} + l_2 \dot{\theta}_2 \cos{\theta_2} + l_3 \dot{\theta_3}\cos{\theta_3}\\ & \therefore v_{3b} &= \sqrt{l_1^2 \dot{\theta}_1^2 + 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\Delta_{21}} + l_2^2 \dot{\theta}_2^2 + 2l_2 l_3 \dot{\theta}_2 \dot{\theta}_3 \cos{\Delta_{32}} + 2l_1l_3 \dot{\theta}_1\dot{\theta}_3 \cos{\Delta_{31}} + l_3^2 \dot{\theta}_3^2}\\ & \vec{v}_{3b} &= \begin{bmatrix} -l_1 \dot{\theta_1}\sin{\theta_1} - l_2\dot{\theta_2}\sin{\theta_2} - l_3\dot{\theta_3}\sin{\theta_3} \\ l_1 \dot{\theta_1} \cos{\theta_1} + l_2 \dot{\theta_2}\cos{\theta_2} + l_3 \dot{\theta_3}\cos{\theta_3} \end{bmatrix}, \hat{e}_{3b, \theta_1} &= l_1 \begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}, & \hat{e}_{3b, \theta_2} &= l_2 \begin{bmatrix} -\sin{\theta_2} \\ \cos{\theta_2} \end{bmatrix}, & \hat{e}_{3b, \theta_3} &= l_3 \begin{bmatrix} -\sin{\theta_3} \cos{\theta_3} \end{bmatrix} \end{aligned}

Pendulum rod 3

x3r=l1cos⁡θ1+l2cos⁡θ2+l3cos⁡θ32,y3r=l1sin⁡θ1+l2sin⁡θ2+l3sin⁡θ32x˙3r=−l1θ1˙sin⁡θ1−l2θ˙2sin⁡θ2−l3θ3˙sin⁡θ32,y˙3r=l1θ1˙cos⁡θ1+l2θ˙2cos⁡θ2+l3θ3˙cos⁡θ32∴v3r=l12θ˙12+2l1l2θ˙1θ˙2cos⁡Δ21+l22θ˙22+l1l3θ˙1θ˙3cos⁡Δ31+l2l3θ˙2θ˙3cos⁡Δ32+l32θ˙324v⃗3r=[−l1θ1˙sin⁡θ1−l2θ2˙sin⁡θ22−l3θ3˙sin⁡θ32l1θ1˙cos⁡θ1+l2θ2˙cos⁡θ22+l3θ3˙cos⁡θ32],e^3r,θ1=l1[−sin⁡θ1cos⁡θ1],e^3r,θ2=l2[−sin⁡θ2cos⁡θ2],e^3r,θ3=l32[−sin⁡θ3cos⁡θ3]\begin{aligned} & x_{3r} &= l_1\cos{\theta_1} + l_2 \cos{\theta_2} + \dfrac{l_3 \cos{\theta_3}}{2}, & y_{3r} &= l_1 \sin{\theta_1} + l_2\sin{\theta_2} + \dfrac{l_3 \sin{\theta_3}}{2} & \dot{x}_{3r} &= -l_1 \dot{\theta_1}\sin{\theta_1} - l_2 \dot{\theta}_2\sin{\theta_2} - \dfrac{l_3\dot{\theta_3}\sin{\theta_3}}{2}, &\dot{y}_{3r} &= l_1 \dot{\theta_1} \cos{\theta_1} + l_2 \dot{\theta}_2 \cos{\theta_2} + \dfrac{l_3 \dot{\theta_3}\cos{\theta_3}}{2}\\ & \therefore v_{3r} &= \sqrt{l_1^2 \dot{\theta}_1^2 + 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\Delta_{21}} + l_2^2 \dot{\theta}_2^2 + l_1l_3 \dot{\theta}_1\dot{\theta}_3\cos{\Delta_{31}} + l_2l_3\dot{\theta}_2 \dot{\theta}_3 \cos{\Delta_{32}} + \dfrac{l_3^2 \dot{\theta}_3^2}{4}}\\ & \vec{v}_{3r} &= \begin{bmatrix} -l_1 \dot{\theta_1}\sin{\theta_1} - \dfrac{l_2\dot{\theta_2}\sin{\theta_2}}{2} - \dfrac{l_3\dot{\theta_3}\sin{\theta_3}}{2}\\ l_1 \dot{\theta_1} \cos{\theta_1} + \dfrac{l_2 \dot{\theta_2}\cos{\theta_2}}{2} + \dfrac{l_3 \dot{\theta_3}\cos{\theta_3}}{2} \end{bmatrix}, \hat{e}_{3r, \theta_1} &= l_1 \begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}, & \hat{e}_{3r, \theta_2} &= l_2 \begin{bmatrix} -\sin{\theta_2} \\ \cos{\theta_2} \end{bmatrix}, & \hat{e}_{3r, \theta_3} &= \dfrac{l_3}{2} \begin{bmatrix} -\sin{\theta_3} \\ \cos{\theta_3} \end{bmatrix} \end{aligned}

Kinetic energy

T=m1b2v1b2+m1r2v1r2+m1rIcm,1rω1r22+m2b2v2b2+m2r2v2r2+m2rIcm,2rω2r22+m3b2v3b2+m3r2v3r2+m3rIcm,3rω3r22=m1bl12θ˙122+m1rl12θ˙128+m1rl12θ˙1224+m2b2(l12θ˙12+2l1l2θ˙1θ˙2cos⁡Δ21+l22θ˙22)+m2r2(l12θ˙12+l1l2θ˙1θ˙2cos⁡Δ21+l22θ˙224)+m2rl22θ˙2224+m3b2(l12θ˙12+2l1l2θ˙1θ˙2cos⁡Δ21+l22θ˙22+2l2l3θ˙2θ˙3cos⁡Δ32+2l1l3θ˙1θ˙3cos⁡Δ31+l32θ˙32)+m3r2(l12θ˙12+2l1l2θ˙1θ˙2cos⁡Δ21+l22θ˙22+l1l3θ˙1θ˙3cos⁡Δ31+l2l3θ˙2θ˙3cos⁡Δ32+l32θ˙324)+m3rl32θ˙3224=12(m1b+m1r3+m2b+m2r+m3b+m3r)l12θ˙12+12(m2b+m2r3+m3b+m3r)l22θ˙22+12(m3b+m3r3)l32θ˙32+(m2b+m2r2+m3b+m3r)l1l2θ˙1θ˙2cos⁡Δ21+(m3b+m3r2)l3(l2θ˙2θ˙3cos⁡Δ32+l1θ˙1θ˙3cos⁡Δ31)\begin{aligned} T &= \dfrac{m_{1b}}{2} v_{1b}^2 + \dfrac{m_{1r}}{2} v_{1r}^2 + \dfrac{m_{1r}I_{\mathrm{cm},1r} \omega_{1r}^2}{2} + \dfrac{m_{2b}}{2} v_{2b}^2 + \dfrac{m_{2r}}{2} v_{2r}^2 + \dfrac{m_{2r}I_{\mathrm{cm},2r} \omega_{2r}^2}{2} + \dfrac{m_{3b}}{2} v_{3b}^2 + \dfrac{m_{3r}}{2} v_{3r}^2 + \dfrac{m_{3r}I_{\mathrm{cm},3r} \omega_{3r}^2}{2} \\ &= \dfrac{m_{1b}l_1^2 \dot{\theta}_1^2}{2} + \dfrac{m_{1r}l_1^2 \dot{\theta}_1^2}{8} + \dfrac{m_{1r}l_1^2 \dot{\theta}_1^2}{24} + \dfrac{m_{2b}}{2}(l_1^2 \dot{\theta}_1^2 + 2l_1 l_2 \dot{\theta}_1\dot{\theta}_2 \cos{\Delta_{21}} + l_2^2 \dot{\theta}_2^2) + \dfrac{m_{2r}}{2}\left(l_1^2 \dot{\theta}_1^2 + l_1 l_2 \dot{\theta}_1\dot{\theta}_2 \cos{\Delta_{21}} + \dfrac{l_2^2 \dot{\theta}_2^2}{4}\right) + \dfrac{m_{2r}l_2^2 \dot{\theta}_2^2}{24} + \dfrac{m_{3b}}{2} \left(l_1^2 \dot{\theta}_1^2 + 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\Delta_{21}} + l_2^2 \dot{\theta}_2^2 + 2l_2 l_3 \dot{\theta}_2 \dot{\theta}_3 \cos{\Delta_{32}} + 2l_1l_3 \dot{\theta}_1\dot{\theta}_3 \cos{\Delta_{31}} + l_3^2 \dot{\theta}_3^2\right)+ \dfrac{m_{3r}}{2}\left(l_1^2 \dot{\theta}_1^2 + 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\Delta_{21}} + l_2^2 \dot{\theta}_2^2 + l_1l_3 \dot{\theta}_1\dot{\theta}_3\cos{\Delta_{31}} + l_2l_3\dot{\theta}_2 \dot{\theta}_3 \cos{\Delta_{32}} + \dfrac{l_3^2 \dot{\theta}_3^2}{4}\right) + \dfrac{m_{3r}l_3^2 \dot{\theta}_3^2}{24} \\ &= \dfrac{1}{2}\left(m_{1b}+\dfrac{m_{1r}}{3} + m_{2b} + m_{2r} + m_{3b} + m_{3r}\right)l_1^2 \dot{\theta}_1^2 + \dfrac{1}{2}\left(m_{2b} + \dfrac{m_{2r}}{3} + m_{3b} + m_{3r}\right)l_2^2 \dot{\theta}_2^2 + \dfrac{1}{2}\left(m_{3b} + \dfrac{m_{3r}}{3}\right)l_3^2 \dot{\theta}_3^2 + \left(m_{2b} + \dfrac{m_{2r}}{2} + m_{3b} + m_{3r}\right)l_1l_2\dot{\theta}_1\dot{\theta}_2\cos{\Delta_{21}} + \left(m_{3b} + \dfrac{m_{3r}}{2}\right)l_3(l_2\dot{\theta}_2\dot{\theta}_3\cos{\Delta_{32}}+l_1\dot{\theta}_1\dot{\theta}_3\cos{\Delta_{31}}) \end{aligned}

Defining M1=m1b+m1r3+m2b+m2r+m3b+m3rM_1 = m_{1b}+\dfrac{m_{1r}}{3} + m_{2b} + m_{2r} + m_{3b} + m_{3r}, M2=m2b+m2r3+m3b+m3rM_2 = m_{2b} + \dfrac{m_{2r}}{3} + m_{3b} + m_{3r}, M3=m3b+m3r3M_3 = m_{3b} + \dfrac{m_{3r}}{3}, μ1=m1b+m1r2+m2b+m2r+m3b+m3r\mu_1 = m_{1b}+\dfrac{m_{1r}}{2} + m_{2b} + m_{2r} + m_{3b} + m_{3r}, μ2=m2b+m2r2+m3b+m3r\mu_2 = m_{2b} + \dfrac{m_{2r}}{2} + m_{3b} + m_{3r} and μ3=m3b+m3r2\mu_3 = m_{3b} + \dfrac{m_{3r}}{2}.

T=M1l12θ˙122+M2l22θ˙222+M3l32θ˙322+μ2l1l2θ˙1θ˙2cos⁡Δ21+μ3l3θ˙3(l2θ˙2cos⁡Δ32+l1θ˙1cos⁡Δ31).\begin{aligned} T &= \dfrac{M_1 l_1^2 \dot{\theta}_1^2}{2} + \dfrac{M_2 l_2^2 \dot{\theta}_2^2}{2} + \dfrac{M_3 l_3^2 \dot{\theta}_3^2}{2} + \mu_2 l_1l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\Delta_{21}} + \mu_3 l_3\dot{\theta}_3(l_2\dot{\theta}_2\cos{\Delta_{32}}+l_1\dot{\theta}_1\cos{\Delta_{31}}). \end{aligned}

Potential energy

V=m1bgy1b+m1rgy1r+m2bgy2b+m2rgy2r+m3bgy3b+m3rgy3r=m1bgl1sin⁡θ1+m1rgl1sin⁡θ12+m2bg(l1sin⁡θ1+l2sin⁡θ2)+m2rg(l1sin⁡θ1+l2sin⁡θ22)+m3bg(l1sin⁡θ1+l2sin⁡θ2+l3sin⁡θ3)+m3rg(l1sin⁡θ1+l2sin⁡θ2+l3sin⁡θ32)=μ1gl1sin⁡θ1+μ2gl2sin⁡θ2+μ3gl3sin⁡θ3.\begin{aligned} V &= m_{1b} gy_{1b} + m_{1r}gy_{1r} + m_{2b}gy_{2b} + m_{2r}gy_{2r} + m_{3b}gy_{3b} + m_{3r}gy_{3r} \\ &= m_{1b}gl_1 \sin{\theta_1} + \dfrac{m_{1r}gl_1\sin{\theta_1}}{2} + m_{2b} g(l_1\sin{\theta_1} + l_2\sin{\theta_2}) + m_{2r}g\left(l_1\sin{\theta_1}+\dfrac{l_2\sin{\theta_2}}{2}\right) + m_{3b} g(l_1\sin{\theta_1} + l_2\sin{\theta_2}+l_3\sin{\theta_3}) + m_{3r}g\left(l_1\sin{\theta_1} + l_2\sin{\theta_2} +\dfrac{l_3\sin{\theta_3}}{2}\right) \\ &= \mu_1 gl_1 \sin{\theta_1} + \mu_2 gl_2\sin{\theta_2} + \mu_3 gl_3\sin{\theta_3}. \end{aligned}

Lagrangian

L=T−V=M1l12θ˙122+M2l22θ˙222+M3l32θ˙322+μ2l1l2θ˙1θ˙2cos⁡Δ21+μ3l3θ˙3(l2θ˙2cos⁡Δ32+l1θ˙1cos⁡Δ31)−μ1gl1sin⁡θ1−μ2gl2sin⁡θ2−μ3gl3sin⁡θ3=M1l12θ˙122+M2l22θ˙222+M3l32θ˙322+μ2l2(l1θ˙1θ˙2cos⁡Δ21−gsin⁡θ2)+μ3l3(θ˙3(l2θ˙2cos⁡Δ32+l1θ˙1cos⁡Δ31)−gsin⁡θ3)−μ1gl1sin⁡θ1.\begin{aligned} \mathcal{L} &= T - V\\ &= \dfrac{M_1 l_1^2 \dot{\theta}_1^2}{2} + \dfrac{M_2 l_2^2 \dot{\theta}_2^2}{2} + \dfrac{M_3 l_3^2 \dot{\theta}_3^2}{2} + \mu_2 l_1l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\Delta_{21}} + \mu_3 l_3\dot{\theta}_3(l_2\dot{\theta}_2\cos{\Delta_{32}}+l_1\dot{\theta}_1\cos{\Delta_{31}}) - \mu_1 gl_1 \sin{\theta_1} - \mu_2 gl_2\sin{\theta_2} - \mu_3 gl_3\sin{\theta_3} \\ &= \dfrac{M_1 l_1^2 \dot{\theta}_1^2}{2} + \dfrac{M_2 l_2^2 \dot{\theta}_2^2}{2} + \dfrac{M_3 l_3^2 \dot{\theta}_3^2}{2} + \mu_2 l_2(l_1 \dot{\theta}_1 \dot{\theta}_2 \cos{\Delta_{21}}-g\sin{\theta_2}) + \mu_3 l_3(\dot{\theta}_3(l_2\dot{\theta}_2\cos{\Delta_{32}}+l_1\dot{\theta}_1\cos{\Delta_{31}})-g\sin{\theta_3}) - \mu_1 gl_1 \sin{\theta_1}. \end{aligned}

Generalized dissipative force

θ1\theta_1

Qθ1=−(b1b+c1b∣v1b∣)v⃗1b⋅e^1b,θ1−(b1r+c1r∣v1r∣)v⃗1r⋅e^1r,θ1−(b2b+c2b∣v2b∣)v⃗2b⋅e^2b,θ1−(b2r+c2r∣v2r∣)v⃗2r⋅e^2r,θ1−(b3b+c3b∣v3b∣)v⃗3b⋅e^3b,θ1−(b3r+c3r∣v3r∣)v⃗3r⋅e^3r,θ1.\begin{aligned} Q_{\theta_1} &= -(b_{1b}+c_{1b}|v_{1b}|)\vec{v}_{1b} \cdot \hat{e}_{1b, \theta_1}-(b_{1r}+c_{1r}|v_{1r}|)\vec{v}_{1r} \cdot \hat{e}_{1r, \theta_1} -(b_{2b}+c_{2b}|v_{2b}|)\vec{v}_{2b} \cdot \hat{e}_{2b, \theta_1}-(b_{2r}+c_{2r}|v_{2r}|)\vec{v}_{2r} \cdot \hat{e}_{2r, \theta_1} -(b_{3b}+c_{3b}|v_{3b}|)\vec{v}_{3b} \cdot \hat{e}_{3b, \theta_1}-(b_{3r}+c_{3r}|v_{3r}|)\vec{v}_{3r} \cdot \hat{e}_{3r, \theta_1}. \end{aligned}

We will not substitute our values of v2bv_{2b} to v3rv_{3r} as they will only complicate our equation

Qθ1=−(b1b+c1bl1∣θ˙1∣)l12θ˙1−(b1r+c1rl1∣θ˙1∣2)l12θ˙14−(b2b+c2b∣v2b∣)(l12θ˙1+l1l2θ˙2cos⁡Δ21)−(b2r+c2r∣v2r∣)(l12θ˙1+l1l2θ˙2cos⁡Δ212)−(b3b+c3b∣v3b∣)(l12θ˙1+l1l2θ˙2cos⁡Δ21+l1l3θ˙3cos⁡Δ31)−(b3r+c3r∣v3r∣)(l12θ˙1+l1l2θ˙2cos⁡Δ21+l1l3θ˙3cos⁡Δ312).\begin{aligned} Q_{\theta_1} &=-(b_{1b}+c_{1b}l_1|\dot{\theta}_1|)l_1^2 \dot{\theta}_1-\left(b_{1r}+c_{1r}\dfrac{l_1|\dot{\theta}_1|}{2}\right)\dfrac{l_1^2 \dot{\theta}_1}{4} -(b_{2b}+c_{2b}|v_{2b}|)(l_1^2\dot{\theta}_1 + l_1l_2\dot{\theta}_2\cos{\Delta_{21}})-(b_{2r}+c_{2r}|v_{2r}|)(l_1^2\dot{\theta}_1 + \dfrac{l_1l_2\dot{\theta}_2\cos{\Delta_{21}}}{2}) -(b_{3b}+c_{3b}|v_{3b}|)(l_1^2\dot{\theta}_1 + l_1l_2\dot{\theta}_2\cos{\Delta_{21}}+l_1l_3\dot{\theta}_3\cos{\Delta_{31}})-(b_{3r}+c_{3r}|v_{3r}|)(l_1^2\dot{\theta}_1 + l_1l_2\dot{\theta}_2\cos{\Delta_{21}}+\dfrac{l_1l_3\dot{\theta}_3\cos{\Delta_{31}}}{2}). \end{aligned}

θ2\theta_2

The generalized dissipative force for θ2\theta_2 is (pendulum 1 terms are ignored because their generalized basis vectors are zero)

Qθ2=−(b2b+c2b∣v2b∣)v⃗2b⋅e^2b,θ2−(b2r+c2r∣v2r∣)v⃗2r⋅e^2r,θ2−(b3b+c3b∣v3b∣)v⃗3b⋅e^3b,θ2−(b3r+c3r∣v3r∣)v⃗3r⋅e^3r,θ2=−(b2b+c2b∣v2b∣)(l22θ˙2+l1l2θ˙1cos⁡Δ21)−(b2r+c2r∣v2r∣)(l22θ˙24+l1l2θ˙1cos⁡Δ212)−(b3b+c3b∣v3b∣)(l22θ˙2+l1l2θ˙1cos⁡Δ21+l2l3θ˙3cos⁡Δ32)−(b3r+c3r∣v3r∣)(l22θ˙2+l1l2θ˙1cos⁡Δ21+l2l3θ˙3cos⁡Δ322).\begin{aligned} Q_{\theta_2} &= -(b_{2b}+c_{2b}|v_{2b}|)\vec{v}_{2b} \cdot \hat{e}_{2b, \theta_2} - (b_{2r}+c_{2r}|v_{2r}|) \vec{v}_{2r} \cdot \hat{e}_{2r, \theta_2} -(b_{3b}+c_{3b}|v_{3b}|)\vec{v}_{3b} \cdot \hat{e}_{3b, \theta_2} - (b_{3r}+c_{3r}|v_{3r}|) \vec{v}_{3r} \cdot \hat{e}_{3r, \theta_2}\\ &= -(b_{2b}+c_{2b}|v_{2b}|)(l_2^2 \dot{\theta}_2 + l_1l_2 \dot{\theta}_1 \cos{\Delta_{21}}) - (b_{2r}+c_{2r}|v_{2r}|) (\dfrac{l_2^2 \dot{\theta}_2}{4} + \dfrac{l_1l_2 \dot{\theta}_1 \cos{\Delta_{21}}}{2}) -(b_{3b}+c_{3b}|v_{3b}|)(l_2^2\dot{\theta}_2 + l_1l_2 \dot{\theta}_1\cos{\Delta_{21}} + l_2l_3\dot{\theta}_3 \cos{\Delta_{32}}) - (b_{3r}+c_{3r}|v_{3r}|) (l_2^2\dot{\theta}_2 + l_1l_2 \dot{\theta}_1\cos{\Delta_{21}} + \dfrac{l_2l_3\dot{\theta}_3 \cos{\Delta_{32}}}{2}). \end{aligned}

θ3\theta_3

Qθ3=−(b3b+c3b∣v3b∣)v⃗3b⋅e^3b,θ3−(b3r+c3r∣v3r∣)v⃗3r⋅e^3r,θ3=−(b3b+c3b∣v3b∣)(l32θ˙3+l1l3θ˙1cos⁡Δ31+l2l3θ˙2cos⁡Δ32)−(b3r+c3r∣v3r∣)(l32θ˙34+l1l3θ˙1cos⁡Δ312+l2l3θ˙3cos⁡Δ322).\begin{aligned} Q_{\theta_3} &= -(b_{3b}+c_{3b}|v_{3b}|)\vec{v}_{3b} \cdot \hat{e}_{3b, \theta_3} - (b_{3r}+c_{3r}|v_{3r}|) \vec{v}_{3r} \cdot \hat{e}_{3r, \theta_3}\\ &= -(b_{3b}+c_{3b}|v_{3b}|)(l_3^2\dot{\theta}_3 + l_1l_3 \dot{\theta}_1\cos{\Delta_{31}} + l_2l_3\dot{\theta}_2 \cos{\Delta_{32}}) - (b_{3r}+c_{3r}|v_{3r}|) \left(\dfrac{l_3^2\dot{\theta}_3}{4} + \dfrac{l_1l_3 \dot{\theta}_1\cos{\Delta_{31}}}{2} + \dfrac{l_2l_3\dot{\theta}_3 \cos{\Delta_{32}}}{2}\right). \end{aligned}

Left-hand side of the Euler-Lagrange equations

θ1\theta_1

pθ1=∂L∂θ˙1=M1l12θ˙1+μ2l1l2θ˙2cos⁡Δ21+μ3l1l3θ˙3cos⁡Δ31p˙θ1=M1l12θ¨1+μ2l1l2(θ¨2cos⁡Δ21−θ˙2(θ˙2−θ1)sin⁡Δ21)+μ3l1l3(θ¨3cos⁡Δ31−θ˙3(θ˙3−θ1˙)sin⁡Δ31)Fθ1=∂L∂θ1=−μ2l1l2θ˙1θ˙2∂Δ21∂θ1sin⁡Δ21−μ3l1l3θ˙1θ˙3∂Δ31∂θ1sin⁡Δ31−μ1gl1cos⁡θ1=μ2l1l2θ˙1θ˙2sin⁡Δ21+μ3l1l3θ˙1θ˙3sin⁡Δ31−μ1gl1cos⁡θ1\begin{aligned} p_{\theta_1} &= \dfrac{\partial \mathcal{L}}{\partial \dot{\theta}_1} \\ &= M_1 l_1^2 \dot{\theta}_1 + \mu_2 l_1l_2 \dot{\theta}_2\cos{\Delta_{21}} + \mu_3 l_1 l_3\dot{\theta}_3\cos{\Delta_{31}} \\ \dot{p}_{\theta_1} &= M_1 l_1^2 \ddot{\theta}_1 + \mu_2 l_1l_2 (\ddot{\theta}_2\cos{\Delta_{21}} - \dot{\theta}_2(\dot{\theta}_2-\theta_1)\sin{\Delta_{21}}) + \mu_3 l_1 l_3(\ddot{\theta}_3\cos{\Delta_{31}} - \dot{\theta}_3(\dot{\theta}_3-\dot{\theta_1})\sin{\Delta_{31}}) \\ F_{\theta_1} &= \dfrac{\partial \mathcal{L}}{\partial \theta_1} \\ &= -\mu_2 l_1 l_2 \dot{\theta}_1\dot{\theta}_2\dfrac{\partial \Delta_{21}}{\partial \theta_1}\sin{\Delta_{21}} - \mu_3l_1 l_3\dot{\theta}_1\dot{\theta}_3\dfrac{\partial \Delta_{31}}{\partial \theta_1}\sin{\Delta_{31}} - \mu_1 gl_1\cos{\theta_1} \\ &= \mu_2 l_1 l_2 \dot{\theta}_1\dot{\theta}_2\sin{\Delta_{21}} + \mu_3l_1 l_3\dot{\theta}_1\dot{\theta}_3\sin{\Delta_{31}} - \mu_1 gl_1\cos{\theta_1} \end{aligned}
δθ1′L=p˙θ1−Fθ1=M1l12θ¨1+μ2l1l2(θ¨2cos⁡Δ21−θ˙2(θ˙2−θ1)sin⁡Δ21)+μ3l1l3(θ¨3cos⁡Δ31−θ˙3(θ˙3−θ1˙)sin⁡Δ31)−μ2l1l2θ˙1θ˙2sin⁡Δ21+μ3l1l3θ˙1θ˙3sin⁡Δ31+μ1gl1cos⁡θ1=M1l12θ¨1+μ2l1l2(θ¨2cos⁡Δ21−[θ˙2(θ˙2−θ1)+θ˙1θ˙2]sin⁡Δ21)+μ3l1l3(θ¨3cos⁡Δ31−[θ˙3(θ˙3−θ1˙)+θ˙1θ˙3]sin⁡Δ31)+μ1gl1cos⁡θ1=M1l12θ¨1+μ2l1l2(θ¨2cos⁡Δ21−θ˙2(θ˙2−θ1)sin⁡Δ21)+μ3l1l3(θ¨3cos⁡Δ31−θ˙3(θ˙3−θ1˙)sin⁡Δ31)−μ2l1l2θ˙1θ˙2sin⁡Δ21+μ3l1l3θ˙1θ˙3sin⁡Δ31+μ1gl1cos⁡θ1=M1l12θ¨1+μ2l1l2(θ¨2cos⁡Δ21−θ˙22sin⁡Δ21)+μ3l1l3(θ¨3cos⁡Δ31−θ˙32sin⁡Δ31)+μ1gl1cos⁡θ1.\begin{aligned} \delta'_{\theta_1} \mathcal{L} &= \dot{p}_{\theta_1} - F_{\theta_1} \\ &= M_1 l_1^2 \ddot{\theta}_1 + \mu_2 l_1l_2 (\ddot{\theta}_2\cos{\Delta_{21}} - \dot{\theta}_2(\dot{\theta}_2-\theta_1)\sin{\Delta_{21}}) + \mu_3 l_1 l_3(\ddot{\theta}_3\cos{\Delta_{31}} - \dot{\theta}_3(\dot{\theta}_3-\dot{\theta_1})\sin{\Delta_{31}}) - \mu_2 l_1 l_2 \dot{\theta}_1\dot{\theta}_2\sin{\Delta_{21}} + \mu_3l_1 l_3\dot{\theta}_1\dot{\theta}_3\sin{\Delta_{31}} + \mu_1 gl_1\cos{\theta_1}\\ &= M_1 l_1^2 \ddot{\theta}_1 + \mu_2 l_1l_2 (\ddot{\theta}_2\cos{\Delta_{21}} - [\dot{\theta}_2(\dot{\theta}_2-\theta_1)+\dot{\theta}_1\dot{\theta}_2]\sin{\Delta_{21}}) + \mu_3 l_1 l_3(\ddot{\theta}_3\cos{\Delta_{31}} - [\dot{\theta}_3(\dot{\theta}_3-\dot{\theta_1})+\dot{\theta}_1\dot{\theta}_3]\sin{\Delta_{31}}) + \mu_1 gl_1\cos{\theta_1} \\ &= M_1 l_1^2 \ddot{\theta}_1 + \mu_2 l_1l_2 (\ddot{\theta}_2\cos{\Delta_{21}} - \dot{\theta}_2(\dot{\theta}_2-\theta_1)\sin{\Delta_{21}}) + \mu_3 l_1 l_3(\ddot{\theta}_3\cos{\Delta_{31}} - \dot{\theta}_3(\dot{\theta}_3-\dot{\theta_1})\sin{\Delta_{31}}) - \mu_2 l_1 l_2 \dot{\theta}_1\dot{\theta}_2\sin{\Delta_{21}} + \mu_3l_1 l_3\dot{\theta}_1\dot{\theta}_3\sin{\Delta_{31}} + \mu_1 gl_1\cos{\theta_1}\\ &= M_1 l_1^2 \ddot{\theta}_1 + \mu_2 l_1l_2 (\ddot{\theta}_2\cos{\Delta_{21}} - \dot{\theta}_2^2\sin{\Delta_{21}}) + \mu_3 l_1 l_3(\ddot{\theta}_3\cos{\Delta_{31}} - \dot{\theta}_3^2\sin{\Delta_{31}}) + \mu_1 gl_1\cos{\theta_1}. \end{aligned}

θ2\theta_2

pθ2=∂L∂θ˙2=M2l22θ˙2+μ2l1l2θ˙1cos⁡Δ21+μ3l2l3θ˙3cos⁡Δ32p˙θ2=M2l22θ¨2+μ2l1l2(θ¨1cos⁡Δ21−θ˙1(θ˙2−θ˙1)sin⁡Δ21)+μ3l2l3(θ¨3cos⁡Δ32−θ˙3(θ˙3−θ˙2)sin⁡Δ32)Fθ2=−μ2l2(l1θ˙1θ˙2∂Δ21∂θ2sin⁡Δ21+gcos⁡θ2)−μ3l2l3θ˙2θ˙3∂Δ32∂θ2sin⁡Δ32=−μ2l2(l1θ˙1θ˙2sin⁡Δ21+gcos⁡θ2)+μ3l2l3θ˙2θ˙3sin⁡Δ32δθ2′L=M2l22θ¨2+μ2l1l2(θ¨1cos⁡Δ21−θ˙1(θ˙2−θ˙1)sin⁡Δ21)+μ3l2l3(θ¨3cos⁡Δ32−θ˙3(θ˙3−θ˙2)sin⁡Δ32)+μ2l2(l1θ˙1θ˙2sin⁡Δ21+gcos⁡θ2)−μ3l2l3θ˙2θ˙3sin⁡Δ32=M2l22θ¨2+μ2l1l2(θ¨1cos⁡Δ21+θ˙12sin⁡Δ21)+μ3l2l3(θ¨3cos⁡Δ32−θ˙32sin⁡Δ32)+μ2l2gcos⁡θ2=M2l22θ¨2+μ2l2(l1(θ¨1cos⁡Δ21+θ˙12sin⁡Δ21)+gcos⁡θ2)+μ3l2l3(θ¨3cos⁡Δ32−θ˙32sin⁡Δ32).\begin{aligned} p_{\theta_2} &= \dfrac{\partial \mathcal{L}}{\partial \dot{\theta}_2} \\ &= M_2 l_2^2 \dot{\theta}_2 + \mu_2 l_1l_2 \dot{\theta}_1\cos{\Delta_{21}} + \mu_3 l_2l_3 \dot{\theta}_3 \cos{\Delta_{32}}\\ \dot{p}_{\theta_2} &= M_2 l_2^2 \ddot{\theta}_2 + \mu_2 l_1l_2 (\ddot{\theta}_1\cos{\Delta_{21}} - \dot{\theta}_1 (\dot{\theta}_2-\dot{\theta}_1)\sin{\Delta_{21}})+ \mu_3 l_2l_3 (\ddot{\theta}_3 \cos{\Delta_{32}} -\dot{\theta}_3 (\dot{\theta}_3-\dot{\theta}_2)\sin{\Delta_{32}})\\ F_{\theta_2} &= -\mu_2 l_2(l_1\dot{\theta}_1\dot{\theta}_2 \dfrac{\partial \Delta_{21}}{\partial \theta_2}\sin{\Delta_{21}}+g\cos{\theta_2}) - \mu_3 l_2l_3\dot{\theta}_2\dot{\theta}_3\dfrac{\partial \Delta_{32}}{\partial \theta_2}\sin{\Delta_{32}}\\ &= -\mu_2 l_2(l_1\dot{\theta}_1\dot{\theta}_2 \sin{\Delta_{21}}+g\cos{\theta_2}) + \mu_3 l_2l_3\dot{\theta}_2\dot{\theta}_3\sin{\Delta_{32}}\\ \delta'_{\theta_2} \mathcal{L} &= M_2 l_2^2 \ddot{\theta}_2 + \mu_2 l_1l_2 (\ddot{\theta}_1\cos{\Delta_{21}} - \dot{\theta}_1 (\dot{\theta}_2-\dot{\theta}_1)\sin{\Delta_{21}})+ \mu_3 l_2l_3 (\ddot{\theta}_3 \cos{\Delta_{32}} -\dot{\theta}_3 (\dot{\theta}_3-\dot{\theta}_2)\sin{\Delta_{32}}) + \mu_2 l_2(l_1\dot{\theta}_1\dot{\theta}_2 \sin{\Delta_{21}}+g\cos{\theta_2}) - \mu_3 l_2l_3\dot{\theta}_2\dot{\theta}_3\sin{\Delta_{32}} \\ &= M_2 l_2^2 \ddot{\theta}_2 + \mu_2 l_1l_2 (\ddot{\theta}_1\cos{\Delta_{21}} + \dot{\theta}_1^2\sin{\Delta_{21}})+ \mu_3 l_2l_3 (\ddot{\theta}_3 \cos{\Delta_{32}} -\dot{\theta}_3^2\sin{\Delta_{32}}) +\mu_2 l_2g\cos{\theta_2} \\ &= M_2 l_2^2 \ddot{\theta}_2 + \mu_2 l_2 (l_1(\ddot{\theta}_1\cos{\Delta_{21}} + \dot{\theta}_1^2\sin{\Delta_{21}})+g\cos{\theta_2})+ \mu_3 l_2l_3 (\ddot{\theta}_3 \cos{\Delta_{32}} -\dot{\theta}_3^2\sin{\Delta_{32}}). \end{aligned}

θ3\theta_3

pθ3=∂L∂θ˙3=M3l32θ˙3+μ3l3(l2θ˙2cos⁡Δ32+l1θ˙1cos⁡Δ31)p˙θ3=M3l32θ¨3+μ3l3(l2(θ¨2cos⁡Δ32−θ˙2(θ˙3−θ˙2)sin⁡Δ32)+l1(θ¨1cos⁡Δ31−θ˙1(θ˙3−θ˙1)sin⁡Δ31))Fθ3=∂L∂θ3=−μ3l3[θ˙3(l2θ˙2∂Δ32∂θ3sin⁡Δ32+l1θ˙1∂Δ31∂θ3sin⁡Δ31)+gcos⁡θ3]=−μ3l3[θ˙3(l2θ˙2sin⁡Δ32+l1θ˙1sin⁡Δ31)+gcos⁡θ3]δθ3′L=M3l32θ¨3+μ3l3(l2(θ¨2cos⁡Δ32−θ˙2(θ˙3−θ˙2)sin⁡Δ32)+l1(θ¨1cos⁡Δ31−θ˙1(θ˙3−θ˙1)sin⁡Δ31))+μ3l3[θ˙3(l2θ˙2sin⁡Δ32+l1θ˙1sin⁡Δ31)+gcos⁡θ3]=M3l32θ¨3+μ3l3[l2(θ¨2cos⁡Δ32+θ˙22sin⁡Δ32)+l1(θ¨1cos⁡Δ31+θ˙12sin⁡Δ31)+gcos⁡θ3].\begin{aligned} p_{\theta_3} &= \dfrac{\partial \mathcal{L}}{\partial \dot{\theta}_3} \\ &= M_3 l_3^2 \dot{\theta}_3 + \mu_3 l_3(l_2 \dot{\theta}_2\cos{\Delta_{32}}+l_1\dot{\theta}_1\cos{\Delta_{31}}) \\ \dot{p}_{\theta_3} &= M_3 l_3^2 \ddot{\theta}_3 + \mu_3 l_3(l_2 (\ddot{\theta}_2\cos{\Delta_{32}} - \dot{\theta}_2 (\dot{\theta}_3-\dot{\theta}_2)\sin{\Delta_{32}})+l_1(\ddot{\theta}_1\cos{\Delta_{31}}-\dot{\theta}_1(\dot{\theta}_3-\dot{\theta}_1)\sin{\Delta_{31}})) \\ F_{\theta_3} &= \dfrac{\partial \mathcal{L}}{\partial \theta_3} \\ &= -\mu_3 l_3\left[\dot{\theta}_3 (l_2\dot{\theta}_2 \dfrac{\partial \Delta_{32}}{\partial \theta_3}\sin{\Delta_{32}}+l_1\dot{\theta}_1\dfrac{\partial \Delta_{31}}{\partial \theta_3}\sin{\Delta_{31}}) + g\cos{\theta_3}\right] \\ &= -\mu_3 l_3\left[\dot{\theta}_3 (l_2\dot{\theta}_2 \sin{\Delta_{32}}+l_1\dot{\theta}_1\sin{\Delta_{31}}) + g\cos{\theta_3}\right] \\ \delta'_{\theta_3} \mathcal{L} &= M_3l_3^2 \ddot{\theta}_3 + \mu_3 l_3(l_2 (\ddot{\theta}_2\cos{\Delta_{32}} - \dot{\theta}_2 (\dot{\theta}_3-\dot{\theta}_2)\sin{\Delta_{32}})+l_1(\ddot{\theta}_1\cos{\Delta_{31}}-\dot{\theta}_1(\dot{\theta}_3-\dot{\theta}_1)\sin{\Delta_{31}})) + \mu_3 l_3\left[\dot{\theta}_3 (l_2\dot{\theta}_2 \sin{\Delta_{32}}+l_1\dot{\theta}_1\sin{\Delta_{31}}) + g\cos{\theta_3}\right]\\ &= M_3l_3^2 \ddot{\theta}_3 + \mu_3 l_3\left[l_2 (\ddot{\theta}_2\cos{\Delta_{32}} + \dot{\theta}_2^2\sin{\Delta_{32}})+l_1(\ddot{\theta}_1\cos{\Delta_{31}}+\dot{\theta}_1^2\sin{\Delta_{31}})+g\cos{\theta_3}\right]. \end{aligned}

Final system

Hence given our equations of motion are δθi′L=Qθi\delta'_{\theta_i}\mathcal{L} = Q_{\theta_i}, we could write them in matrix form as (given how long QθiQ_{\theta_i} is, we will not expand on it)

[M1l12μ2l1l2cos⁡Δ21μ3l1l3cos⁡Δ31μ2l1l2cos⁡Δ21M2l22μ3l2l3cos⁡Δ32μ3l1l3cos⁡Δ31μ3l2l3cos⁡Δ32M3l32][θ¨1θ¨2θ¨3]=[Qθ1−μ1gl1cos⁡θ1+μ2l1l2θ˙22sin⁡Δ21+μ3l1l3θ˙32sin⁡Δ31Qθ2−μ2l2(l1θ˙12sin⁡Δ21+gcos⁡θ2)+μ3l2l3θ˙32sin⁡Δ32Qθ3−μ3l3(l1θ˙12sin⁡Δ31+l2θ˙22sin⁡Δ32+gcos⁡θ3)].\begin{aligned} \begin{bmatrix} M_1 l_1^2 & \mu_2 l_1l_2 \cos{\Delta_{21}} & \mu_3 l_1l_3 \cos{\Delta_{31}} \\ \mu_2 l_1l_2 \cos{\Delta_{21}} & M_2 l_2^2 & \mu_3 l_2l_3 \cos{\Delta_{32}} \\ \mu_3 l_1l_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_1gl_1\cos{\theta_1} + \mu_2 l_1l_2\dot{\theta}_2^2 \sin{\Delta_{21}} + \mu_3l_1l_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_2l_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}