Derivation of the equations of motion of the double pendulum

This webpage derives the equations of motion for the double pendulum. To see their solution, obtained via the Runge-Kutta-Fehlberg fourth-order method with fifth-order error checking (RKF45), go to this page.

The problem of the double pendulum has been widely analysed in the mechanics literature. Its most simplified version involves two pendulums, with the second attached to the first at the bob, the rods being massless and there being no friction and air resistance. Even this simplified version is subject to chaos and has equations of motion far more complicated than that of the simple pendulum. In this webpage, we will be deriving the equations of motion with dissipative forces and rods with mass.

Figure 1: Diagram of the double pendulum.

Figure 1 depicts the double pendulum system being analysed. Most physicists treat θ1\theta_1 and θ2\theta_2 as being relative to the negative y-axis instead of the positive x-axis. I, as primarily a mathematician, prefer the positive (x)-axis as the point of reference for angles as I find it more intuitive.

Euler-Lagrange equations with generalized dissipation force

To obtain our equations of motion, we must apply the Euler-Lagrange equations with generalized dissipation force (QiQ_i which is on the right-hand side of the following equation)[1]

ddtLqi˙Lqi=Qi.\begin{aligned} \dfrac{d}{dt}\dfrac{\partial \mathcal{L}}{\partial \dot{q_i}} - \dfrac{\partial \mathcal{L}}{\partial q_i} &= Q_i. \end{aligned}

Where

  • L\mathcal{L} is the Lagrangian — the difference between the kinetic energy and potential energy of the system.

  • (qi)=(θ1,θ2)(q_i)=(\theta_1,\theta_2) are the generalized coordinates of the system.

  • Qi=jFD,je^j,iQ_i=\displaystyle \sum_j \vec{F}_{D,j} \cdot \hat{e}_{j,i} is the generalized dissipation force.

  • j=1b,1r,2b,2rj=1b,1r,2b,2r refers to the moving components of our double pendulum system, namely the two bobs and two rods.

  • FD,j\vec{F}_{D,j} is the dissipation forces acting on the jjth component of the system.

  • rj\vec{r}_j is the position vector for the jjth component of the system.

  • e^j,i=rjqi\hat{e}_{j,i}=\dfrac{\partial \vec{r}_j}{\partial q_i} is the generalized basis vector.

Position, velocity and generalized basis vector

Bob 1

The first pendulum bob would have the coordinates, velocity and generalized basis vector

x1b=l1cosθ1 x˙1b=l1θ˙1sinθ1y1b=l1sinθ1 y˙1b=l1θ˙1cosθ1r1b=[x1by1b]v1b=dr1bdt=l1[sinθ1cosθ1]=l1θ˙1[sinθ1cosθ1]e1b,θ1=r1bθ1v1b2=x˙1b2+y˙1b2=l1[sinθ1cosθ1]=(l1θ˙1sinθ1)2+(l1θ˙1cosθ1)2e1b,θ2=r1bθ2=l12θ˙12=[00].\begin{aligned} x_{1b} &= l_1 \cos{\theta_1} &\implies \dot{x}_{1b} &= -l_1\dot{\theta}_1 \sin{\theta_1}\\ y_{1b} &= l_1 \sin{\theta_1} &\implies \dot{y}_{1b} &= l_1 \dot{\theta}_1 \cos{\theta_1} \\ \vec{r}_{1b} &= \begin{bmatrix} x_{1b}\\ y_{1b} \end{bmatrix} &\therefore \vec{v}_{1b} &= \dfrac{d \vec{r}_{1b}}{dt}\\ &= l_1\begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix} & &=l_1\dot{\theta}_1 \begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix} \\ \vec{e}_{1b,\theta_1} &= \dfrac{\partial \vec{r}_{1b}}{\partial \theta_1}& v_{1b}^2 &= \dot{x}_{1b}^2 + \dot{y}_{1b}^2 \\ &= l_1 \begin{bmatrix} -\sin{\theta_1}\\ \cos{\theta_1} \end{bmatrix} & &= \left(-l_1\dot{\theta}_1 \sin{\theta_1}\right)^2 + \left(l_1 \dot{\theta}_1 \cos{\theta_1}\right)^2 \\ \vec{e}_{1b,\theta_2} &= \dfrac{\partial \vec{r}_{1b}}{\partial \theta_2} &&= l_1^2 \dot{\theta}_1^2\\ &= \begin{bmatrix} 0\\ 0 \end{bmatrix}. \end{aligned}

Rod 1

The first pendulum rod would have the coordinates, velocity and generalized basis vector below. It is important to note that we are analysing its effect on the motion of the pendulum based on the centre of mass approach.

x1r=l1cosθ12 x˙1r=l1θ˙1sinθ12y1r=l1sinθ12 y˙1r=l1θ˙1cosθ12r1r=[x1ry1r]v1r=dr1rdt=l12[cosθ1sinθ1]=l1θ˙12[sinθ1cosθ1]e1r,θ1=r1rθ1v1r2=x˙1r2+y˙1r2=l12[sinθ1cosθ1]=(l1θ˙1sinθ12)2+(l1θ˙1cosθ12)2e1r,θ2=r1rθ2=l12θ˙124=[00].\begin{aligned} x_{1r} &= \dfrac{l_1\cos{\theta_1}}{2} &\implies \dot{x}_{1r} &= -\dfrac{l_1\dot{\theta}_1\sin{\theta_1}}{2}\\ y_{1r} &= \dfrac{l_1\sin{\theta_1}}{2} &\implies \dot{y}_{1r} &= \dfrac{l_1\dot{\theta}_1\cos{\theta_1}}{2}\\ \vec{r}_{1r} &= \begin{bmatrix} x_{1r} \\ y_{1r} \end{bmatrix} &\therefore \vec{v}_{1r} &= \dfrac{d\vec{r}_{1r}}{dt} \\ &= \dfrac{l_1}{2}\begin{bmatrix} \cos{\theta_1}\\ \sin{\theta_1} \end{bmatrix} & &= \dfrac{l_1\dot{\theta}_1}{2} \begin{bmatrix} -\sin{\theta_1}\\ \cos{\theta_1} \end{bmatrix} \\ \vec{e}_{1r,\theta_1} &= \dfrac{\partial \vec{r}_{1r}}{\partial \theta_1} & v_{1r}^2 &= \dot{x}_{1r}^2 + \dot{y}_{1r}^2 \\ &= \dfrac{l_1}{2} \begin{bmatrix} -\sin{\theta_1}\\ \cos{\theta_1} \end{bmatrix} & &= \left(-\dfrac{l_1\dot{\theta}_1 \sin{\theta_1}}{2}\right)^2 + \left(\dfrac{l_1 \dot{\theta}_1 \cos{\theta_1}}{2}\right)^2 \\ \vec{e}_{1r,\theta_2} &= \dfrac{\partial \vec{r}_{1r}}{\partial \theta_2} &&= \dfrac{l_1^2 \dot{\theta}_1^2}{4} \\ &= \begin{bmatrix} 0 \\ 0 \end{bmatrix}. \end{aligned}

Bob 2

x2b=x1b+l2cosθ2x˙2b=l1θ˙1sinθ1l2θ˙2sinθ2=l1cosθ1+l2cosθ2y˙2b=l1θ˙1cosθ1+l2θ˙2cosθ2y2b=y1b+l2sinθ2v2b=[l1θ˙1sinθ1l2θ˙2sinθ2l1θ˙1cosθ1+l2θ˙2cosθ2]=l1sinθ1+l2sinθ2v2b2=x˙2b2+y˙2b2r2b=[x2by2b]=(l1θ˙1sinθ1l2θ˙2sinθ2)2+(l1θ˙1cosθ1+l2θ˙2cosθ2)2=[l1cosθ1+l2cosθ2l1sinθ1+l2sinθ2]=l12θ˙12sin2θ1+l22θ˙22sin2θ2+2l1l2θ˙1θ˙2sinθ1sinθ2+l12θ˙12cos2θ1+l22θ˙22cos2θ2+e2b,θ1=r2bθ12l1l2θ˙1θ˙2cosθ1cosθ2=l1[sinθ1cosθ1]=l12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2)e2b,θ2=r2bθ2=l2[sinθ2cosθ2].\begin{aligned} x_{2b} &= x_{1b} + l_2 \cos{\theta_2} &\dot{x}_{2b} &= -l_1\dot{\theta}_1 \sin{\theta_1}-l_2\dot{\theta}_2 \sin{\theta_2}\\ &= l_1 \cos{\theta_1} + l_2 \cos{\theta_2} & \dot{y}_{2b} &= l_1\dot{\theta}_1 \cos{\theta_1}+l_2\dot{\theta}_2 \cos{\theta_2} \\ y_{2b} &= y_{1b} + l_2 \sin{\theta_2} & \therefore \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}\\ &= l_1 \sin{\theta_1} + l_2 \sin{\theta_2} & \therefore v_{2b}^2 &= \dot{x}_{2b}^2 + \dot{y}_{2b}^2 \\ \vec{r}_{2b}&= \begin{bmatrix} x_{2b} \\ y_{2b} \end{bmatrix}& &= \left(-l_1\dot{\theta}_1 \sin{\theta_1}-l_2\dot{\theta}_2 \sin{\theta_2}\right)^2 + \left(l_1\dot{\theta}_1 \cos{\theta_1}+l_2\dot{\theta}_2 \cos{\theta_2}\right)^2 \\ &= \begin{bmatrix} l_1 \cos{\theta_1} + l_2 \cos{\theta_2}\\ l_1 \sin{\theta_1} + l_2 \sin{\theta_2} \end{bmatrix} & &= l_1^2 \dot{\theta}_1^2 \sin^2{\theta_1} + l_2^2 \dot{\theta}_2^2 \sin^2{\theta_2} + 2l_1 l_2 \dot{\theta}_1\dot{\theta}_2 \sin{\theta_1}\sin{\theta_2} + l_1^2 \dot{\theta}_1^2 \cos^2{\theta_1} + l_2^2 \dot{\theta}_2^2 \cos^2{\theta_2} + \\ \vec{e}_{2b,\theta_1} &= \dfrac{\partial \vec{r}_{2b}}{\partial \theta_1} && 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\theta_1}\cos{\theta_2} \\ &= l_1\begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}& &= l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 + 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\left(\theta_1-\theta_2\right)}\\ \vec{e}_{2b,\theta_2} &= \dfrac{\partial \vec{r}_{2b}}{\partial \theta_2} \\ &= l_2 \begin{bmatrix} -\sin{\theta_2} \\ \cos{\theta_2} \end{bmatrix}. \end{aligned}

Rod 2

x2r=x1b+l2cosθ22x˙2r=l1θ˙1sinθ1l2θ˙2sinθ22=l1cosθ1+l2cosθ22y˙2r=l1θ˙1cosθ1+l2θ˙2cosθ2y2r=y1b+l2sinθ22v2r=[l1θ˙1sinθ1l2θ˙2sinθ22l1θ˙1cosθ1+l2θ˙2cosθ22]=l1sinθ1+l2sinθ22v2r2=x˙2r2+y˙2r2r2r=[x2ry2r]=(l1θ˙1sinθ1l2θ˙2sinθ22)2+(l1θ˙1cosθ1+l2θ˙2cosθ22)2=[l1cosθ1+l2cosθ22l1sinθ1+l2sinθ22]=l12θ˙12sin2θ1+l22θ˙22sin2θ24+l1l2θ˙1θ˙2sinθ1sinθ2+l12θ˙12cos2θ1+l22θ˙22cos2θ24+e2b,θ1=r2bθ1l1l2θ˙1θ˙2cosθ1cosθ2=l1[sinθ1cosθ1]=l12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2)e2b,θ2=r2bθ2=l22[sinθ2cosθ2].\begin{aligned} x_{2r} &= x_{1b} + \dfrac{l_2 \cos{\theta_2}}{2} &\dot{x}_{2r} &= -l_1\dot{\theta}_1 \sin{\theta_1}-\dfrac{l_2\dot{\theta}_2 \sin{\theta_2}}{2}\\ &= l_1 \cos{\theta_1} + \dfrac{l_2 \cos{\theta_2}}{2} & \dot{y}_{2r} &= l_1\dot{\theta}_1 \cos{\theta_1}+l_2\dot{\theta}_2 \cos{\theta_2} \\ y_{2r} &= y_{1b} + \dfrac{l_2 \sin{\theta_2}}{2} & \therefore \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}\\ &= l_1 \sin{\theta_1} + \dfrac{l_2 \sin{\theta_2}}{2} & \therefore v_{2r}^2 &= \dot{x}_{2r}^2 + \dot{y}_{2r}^2 \\ \vec{r}_{2r}&= \begin{bmatrix} x_{2r} \\ y_{2r} \end{bmatrix}& &= \left(-l_1\dot{\theta}_1 \sin{\theta_1}-\dfrac{l_2\dot{\theta}_2 \sin{\theta_2}}{2}\right)^2 + \left(l_1\dot{\theta}_1 \cos{\theta_1}+\dfrac{l_2\dot{\theta}_2 \cos{\theta_2}}{2}\right)^2 \\ &= \begin{bmatrix} l_1 \cos{\theta_1} + \dfrac{l_2 \cos{\theta_2}}{2}\\ l_1 \sin{\theta_1} + \dfrac{l_2 \sin{\theta_2}}{2} \end{bmatrix} & &= l_1^2 \dot{\theta}_1^2 \sin^2{\theta_1} + \dfrac{l_2^2 \dot{\theta}_2^2 \sin^2{\theta_2}}{4} + l_1 l_2 \dot{\theta}_1\dot{\theta}_2 \sin{\theta_1}\sin{\theta_2} + l_1^2 \dot{\theta}_1^2 \cos^2{\theta_1} + \dfrac{l_2^2 \dot{\theta}_2^2 \cos^2{\theta_2}}{4} + \\ \vec{e}_{2b,\theta_1} &= \dfrac{\partial \vec{r}_{2b}}{\partial \theta_1} && l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\theta_1}\cos{\theta_2} \\ &= l_1\begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}& &= l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\left(\theta_1-\theta_2\right)}\\ \vec{e}_{2b,\theta_2} &= \dfrac{\partial \vec{r}_{2b}}{\partial \theta_2} \\ &= \dfrac{l_2}{2} \begin{bmatrix} -\sin{\theta_2} \\ \cos{\theta_2} \end{bmatrix}. \end{aligned}

Kinetic energy

Bob 1

First, we will calculate the kinetic energy of the first pendulum bob.

T1b=m1bv1b22.\begin{aligned} T_{1b} &= \dfrac{m_{1b}v_{1b}^2}{2}. \end{aligned}

Substituting in what we previously found v1b2v_{1b}^2 to be, we obtain

T1b=m1bl12θ˙122.\begin{aligned} T_{1b} &= \dfrac{m_{1b} l_1^2 \dot{\theta}_1^2}{2}. \end{aligned}

Rod 1

First we must determine the kinetic energy of the first rod, it is given by

T1r=12Icmωcm2.\begin{aligned} T_{1r} &= \dfrac{1}{2} I_{\mathrm{cm}} \omega_{\mathrm{cm}}^2. \end{aligned}

Where IcmI_{\mathrm{cm}} is the moment of inertia around the centre of mass and ωcm\omega_{\mathrm{cm}} is the angular velocity around the centre of mass. As we have a rod, Icm=m1rl1212I_{\mathrm{cm}} = \dfrac{m_{1r}l_1^2}{12}[2] and ωcm=θ˙1\omega_{\mathrm{cm}} = \dot{\theta}_1. This yields the following kinetic energy

T1r=12m1rl1212θ˙12=m1rl12θ˙1224.\begin{aligned} T_{1r} &= \dfrac{1}{2}\dfrac{m_{1r} l_1^2}{12}\dot{\theta}_1^2 \\ &= \dfrac{m_{1r} l_1^2\dot{\theta}_1^2}{24}. \end{aligned}

Bob 2

The kinetic energy of the second bob is

T2b=m2bv2b22=m2b2(l12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2)).\begin{aligned} T_{2b} &= \dfrac{m_{2b} v_{2b}^2}{2} \\ &= \dfrac{m_{2b}}{2} \left(l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 + 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\left(\theta_1-\theta_2\right)}\right). \end{aligned}

Rod 2

The second rod should be the same except as rod 1 but with its own parameters

T2r=m2rl22θ˙2224.\begin{aligned} T_{2r} &= \dfrac{m_{2r} l_2^2\dot{\theta}_2^2}{24}. \end{aligned}

Total

Hence the total kinetic energy is

T=jTj=T1r+T1b+T2r+T2b=m1rl12θ˙1224+m1bl12θ˙122+m2rl22θ˙2224+m2b2(l12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))=m1rl12θ˙12+m2rl22θ˙2224+m1b+m2b2l12θ˙12+m2b2(l2θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))\begin{aligned} T &= \sum_j T_j \\ &= T_{1r} + T_{1b} + T_{2r} + T_{2b} \\ &= \dfrac{m_{1r}l_1^2\dot{\theta}_1^2}{24} + \dfrac{m_{1b} l_1^2 \dot{\theta}_1^2}{2} + \dfrac{m_{2r} l_2^2\dot{\theta}_2^2}{24} + \dfrac{m_{2b}}{2} \left(l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 + 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\left(\theta_1-\theta_2\right)}\right) \\ &= \dfrac{m_{1r} l_1^2 \dot{\theta}_1^2 + m_{2r}l_2^2 \dot{\theta}_2^2}{24} + \dfrac{m_{1b}+m_{2b}}{2}l_1^2 \dot{\theta}_1^2 + \dfrac{m_{2b}}{2} \left(l_2\dot{\theta}_2^2 + 2l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}\right) \end{aligned}
T=l12θ˙122(m1r12+m1b+m2b)+l22θ˙222(m2r12+m2b)+m2bl1l2θ˙1θ˙2cos(θ1θ2).\begin{aligned} T &= \dfrac{l_1^2 \dot{\theta}_1^2}{2} \left(\dfrac{m_{1r}}{12} + m_{1b} + m_{2b}\right) + \dfrac{l_2^2 \dot{\theta}_2^2}{2} \left(\dfrac{m_{2r}}{12} + m_{2b}\right) + m_{2b}l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}. \end{aligned}

Potential energy

Next, we must calculate the potential energy. In this problem, there is only one source of potential energy–-gravity. This means that the potential energy of each component of the pendulum will be Vj=mjgyjV_j = m_jgy_j, where yjy_j is the yy-coordinate of the centre of mass of the component and mjm_j is the mass of that component.

Bob 1

First, we have the gravitational potential energy of the first pendulum bob.

V1b=m1bgy1b=m1bgl1sinθ1.\begin{aligned} V_{1b} &= m_{1b} gy_{1b} \\ &= m_{1b}gl_1 \sin{\theta_1}. \end{aligned}

Rod 1

Next, we will calculate the gravitational potential energy of the first rod. For it, we will use the centre of mass of the pendulum for the yy-coordinate we use to calculate the gravitational potential energy. We will assume it has uniform mass, so its midpoint will be where its centre of mass is. Therefore y1r=12y1by_{1r} = \dfrac{1}{2}y_{1b}.

V1r=m1rgy1r=m1rgl1sinθ12.\begin{aligned} V_{1r} &= m_{1r} gy_{1r} \\ &= \dfrac{m_{1r}gl_1 \sin{\theta_1}}{2}. \end{aligned}

Bob 2

The potential energy of the second pendulum bob is

V2b=m2bgy2b=m2bg(l1sinθ1+l2sinθ2).\begin{aligned} V_{2b} &= m_{2b} gy_{2b} \\ &= m_{2b} g \left(l_1 \sin{\theta_1} + l_2 \sin{\theta_2}\right). \end{aligned}

Rod 2

The potential energy of the second pendulum rod is

V2r=m2rgy2r=m2rg(l1sinθ1+l2sinθ22).\begin{aligned} V_{2r} &= m_{2r} gy_{2r} \\ &= m_{2r}g \left(l_1 \sin{\theta_1} + \dfrac{l_2\sin{\theta_2}}{2}\right). \end{aligned}

Total

Therefore, the total potential energy is

V=jVj=V1r+V2r+V1b+V2b=m1rgl1sinθ12+m2rg(l1sinθ1+l2sinθ22)+m1bgl1sinθ1+m2bg(l1sinθ1+l2sinθ2)=gl1sinθ1(m1r2+m2r+m1b+m2b)+gl2sinθ2(m2r2+m2b).\begin{aligned} V &= \sum_j V_j \\ &= V_{1r} + V_{2r} + V_{1b} + V_{2b} \\ &= \dfrac{m_{1r}gl_1 \sin{\theta_1}}{2} + m_{2r}g \left(l_1 \sin{\theta_1} + \dfrac{l_2\sin{\theta_2}}{2}\right) + m_{1b}gl_1 \sin{\theta_1} + m_{2b} g \left(l_1 \sin{\theta_1} + l_2 \sin{\theta_2}\right) \\ &= gl_1 \sin{\theta_1}\left(\dfrac{m_{1r}}{2} + m_{2r} + m_{1b} + m_{2b}\right) + gl_2 \sin{\theta_2}\left(\dfrac{m_{2r}}{2} + m_{2b}\right). \end{aligned}

Lagrangian

Hence the Lagrangian is

L=TV=l12θ˙122(m1r12+m1b+m2b)+l22θ˙222(m2r12+m2b)+m2bl1l2θ˙1θ˙2cos(θ1θ2)gl1sinθ1(m1r2+m2r+m1b+m2b)gl2sinθ2(m2r2+m2b).\begin{aligned} \mathcal{L} &= T - V \\ &= \dfrac{l_1^2 \dot{\theta}_1^2}{2} \left(\dfrac{m_{1r}}{12} + m_{1b} + m_{2b}\right) + \dfrac{l_2^2 \dot{\theta}_2^2}{2} \left(\dfrac{m_{2r}}{12} + m_{2b}\right) + m_{2b}l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)} - gl_1 \sin{\theta_1}\left(\dfrac{m_{1r}}{2} \right.\\ &\left.+ m_{2r} + m_{1b} + m_{2b}\right) - gl_2 \sin{\theta_2}\left(\dfrac{m_{2r}}{2} + m_{2b}\right). \end{aligned}

Applying the Euler-Lagrange equations with generalized dissipative force

θ1\theta_1

Left-hand side

Calculating the left-hand side terms of Equation (1) with regards to θ1\theta_1. First we calculate the generalized momenta canonical to θ1\theta_1

pθ1=Lθ˙1=m1rl12θ˙112+(m1b+m2b)l12θ˙1+m2bl1l2θ˙2cos(θ1θ2).\begin{aligned} p_{\theta_1} &= \dfrac{\partial \mathcal{L}}{\partial \dot{\theta}_1} \\ &= \dfrac{m_{1r}l_1^2 \dot{\theta}_1}{12} + (m_{1b}+m_{2b}) l_1^2 \dot{\theta}_1 + m_{2b}l_1 l_2 \dot{\theta}_2 \cos{\left(\theta_1-\theta_2\right)}. \end{aligned}

Hence its time derivative is

p˙θ1=m1rl12θ¨112+(m1b+m2b)l12θ¨1+m2bl1l2θ¨2cos(θ1θ2)m2bl1l2θ˙2(θ˙1θ˙2)sin(θ1θ2).\begin{aligned} \dot{p}_{\theta_1} &= \dfrac{m_{1r} l_1^2 \ddot{\theta}_1}{12} + (m_{1b}+m_{2b})l_1^2 \ddot{\theta}_1 + m_{2b}l_1 l_2 \ddot{\theta}_2\cos{(\theta_1-\theta_2)} - m_{2b}l_1 l_2 \dot{\theta}_2\left(\dot{\theta}_1 - \dot{\theta}_2\right)\sin{(\theta_1-\theta_2)}. \end{aligned}

As for the other term in Equation (1)

Fθ1=Lθ1=m2bl1l2θ˙1θ˙2sin(θ1θ2)m1rgl1cosθ12m2rgl1cosθ1m1bgl1cosθ1m2bgl1cosθ1=m2bl1l2θ˙1θ˙2sin(θ1θ2)gl1cosθ1(m1r2+m2r+m1b+m2b).\begin{aligned} F_{\theta_1} &= \dfrac{\partial \mathcal{L}}{\partial \theta_1} \\ &= -m_{2b}l_1l_2\dot{\theta}_1\dot{\theta}_2 \sin{(\theta_1-\theta_2)} - \dfrac{m_{1r}gl_1 \cos{\theta_1}}{2} -m_{2r}gl_1 \cos{\theta_1} -m_{1b}gl_1 \cos{\theta_1} -m_{2b}gl_1 \cos{\theta_1} \\ &= -m_{2b}l_1l_2\dot{\theta}_1\dot{\theta}_2 \sin{(\theta_1-\theta_2)} -gl_1\cos{\theta_1}\left(\dfrac{m_{1r}}{2}+m_{2r}+m_{1b} + m_{2b}\right). \end{aligned}

Hence the LHS of Equation (1) for θ1\theta_1 is

p˙θ1Fθ1=m1rl12θ¨112+(m1b+m2b)l12θ¨1+m2bl1l2θ¨2cos(θ1θ2)m2bl1l2θ˙2(θ˙1θ˙2)sin(θ1θ2)+m2bl1l2θ˙1θ˙2sin(θ1θ2)+gl1cosθ1(m1r2+m2r+m1b+m2b)=m1rl12θ¨112+(m1b+m2b)l12θ¨1+m2bl1l2θ¨2cos(θ1θ2)+m2bl1l2θ˙22sin(θ1θ2)+gl1cosθ1(m1r2+m2r+m1b+m2b)=l12θ¨1(m1r12+m1b+m2b)+m2bl1l2θ¨2cos(θ1θ2)+m2bl1l2θ˙22sin(θ1θ2)+gl1cosθ1(m1r2+m2r+m1b+m2b)=l12θ¨1(m1r12+m1b+m2b)+m2bl1l2(θ¨2cos(θ1θ2)+θ˙22sin(θ1θ2))+gl1cosθ1(m1r2+m2r+m1b+m2b).\begin{aligned} \dot{p}_{\theta_1} - F_{\theta_1} &= \dfrac{m_{1r} l_1^2 \ddot{\theta}_1}{12} + (m_{1b}+m_{2b})l_1^2 \ddot{\theta}_1 + m_{2b}l_1 l_2 \ddot{\theta}_2\cos{(\theta_1-\theta_2)} - m_{2b}l_1 l_2 \dot{\theta}_2\left(\dot{\theta}_1 - \dot{\theta}_2\right)\sin{(\theta_1-\theta_2)} + m_{2b}l_1l_2\dot{\theta}_1\dot{\theta}_2\sin{(\theta_1-\theta_2)} +gl_1\cos{\theta_1}\left(\dfrac{m_{1r}}{2}+m_{2r}+m_{1b} + m_{2b}\right) \\ &= \dfrac{m_{1r} l_1^2 \ddot{\theta}_1}{12} + (m_{1b}+m_{2b})l_1^2 \ddot{\theta}_1 + m_{2b}l_1 l_2 \ddot{\theta}_2\cos{(\theta_1-\theta_2)} + m_{2b}l_1 l_2 \dot{\theta}_2^2\sin{(\theta_1-\theta_2)} +gl_1\cos{\theta_1}\left(\dfrac{m_{1r}}{2}+m_{2r}+m_{1b} + m_{2b}\right) \\ &= l_1^2 \ddot{\theta}_1 \left(\dfrac{m_{1r}}{12} + m_{1b} + m_{2b}\right) + m_{2b}l_1 l_2 \ddot{\theta}_2\cos{(\theta_1-\theta_2)} + m_{2b}l_1 l_2 \dot{\theta}_2^2\sin{(\theta_1-\theta_2)} +gl_1\cos{\theta_1}\left(\dfrac{m_{1r}}{2}+m_{2r}+m_{1b} + m_{2b}\right)\\ &= l_1^2 \ddot{\theta}_1 \left(\dfrac{m_{1r}}{12} + m_{1b} + m_{2b}\right) + m_{2b}l_1 l_2\left( \ddot{\theta}_2\cos{(\theta_1-\theta_2)} + \dot{\theta}_2^2\sin{(\theta_1-\theta_2)}\right) +gl_1\cos{\theta_1}\left(\dfrac{m_{1r}}{2}+m_{2r}+m_{1b} + m_{2b}\right). \end{aligned}

Hence θ¨1\ddot{\theta}_1 is

θ¨1=1l12(m1r12+m1b+m2b)[Qθ1m2bl1l2(θ¨2cos(θ1θ2)+θ˙22sin(θ1θ2))gl1cosθ1(m1r2+m2r+m1b+m2b)].\begin{aligned} \ddot{\theta}_1 &= \dfrac{1}{l_1^2\left(\dfrac{m_{1r}}{12} + m_{1b} + m_{2b}\right)}\left[Q_{\theta_1} - m_{2b}l_1 l_2\left( \ddot{\theta}_2\cos{(\theta_1-\theta_2)} + \dot{\theta}_2^2\sin{(\theta_1-\theta_2)}\right) -gl_1\cos{\theta_1}\left(\dfrac{m_{1r}}{2}+m_{2r}+m_{1b} + m_{2b}\right)\right]. \end{aligned}

Right-hand side

As for the generalized dissipation force

Qθ1=FD,1rr1rθ1+FD,1br1bθ1+FD,2rrrod,2θ1+FD,2br2bθ1\begin{aligned} Q_{\theta_1} &= \vec{F}_{D, 1r} \cdot \dfrac{\partial \vec{r}_{1r}}{\partial \theta_1} + \vec{F}_{D, 1b} \cdot \dfrac{\partial \vec{r}_{1b}}{\partial \theta_1}+ \vec{F}_{D, 2r} \cdot \dfrac{\partial \vec{r}_{rod, 2}}{\partial \theta_1} + \vec{F}_{D, 2b} \cdot \dfrac{\partial \vec{r}_{2b}}{\partial \theta_1} \end{aligned}

Bob 1

The dissipation force applied to the first bob is

FD,1b=b1bv1bc1bv1bv1b.\begin{aligned} \vec{F}_{D,1b} &= -b_{1b}\vec{v}_{1b} - c_{1b}|\vec{v}_{1b}|\vec{v}_{1b}. \end{aligned}

Hence the generalized dissipation force, canonical to θ1\theta_1, applied to the first bob is

FD,1br1bθ1=(b1bc1bl1θ˙1)[l1θ˙1sinθ1l1θ˙1cosθ1][l1sinθ1l1cosθ1]=(b1b+c1bl1θ˙1)(l12θ˙1sin2θ1+l12θ˙1cos2θ1)=(b1b+c1bl1θ˙1)l12θ˙1.\begin{aligned} \vec{F}_{D, 1b} \cdot \dfrac{\partial \vec{r}_{1b}}{\partial \theta_1}&= (-b_{1b} - c_{1b}l_1\dot{\theta}_1)\begin{bmatrix} -l_1\dot{\theta}_1 \sin{\theta_1} \\ l_1\dot{\theta}_1 \cos{\theta_1} \end{bmatrix} \cdot \begin{bmatrix} -l_1 \sin{\theta_1} \\ l_1 \cos{\theta_1} \end{bmatrix} \\ &= -(b_{1b}+c_{1b}l_1\dot{\theta}_1) (l_1^2 \dot{\theta}_1 \sin^2{\theta_1}+l_1^2 \dot{\theta}_1 \cos^2{\theta_1}) \\ &= -(b_{1b} + c_{1b} l_1 \dot{\theta}_1)l_1^2 \dot{\theta}_1. \end{aligned}

Rod 1

Next we will calculate the dissipation force on the first rod. We will use a centre of mass approximation (as otherwise we would likely have to integrate over the rod, which would drastically complicate the calculation)

FD,1r=(b1r+c1rv1r)v1rFD,1r=(b1r+c1rl1θ˙12)l1θ˙12[sinθ1cosθ1].\begin{aligned} \vec{F}_{D,1r} &= -\left(b_{1r} + c_{1r}|\vec{v}_{1r}|\right)\vec{v}_{1r} \\ \vec{F}_{D,1r} &= -\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right)\dfrac{l_1 \dot{\theta}_1}{2} \begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix}. \end{aligned}

Hence the generalized dissipation force, canonical to θ1\theta_1, on the first rod is

FD,1rr1rθ1=(b1r+c1rl1θ˙12)l1θ˙12[sinθ1cosθ1]l12[sinθ1cosθ1]=(b1r+c1rl1θ˙12)l12θ˙14.\begin{aligned} \vec{F}_{D,1r} \cdot \dfrac{\partial \vec{r}_{1r}}{\partial \theta_1} &= -\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right)\dfrac{l_1 \dot{\theta}_1}{2} \begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix} \cdot \dfrac{l_1}{2}\begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix} \\ &= -\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1^2 \dot{\theta}_1}{4}. \end{aligned}

Bob 2

The dissipation force on the second bob would be

FD,2b=b2bv2bc2bv2bv2b=(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))[l1θ˙1sinθ1l2θ˙2sinθ2l1θ˙1cosθ1+l2θ˙2cosθ2].\begin{aligned} \vec{F}_{D,2b} &= -b_{2b}\vec{v}_{2b} - c_{2b}|\vec{v}_{2b}|\vec{v}_{2b} \\ &= -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right) \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}. \end{aligned}

Hence the generalized dissipation force, canonical to θ1\theta_1, would be

FD,2br2bθ1=(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))[l1θ˙1sinθ1l2θ˙2sinθ2l1θ˙1cosθ1+l2θ˙2cosθ2][l1sinθ1l1cosθ1]=(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1sin2θ1+l1l2θ˙2sinθ1sinθ2+l12θ1˙cos2θ1+l1l2θ˙2cosθ1cosθ2)=(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1+l1l2θ˙2cos(θ1θ2)).\begin{aligned} \vec{F}_{D, 2b} \cdot \dfrac{\partial \vec{r}_{2b}}{\partial \theta_1} &= -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right) \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} \cdot \begin{bmatrix} -l_1 \sin{\theta_1} \\ l_1 \cos{\theta_1} \end{bmatrix}\\ &= -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1 \sin^2{\theta_1}+l_1l_2 \dot{\theta}_2 \sin{\theta_1}\sin{\theta_2} +l_1^2 \dot{\theta_1}\cos^2{\theta_1}+l_1l_2\dot{\theta}_2 \cos{\theta_1}\cos{\theta_2}\right) \\ &= -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1 + l_1l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}\right). \end{aligned}

Rod 2

The friction force applied to the second rod would be

FD,2r=(b2r+c2rv2r)v2rFD,2r=(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))[l1θ˙1sinθ1l2θ˙2sinθ22l1θ˙1cosθ1+l2θ˙2cosθ22].\begin{aligned} \vec{F}_{D,2r} &= -\left(b_{2r} + c_{2r}|\vec{v}_{2r}|\right)\vec{v}_{2r} \\ \vec{F}_{D,2r} &= -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\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}. \end{aligned}

Therefore the generalized dissipation force, canonical to θ1\theta_1, for the second rod would be

FD,2rr2rθ1=(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1sin2θ1+l1l2θ˙2sinθ1sinθ22+l12θ˙1cos2θ1+l1l2θ˙2cosθ1cosθ22)=(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙12+l1l2θ˙2cos(θ1θ2)2).\begin{aligned} \vec{F}_{D,2r}\cdot \dfrac{\partial \vec{r}_{2r}}{\partial \theta_1} &= -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right) \left(l_1^2 \dot{\theta}_1 \sin^2{\theta_1} + \dfrac{l_1 l_2 \dot{\theta}_2 \sin{\theta_1}\sin{\theta_2}}{2} +l_1^2 \dot{\theta}_1\cos^2{\theta_1} + \dfrac{l_1l_2 \dot{\theta}_2 \cos{\theta_1}\cos{\theta_2}}{2}\right) \\ &= -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1^2 + \dfrac{l_1 l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right). \end{aligned}

Final answer

Hence Qθ1Q_{\theta_1} is

Qθ1=(b1b+c1bl1θ˙1)l12θ˙1(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1+l1l2θ˙2cos(θ1θ2))(b1r+c1rl1θ˙12)l12θ˙14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙12+l1l2θ˙2cos(θ1θ2)2).\begin{aligned} Q_{\theta_1} &= -\left(b_{1b} + c_{1b} l_1 \dot{\theta}_1\right)l_1^2 \dot{\theta}_1 -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1 + l_1l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}\right) -\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1^2 \dot{\theta}_1}{4} \\ &-\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1^2 + \dfrac{l_1 l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right). \end{aligned}

Final equation for θ¨1\ddot{\theta}_1

The equation of motion for θ1\theta_1 is therefore

p˙θ1Fθ1=Qθ1\begin{aligned} \dot{p}_{\theta_1} - F_{\theta_1} &= Q_{\theta_1} \end{aligned}
m1rl12θ¨112+(m1b+m2b)l12θ¨1+m2bl1l2θ¨2cos(θ1θ2)m2bl1l2θ˙2(θ˙1θ˙2)sin(θ1θ2)(m2bl1l2θ˙1θ˙2sin(θ1θ2)m1rgl1cosθ12m2rgl1cosθ1m1bgl1cosθ1m2bgl1cosθ1)=(b1b+c1bl1θ˙1)l12θ˙1(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1+l1l2θ˙2cos(θ1θ2))(b1r+c1rl1θ˙12)l12θ˙14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1+l1l2θ˙2cos(θ1θ2)2)m1rl12θ¨112+(m1b+m2b)l12θ¨1+m2bl1l2θ¨2cos(θ1θ2)+m2bl1l2θ˙22sin(θ1θ2)+m1rgl1cosθ12+m2rgl1cosθ1+m1bgl1cosθ1+m2bgl1cosθ1=(b1b+c1bl1θ˙1)l12θ˙1(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1+l1l2θ˙2cos(θ1θ2))(b1r+c1rl1θ˙12)l12θ˙14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1+l1l2θ˙2cos(θ1θ2)2)\begin{aligned} &\dfrac{m_{1r} l_1^2 \ddot{\theta}_1}{12} + (m_{1b}+m_{2b})l_1^2 \ddot{\theta}_1 + m_{2b}l_1 l_2 \ddot{\theta}_2\cos{(\theta_1-\theta_2)} - m_{2b}l_1 l_2 \dot{\theta}_2\left(\dot{\theta}_1 - \dot{\theta}_2\right)\sin{(\theta_1-\theta_2)} - \left(-m_{2b}l_1l_2\dot{\theta}_1\dot{\theta}_2 \sin{(\theta_1-\theta_2)} - \dfrac{m_{1r}gl_1 \cos{\theta_1}}{2} -m_{2r}gl_1 \cos{\theta_1} -m_{1b}gl_1 \cos{\theta_1} \right.\\ &\left.-m_{2b}gl_1 \cos{\theta_1}\right) = -\left(b_{1b} + c_{1b} l_1 \dot{\theta}_1\right)l_1^2 \dot{\theta}_1 -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1 + l_1l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}\right) -\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1^2 \dot{\theta}_1}{4} \\ & -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1 + \dfrac{l_1 l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right) \\ &\dfrac{m_{1r} l_1^2 \ddot{\theta}_1}{12} + (m_{1b}+m_{2b})l_1^2 \ddot{\theta}_1 + m_{2b}l_1 l_2 \ddot{\theta}_2\cos{(\theta_1-\theta_2)} + m_{2b}l_1 l_2 \dot{\theta}_2^2\sin{(\theta_1-\theta_2)} + \dfrac{m_{1r}gl_1 \cos{\theta_1}}{2} +m_{2r}gl_1 \cos{\theta_1} +m_{1b}gl_1 \cos{\theta_1} +m_{2b}gl_1 \cos{\theta_1} = -(b_{1b} + c_{1b} l_1 \dot{\theta}_1)l_1^2 \dot{\theta}_1 \\ &-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)(l_1^2 \dot{\theta}_1 + l_1l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}) -\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1^2 \dot{\theta}_1}{4} \\ &-\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1 + \dfrac{l_1 l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right) \\ \end{aligned}
(m1r12+m1b+m2b)l12θ¨1=m2bl1l2(θ¨2cos(θ1θ2)+θ˙22sin(θ1θ2))gl1cosθ1(m1r2+m2r+m1b+m2b)(b1b+c1bl1θ˙1)l12θ˙1(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1+l1l2θ˙2cos(θ1θ2))(b1r+c1rl1θ˙12)l12θ˙14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(l12θ˙1+l1l2θ˙2cos(θ1θ2)2)\begin{aligned} & \left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)l_1^2 \ddot{\theta}_1 = - m_{2b}l_1 l_2 \left( \ddot{\theta}_2\cos{(\theta_1-\theta_2)} +\dot{\theta}_2^2\sin{(\theta_1-\theta_2)}\right) - gl_1 \cos{\theta_1}\left(\dfrac{m_{1r}}{2} +m_{2r} +m_{1b} + m_{2b}\right) -(b_{1b} + c_{1b} l_1 \dot{\theta}_1)l_1^2 \dot{\theta}_1 \\ &-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1 + l_1l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}\right) -\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1^2 \dot{\theta}_1}{4} \\ & -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1^2 \dot{\theta}_1 + \dfrac{l_1 l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right) \\ \end{aligned}
θ¨1=1(m1r12+m1b+m2b)l1[m2bl2(θ¨2cos(θ1θ2)+θ˙22sin(θ1θ2))+gcosθ1(m1r2+m2r+m1b+m2b)(b1b+c1bl1θ˙1)l1θ˙1+(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2))+(b1r+c1rl1θ˙12)l1θ˙14+(b2r+c2rl12θ˙12+l22θ˙224+l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2)2)]\begin{aligned} \ddot{\theta}_1 = &\dfrac{-1}{\left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)l_1} \left[m_{2b}l_2 ( \ddot{\theta}_2\cos{(\theta_1-\theta_2)} +\dot{\theta}_2^2\sin{(\theta_1-\theta_2)}) + g \cos{\theta_1}\left(\dfrac{m_{1r}}{2} +m_{2r} +m_{1b} + m_{2b}\right) -(b_{1b} + c_{1b} l_1 \dot{\theta}_1)l_1 \dot{\theta}_1 \right.\\ &\left.+\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)(l_1 \dot{\theta}_1 + l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}) +\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1 \dot{\theta}_1}{4} \right.\\ &\left.+\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1 \dot{\theta}_1 + \dfrac{l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right)\right] \end{aligned}

θ2\theta_2

Next, we will derive the equations for θ2\theta_2

Left-hand side

pθ2=Lθ˙2=m2rl22θ˙212+m2bl2(l2θ˙2+l1θ˙1cos(θ1θ2))p˙θ2=m2rl22θ¨212+m2bl2(l2θ¨2+l1θ¨1cos(θ1θ2)l1θ˙1(θ˙1θ˙2)sin(θ1θ2))=l22(m2r12+m2b)θ¨2+m2bl1l2(θ¨1cos(θ1θ2)θ˙1(θ˙1θ˙2)sin(θ1θ2))Fθ2=Lθ2=m2bl1l2θ˙1θ˙2sin(θ1θ2)m2rgl2cosθ22m2bgl2cosθ2=m2bl1l2θ˙1θ˙2sin(θ1θ2)gl2cosθ2(m2r2+m2b).\begin{aligned} p_{\theta_2} &= \dfrac{\partial \mathcal{L}}{\partial \dot{\theta}_2} \\ &= \dfrac{m_{2r}l_2^2 \dot{\theta}_2}{12} + m_{2b}l_2 \left(l_2 \dot{\theta}_2 + l_1 \dot{\theta}_1\cos{(\theta_1-\theta_2)}\right)\\ \dot{p}_{\theta_2} &= \dfrac{m_{2r}l_2^2 \ddot{\theta}_2}{12} + m_{2b}l_2 \left(l_2 \ddot{\theta}_2 + l_1 \ddot{\theta}_1\cos{(\theta_1-\theta_2)}-l_1\dot{\theta}_1(\dot{\theta}_1-\dot{\theta}_2)\sin{(\theta_1-\theta_2)}\right) \\ &= l_2^2 \left(\dfrac{m_{2r}}{12} + m_{2b}\right)\ddot{\theta}_2 + m_{2b}l_1l_2\left(\ddot{\theta}_1\cos{(\theta_1-\theta_2)}-\dot{\theta}_1(\dot{\theta}_1-\dot{\theta}_2)\sin{(\theta_1-\theta_2)}\right)\\ F_{\theta_2} &= \dfrac{\partial \mathcal{L}}{\partial \theta_2} \\ &= m_{2b} l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \sin{(\theta_1-\theta_2)}-\dfrac{m_{2r}gl_2 \cos{\theta_2}}{2} - m_{2b}gl_2\cos{\theta_2} \\ &= m_{2b} l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \sin{(\theta_1-\theta_2)}-gl_2\cos{\theta_2}\left(\dfrac{m_{2r}}{2} + m_{2b}\right). \end{aligned}

The LHS of our equation will be

p˙θ2Fθ2=l22(m2r12+m2b)θ¨2+m2bl1l2(θ¨1cos(θ1θ2)θ˙1(θ˙1θ˙2)sin(θ1θ2))m2bl1l2θ˙1θ˙2sin(θ1θ2)+gl2cosθ2(m2r2+m2b)=l22(m2r12+m2b)θ¨2+m2bl1l2(θ¨1cos(θ1θ2)θ˙12sin(θ1θ2))+gl2cosθ2(m2r2+m2b).\begin{aligned} \dot{p}_{\theta_2} - F_{\theta_2} &= l_2^2 \left(\dfrac{m_{2r}}{12} + m_{2b}\right)\ddot{\theta}_2 + m_{2b}l_1l_2\left(\ddot{\theta}_1\cos{(\theta_1-\theta_2)}-\dot{\theta}_1(\dot{\theta}_1-\dot{\theta}_2)\sin{(\theta_1-\theta_2)}\right) - m_{2b} l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \sin{(\theta_1-\theta_2)}+gl_2\cos{\theta_2}\left(\dfrac{m_{2r}}{2} + m_{2b}\right) \\ &= l_2^2 \left(\dfrac{m_{2r}}{12} + m_{2b}\right)\ddot{\theta}_2 + m_{2b}l_1l_2\left(\ddot{\theta}_1\cos{(\theta_1-\theta_2)}-\dot{\theta}_1^2\sin{(\theta_1-\theta_2)}\right)+gl_2\cos{\theta_2}\left(\dfrac{m_{2r}}{2} + m_{2b}\right). \end{aligned}

Right-hand side

Qθ2=jFD,jrjθ2=FD,1rr1rθ2+FD,1br1bθ2+FD,2rr2rθ2+FD,2br2bθ2.\begin{aligned} Q_{\theta_2} &= \sum_{j} \vec{F}_{D,j} \cdot \dfrac{\partial \vec{r}_j}{\partial \theta_2} \\ &= \vec{F}_{D,1r} \cdot \dfrac{\partial \vec{r}_{1r}}{\partial \theta_2} + \vec{F}_{D,1b} \cdot \dfrac{\partial \vec{r}_{1b}}{\partial \theta_2} + \vec{F}_{D,2r} \cdot \dfrac{\partial \vec{r}_{2r}}{\partial \theta_2} + \vec{F}_{D,2b} \cdot \dfrac{\partial \vec{r}_{2b}}{\partial \theta_2}. \end{aligned}

The terms corresponding to the first rod and first bob will be zero as their position and velocities are independent of θ2\theta_2. The remaining terms are below.

Rod 2

The dissipation force applied to the second rod is

FD,2r=(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))[l1θ˙1sinθ1l2θ˙2sinθ22l1θ˙1cosθ1+l2θ˙2cosθ22].\begin{aligned} \vec{F}_{D,2r} &= -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\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}. \end{aligned}

Hence the generalized dissipation force, canonical to θ2\theta_2, applied to the second rod is

FD,2rr2rθ2=(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))[l1θ˙1sinθ1l2θ˙2sinθ22l1θ˙1cosθ1+l2θ˙2cosθ22]l22[sinθ2cosθ2]=(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(l1l2θ˙1sinθ1sinθ22+l22θ˙2sin2θ24+l1l2θ˙1cosθ1cosθ22+l22θ˙2cos2θ24)=14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1l2θ˙1cos(θ1θ2)+l22θ˙2).\begin{aligned} \vec{F}_{D,2r} \cdot \dfrac{\partial \vec{r}_{2r}}{\partial \theta_2} &= -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\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} \cdot \dfrac{l_2}{2} \begin{bmatrix} -\sin{\theta_2} \\ \cos{\theta_2} \end{bmatrix} \\ &= -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(\dfrac{l_1l_2 \dot{\theta}_1 \sin{\theta_1}\sin{\theta_2}}{2} + \dfrac{l_2^2 \dot{\theta}_2\sin^2{\theta_2}}{4}+\dfrac{l_1l_2\dot{\theta}_1\cos{\theta_1}\cos{\theta_2}}{2}+\dfrac{l_2^2\dot{\theta}_2\cos^2{\theta_2}}{4}\right) \\ &= -\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)(2l_1l_2 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2^2 \dot{\theta}_2). \end{aligned}

Bob 2

The dissipation force applied to the second bob is

FD,2b=(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))[l1θ˙1sinθ1l2θ˙2sinθ2l1θ˙1cosθ1+l2θ˙2cosθ2].\begin{aligned} \vec{F}_{D,2b} &= -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right) \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}. \end{aligned}

Therefore the generalized dissipation force, canonical to θ2\theta_2, applied to the second bob is

FD,2br2bθ2=(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))[l1θ˙1sinθ1l2θ˙2sinθ2l1θ˙1cosθ1+l2θ˙2cosθ2]l2[sinθ2cosθ2]=(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1l2θ˙1sinθ1sinθ2+l22θ˙2sin2θ2+l1l2θ˙1cosθ1cosθ2+l22θ˙2cos2θ2)=(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1l2θ˙1cos(θ1θ2)+l22θ˙2).\begin{aligned} \vec{F}_{D,2b} \cdot \dfrac{\partial \vec{r}_{2b}}{\partial \theta_2} &= -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right) \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} \cdot l_2\begin{bmatrix} -\sin{\theta_2} \\ \cos{\theta_2} \end{bmatrix} \\ &= -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right) \left(l_1 l_2 \dot{\theta}_1 \sin{\theta_1}\sin{\theta_2} + l_2^2 \dot{\theta}_2 \sin^2{\theta_2} + l_1l_2 \dot{\theta}_1 \cos{\theta_1}\cos{\theta_2} + l_2^2\dot{\theta}_2 \cos^2{\theta_2}\right) \\ &= -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1l_2 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2^2 \dot{\theta}_2\right). \end{aligned}

Right-hand side

Qθ2=14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1l2θ˙1cos(θ1θ2)+l22θ˙2)(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1l2θ˙1cos(θ1θ2)+l22θ˙2).\begin{aligned} Q_{\theta_2} &= -\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(2l_1l_2 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2^2 \dot{\theta}_2\right)\\ & -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1l_2 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2^2 \dot{\theta}_2\right). \end{aligned}

Final equation

l22(m2r12+m2b)θ¨2+m2bl1l2(θ¨1cos(θ1θ2)θ˙1(θ˙1θ˙2)sin(θ1θ2))m2bl1l2θ˙1θ˙2sin(θ1θ2)+m2rgl2cosθ22+m2bgl2cosθ2=14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1l2θ˙1cos(θ1θ2)+l22θ˙2)(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1l2θ˙1cos(θ1θ2)+l22θ˙2)\begin{aligned} &l_2^2 \left(\dfrac{m_{2r}}{12} + m_{2b}\right)\ddot{\theta}_2 + m_{2b}l_1l_2\left(\ddot{\theta}_1\cos{(\theta_1-\theta_2)}-\dot{\theta}_1(\dot{\theta}_1-\dot{\theta}_2)\sin{(\theta_1-\theta_2)}\right) - m_{2b} l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \sin{(\theta_1-\theta_2)} +\dfrac{m_{2r}gl_2 \cos{\theta_2}}{2}+ m_{2b}gl_2\cos{\theta_2}\\ &= -\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)(2l_1l_2 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2^2 \dot{\theta}_2) -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1l_2 \dot{\theta}_1 \cos{(\theta_1-\theta_2)}\right. \\ &\left.+ l_2^2 \dot{\theta}_2\right) \end{aligned}

Moving everything on the left-hand side except the θ¨1\ddot{\theta}_1 term to the right-hand side yields

m2bl1l2cos(θ1θ2)θ¨1=l22(m2r12+m2b)θ¨2+m2bl2(l1θ˙12sin(θ1θ2)gcosθ2)14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1l2θ˙1cos(θ1θ2)+l22θ˙2)(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1l2θ˙1cos(θ1θ2)+l22θ˙2).\begin{aligned} &m_{2b}l_1l_2\cos{(\theta_1-\theta_2)}\ddot{\theta}_1 = -l_2^2 \left(\dfrac{m_{2r}}{12} + m_{2b}\right)\ddot{\theta}_2 + m_{2b}l_2(l_1\dot{\theta}_1^2\sin{(\theta_1-\theta_2)}-g\cos{\theta_2}) -\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)(2l_1l_2 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} \\ &+ l_2^2 \dot{\theta}_2) -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1l_2 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2^2 \dot{\theta}_2\right). \end{aligned}

Dividing both sides by m2bl1l2cos(θ1θ2)m_{2b}l_1l_2 \cos{(\theta_1-\theta_2)}:

θ¨1=sec(θ1θ2)m2bl1[l2(m2r12+m2b)θ¨2+m2b(l1θ˙12sin(θ1θ2)gcosθ2)14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1θ˙1cos(θ1θ2)+l2θ˙2)(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1cos(θ1θ2)+l2θ˙2)].\begin{aligned} &\ddot{\theta}_1 = \dfrac{\sec{(\theta_1-\theta_2)}}{m_{2b}l_1} \left[-l_2 \left(\dfrac{m_{2r}}{12} + m_{2b}\right)\ddot{\theta}_2 + m_{2b}(l_1\dot{\theta}_1^2\sin{(\theta_1-\theta_2)}-g\cos{\theta_2})-\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(2l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2 \dot{\theta}_2\right)\right.\\ &\left.-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2 \dot{\theta}_2\right)\right]. \end{aligned}

Rewriting θ¨2\ddot{\theta}_2 to not include θ¨1\ddot{\theta}_1

Dividing both sides by m2l1l2cos(θ1θ2)m_2l_1l_2\cos{(\theta_1-\theta_2)} and replacing θ¨1\ddot{\theta}_1 on the LHS with the right-hand side of Equation (2) yields

1(m1r12+m1b+m2b)l1[m2bl2(θ¨2cos(θ1θ2)+θ˙22sin(θ1θ2))gcosθ1(m1r2+m2r+m1b+m2b)(b1b+c1bl1θ˙1)l1θ˙1(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2))(b1r+c1rl1θ˙12)l1θ˙14(b2r+c2rl12θ˙12+l22θ˙224+l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2)2)]=sec(θ1θ2)m2bl1[l2(m2r12+m2b)θ¨2+m2b(l1θ˙12sin(θ1θ2)gcosθ2)14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1θ˙1cos(θ1θ2)+l2θ˙2)(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1cos(θ1θ2)+l2θ˙2)]\begin{aligned} &\dfrac{1}{\left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)l_1} [-m_{2b}l_2 ( \ddot{\theta}_2\cos{(\theta_1-\theta_2)} +\dot{\theta}_2^2\sin{(\theta_1-\theta_2)}) - g \cos{\theta_1}\left(\dfrac{m_{1r}}{2} +m_{2r} +m_{1b} + m_{2b}\right) -(b_{1b} + c_{1b} l_1 \dot{\theta}_1)l_1 \dot{\theta}_1 \\ &-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)(l_1 \dot{\theta}_1 + l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)})-\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1 \dot{\theta}_1}{4} -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)(l_1 \dot{\theta}_1 \\ &+ \dfrac{l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2})] =\dfrac{\sec{(\theta_1-\theta_2)}}{m_{2b}l_1} [-l_2 \left(\dfrac{m_{2r}}{12} + m_{2b}\right)\ddot{\theta}_2 + m_{2b}(l_1\dot{\theta}_1^2\sin{(\theta_1-\theta_2)}-g\cos{\theta_2}) -\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\\ &(2l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)}+ l_2 \dot{\theta}_2) -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)(l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2 \dot{\theta}_2)]\\ \end{aligned}

Multiply both sides by l1m2bcos(θ1θ2)l_1m_{2b}\cos{(\theta_1-\theta_2)}

m2bcos(θ1θ2)(m1r12+m1b+m2b)[m2bl2(θ¨2cos(θ1θ2)+θ˙22sin(θ1θ2))gcosθ1(m1r2+m2r+m1b+m2b)(b1b+c1bl1θ˙1)l1θ˙1(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2))(b1r+c1rl1θ˙12)l1θ˙14(b2r+c2rl12θ˙12+l22θ˙224+l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2)2)]=l2(m2r12+m2b)θ¨2+m2b(l1θ˙12sin(θ1θ2)gcosθ2)14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1θ˙1cos(θ1θ2)+l2θ˙2)(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1cos(θ1θ2)+l2θ˙2)\begin{aligned} &\dfrac{m_{2b}\cos{(\theta_1-\theta_2)}}{\left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)} \left[-m_{2b}l_2 \left( \ddot{\theta}_2\cos{(\theta_1-\theta_2)} +\dot{\theta}_2^2\sin{(\theta_1-\theta_2)}\right) - g \cos{\theta_1}\left(\dfrac{m_{1r}}{2} +m_{2r} +m_{1b} + m_{2b}\right) -(b_{1b} + c_{1b} l_1 \dot{\theta}_1)l_1 \dot{\theta}_1\right. \\ &\left.-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)(l_1 \dot{\theta}_1 + l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)})-\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1 \dot{\theta}_1}{4} -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1 \dot{\theta}_1\right.\right. \\ &\left.\left.+ \dfrac{l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right)\right] =-l_2 \left(\dfrac{m_{2r}}{12} + m_{2b}\right)\ddot{\theta}_2 + m_{2b}(l_1\dot{\theta}_1^2\sin{(\theta_1-\theta_2)}-g\cos{\theta_2}) -\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\\ &\left(2l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)}+ l_2 \dot{\theta}_2\right) -\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2 \dot{\theta}_2\right)\\ \end{aligned}

Adding l2(m2r12+m2b)θ¨2l_2 \left(\dfrac{m_{2r}}{12} + m_{2b}\right)\ddot{\theta}_2 to both sides

θ¨2((m2r12+m2b)l2m2b2l2cos2(θ1θ2)(m1r12+m1b+m2b))+m2bcos(θ1θ2)(m1r12+m1b+m2b)[m2bl2θ˙22sin(θ1θ2)gcosθ1(m1r2+m2r+m1b+m2b)(b1b+c1bl1θ˙1)l1θ˙1(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2))(b1r+c1rl1θ˙12)l1θ˙14(b2r+c2rl12θ˙12+l22θ˙224+l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2)2)]=m2b(l1θ˙12sin(θ1θ2)gcosθ2)14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1θ˙1cos(θ1θ2)+l2θ˙2)(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1cos(θ1θ2)+l2θ˙2)θ¨2((m2r12+m2b)l2m2b2l2cos2(θ1θ2)(m1r12+m1b+m2b))=m2bcos(θ1θ2)(m1r12+m1b+m2b)[m2bl2θ˙22sin(θ1θ2)gcosθ1(m1r2+m2r+m1b+m2b)(b1b+c1bl1θ˙1)l1θ˙1(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2))(b1r+c1rl1θ˙12)l1θ˙14(b2r+c2rl12θ˙12+l22θ˙224+l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2)2)]+m2b(l1θ˙12sin(θ1θ2)gcosθ2)14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1θ˙1cos(θ1θ2)+l2θ˙2)(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1cos(θ1θ2)+l2θ˙2)\begin{aligned} &\ddot{\theta}_2\left(\left(\dfrac{m_{2r}}{12} + m_{2b}\right)l_2 - \dfrac{m_{2b}^2l_2\cos^2{(\theta_1-\theta_2)}}{\left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)}\right) + \dfrac{m_{2b}\cos{(\theta_1-\theta_2)}}{\left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)}\left[-m_{2b}l_2\dot{\theta}_2^2\sin{(\theta_1-\theta_2)} - g \cos{\theta_1}\left(\dfrac{m_{1r}}{2} +m_{2r} +m_{1b} + m_{2b}\right) -(b_{1b} + c_{1b} l_1 \dot{\theta}_1)l_1 \dot{\theta}_1\right. \\ &\left.-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1 \dot{\theta}_1 + l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}\right)-\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1 \dot{\theta}_1}{4} -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1 \dot{\theta}_1\right.\right. \\ &\left.\left.+ \dfrac{l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right)\right] = m_{2b}\left(l_1\dot{\theta}_1^2\sin{(\theta_1-\theta_2)}-g\cos{\theta_2}\right) -\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)(2l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)}+ l_2 \dot{\theta}_2)\\ &-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2 \dot{\theta}_2\right)\\\\\\ &\ddot{\theta}_2\left(\left(\dfrac{m_{2r}}{12} + m_{2b}\right)l_2 - \dfrac{m_{2b}^2l_2\cos^2{(\theta_1-\theta_2)}}{\left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)}\right) = -\dfrac{m_{2b}\cos{(\theta_1-\theta_2)}}{\left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)}\left[-m_{2b}l_2\dot{\theta}_2^2\sin{(\theta_1-\theta_2)} - g \cos{\theta_1}\left(\dfrac{m_{1r}}{2} +m_{2r} +m_{1b} + m_{2b}\right) -(b_{1b} + c_{1b} l_1 \dot{\theta}_1)l_1 \dot{\theta}_1 \right.\\ &\left.-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1 \dot{\theta}_1 + l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}\right)-\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1 \dot{\theta}_1}{4} -\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1 \dot{\theta}_1 \right.\right.\\ &\left.\left.+ \dfrac{l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right)\right] + m_{2b}\left(l_1\dot{\theta}_1^2\sin{(\theta_1-\theta_2)}-g\cos{\theta_2}\right) -\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(2l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)}+ l_2 \dot{\theta}_2\right)\\ &-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)\left(l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2 \dot{\theta}_2\right)\\\\\\ \end{aligned}
θ¨2=1(m2r12+m2b)l2m2b2l2cos2(θ1θ2)(m1r12+m1b+m2b)[m2bcos(θ1θ2)(m1r12+m1b+m2b)[m2bl2θ˙22sin(θ1θ2)+gcosθ1(m1r2+m2r+m1b+m2b)(b1b+c1bl1θ˙1)l1θ˙1+(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2))+(b1r+c1rl1θ˙12)l1θ˙14+(b2r+c2rl12θ˙12+l22θ˙224+l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1+l2θ˙2cos(θ1θ2)2)]+m2b(l1θ˙12sin(θ1θ2)gcosθ2)14(b2r+c2rl12θ˙12+l22θ˙224+l1l2θ˙1θ˙2cos(θ1θ2))(2l1θ˙1cos(θ1θ2)+l2θ˙2)(b2b+c2bl12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos(θ1θ2))(l1θ˙1cos(θ1θ2)+l2θ˙2)].\begin{aligned} &\ddot{\theta}_2 = \dfrac{1}{\left(\dfrac{m_{2r}}{12} + m_{2b}\right)l_2 - \dfrac{m_{2b}^2l_2\cos^2{(\theta_1-\theta_2)}}{\left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)}}\left[\dfrac{m_{2b}\cos{(\theta_1-\theta_2)}}{\left(\dfrac{m_{1r}}{12} + m_{1b}+m_{2b}\right)}\left[m_{2b}l_2\dot{\theta}_2^2\sin{(\theta_1-\theta_2)} + g \cos{\theta_1}\left(\dfrac{m_{1r}}{2} +m_{2r} +m_{1b} + m_{2b}\right) -(b_{1b} + c_{1b} l_1 \dot{\theta}_1)l_1 \dot{\theta}_1 \right.\right.\\ &\quad\left.\left.+\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1 l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)(l_1 \dot{\theta}_1 + l_2 \dot{\theta}_2 \cos{(\theta_1-\theta_2)})+\left(b_{1r} + \dfrac{c_{1r}l_1 \dot{\theta}_1}{2}\right) \dfrac{l_1 \dot{\theta}_1}{4} +\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)\left(l_1 \dot{\theta}_1 \right.\right.\right. \\ &\quad\left.\left.\left.+ \dfrac{l_2\dot{\theta}_2 \cos{\left(\theta_1 - \theta_2\right)}}{2}\right)\right] + m_{2b}(l_1\dot{\theta}_1^2\sin{(\theta_1-\theta_2)}-g\cos{\theta_2}) -\dfrac{1}{4}\left(b_{2r} + c_{2r}\sqrt{l_1^2 \dot{\theta}_1^2 + \dfrac{l_2^2 \dot{\theta}_2^2}{4} + l_1 l_2 \dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1 -\theta_2)}}\right)(2l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)}+ l_2 \dot{\theta}_2)\right.\\ &\quad\left.-\left(b_{2b}+c_{2b}\sqrt{l_1^2 \dot{\theta}_1^2 + l_2^2 \dot{\theta}_2^2 +2l_1l_2\dot{\theta}_1 \dot{\theta}_2 \cos{(\theta_1-\theta_2)}}\right)(l_1 \dot{\theta}_1 \cos{(\theta_1-\theta_2)} + l_2 \dot{\theta}_2)\right]. \end{aligned}

At this point, we could rewrite one of our θ¨1\ddot{\theta}_1 equations with θ¨2\ddot{\theta}_2 replaced with the right-hand side of Equation (3). We will not do this as this will add even more potential for errors to creep in, and Equations (2) and (3) are already suitable for numerical integration.

References

[1] Cline, D (2021). 10.4: Rayleigh's Dissipation Function in Variational Principles in Classical Mechanics (Cline). University of Rochester.
[2] Dourmashkin, P (2022). 16.3 Rotational Kinetic Energy and Moment of Inertia in Classical Mechanics (Dourmashkin). Massachusetts Institute of Technology.