Deriving the equations of motion for the double elastic pendulum

Figure 1: Diagram of the double elastic pendulum.

This article focuses on deriving the equations of motion of the coupled elastic pendulums depicted in Figure 1. If you would like to see their solution, they can be found here.

We will derive our own equations of motion based on the Euler-Lagrange equation with dissipative forces

ddt∂L∂q˙i−∂L∂qi=∑jF⃗D,j⋅∂r⃗j∂qi.\begin{aligned} \dfrac{d}{dt} \dfrac{\partial \mathcal{L}}{\partial \dot{q}_i} - \dfrac{\partial \mathcal{L}}{\partial q_i} &= \sum_j \vec{F}_{D,j} \cdot \dfrac{\partial \vec{r}_j}{\partial q_i}. \end{aligned}

Where

  • jj refers to the component of the system we are analysing.

  • (qi)(q_i) are the generalized coordinates of the system.

  • (q˙i)(\dot{q}_i) are the first time derivatives of the generalized coordinates of the system.

  • r⃗j\vec{r}_j is the position vector of component jj of the system.

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

  • pi=∂L∂q˙ip_i = \dfrac{\partial \mathcal{L}}{\partial \dot{q}_i} is the generalized momentum canonical to qiq_i.

  • Fi=∂L∂qiF_i = \dfrac{\partial \mathcal{L}}{\partial q_i} is the generalized force canonical to qiq_i.

  • F⃗D,j\vec{F}_{D,j} is the dissipative force vector for component jj.

  • e^j,i=∂r⃗j∂qi\hat{e}_{j,i} = \dfrac{\partial \vec{r}_j}{\partial q_i} is the generalized basis vector canonical to qiq_i for component jj of the system.

  • The left-hand side of Equation Equation (1) can also be represented as −δLδqi-\dfrac{\delta \mathcal{L}}{\delta q_i}, where δLδqi\dfrac{\delta \mathcal{L}}{\delta q_i} is the functional derivative of the Lagrangian with respect to qiq_i. To simplify things, we will call −δLδqi=δ′Lδ′qi-\dfrac{\delta \mathcal{L}}{\delta q_i} = \dfrac{\delta' \mathcal{L}}{\delta' q_i}

  • The right-hand side of Equation Equation (1) is also called the generalized dissipative force and can be represented as QiQ_i.

Caveats

The masses of the pendulum rods (or springs) and the friction they experience are ignored as including them into the calculation for rigid double pendulums does not make things more interesting and merely complicates the calculation. I did try deriving the equations of motion while including the rods using SymPy, specifically with the code

from sympy import symbols, Function, diff, cos, sin, simplify, sqrt, Abs, Eq, solve, latex
from sympy.vector import CoordSys3D
from multiprocessing import Pool, cpu_count
N = CoordSys3D('N');
# Set up symbols
t = symbols('t')
m1b = symbols('m1b'); 
m2b = symbols('m2b'); 
m1r = symbols('m1r'); 
m2r = symbols('m2r'); 
l1 = symbols('11');
l2 = symbols('l2');
k1 = symbols('k1'); 
k2 = symbols('k2'); 
g = symbols('g'); 
b1r = symbols('b1r'); 
b2r = symbols('b2r'); 
b1b = symbols('b1b'); 
b2b = symbols('b2b'); 
c1r = symbols("c1r"); 
c1b = symbols("c1b"); 
c2r = symbols("c2r"); 
c2b = symbols("c2b");
# Functions
r1 = Function('r1')(t); 
theta1=Function('theta1')(t); 
r2 = Function('r2')(t); 
theta2=Function('theta2')(t);

# Bob 1
x1b = r1*cos(theta1);
y1b = r1*sin(theta1);
x1bdot = diff(x1b, t);
y1bdot = diff(y1b, t);
v1b_mag = simplify(sqrt(x1bdot**2 + y1bdot**2));
v1b_sq = simplify(x1bdot**2 + y1bdot**2);
r1b = x1b * N.i + y1b * N.j;
v1b = x1bdot * N.i + y1bdot * N.j;
e1b_r1 = diff(r1b, r1);
e1b_r2 = diff(r1b, r2);
e1b_th1 = diff(r1b, theta1);
e1b_th2 = diff(r1b, theta2);

# Bob 2
x2b = x1b+r2*cos(theta2);
y2b = y1b + r2*sin(theta2);
x2bdot = diff(x2b, t);
y2bdot = diff(y2b, t);
v2b_mag = simplify(sqrt(x2bdot**2 + y2bdot**2));
v2b_sq = simplify(x2bdot**2 + y2bdot**2);
r2b = x2b * N.i + y2b * N.j;
v2b = x2bdot * N.i + y2bdot * N.j;
e2b_r1 = diff(r2b, r1);
e2b_r2 = diff(r2b, r2);
e2b_th1 = diff(r2b, theta1);
e2b_th2 = diff(r2b, theta2);


# Rod 1
x1r = x1b/2;
x1rdot = diff(x1r, t);
y1r = y1b/2;
y1rdot = diff(y1r, t);
v1r_mag = simplify(sqrt(x1rdot**2 + y1rdot**2));
v1r_sq = simplify(x1rdot**2 + y1rdot**2);
v1r = x1rdot * N.i + y1rdot * N.j;
r1r = x1r * N.i + y1r * N.j;
v1r = x1rdot * N.i + y1rdot * N.j;
e1r_r1 = diff(r1r, r1);
e1r_r2 = diff(r1r, r2);
e1r_th1 = diff(r1r, theta1);
e1r_th2 = diff(r1r, theta2);

# Rod 2
x2r = x1b +r2*cos(theta2)/2;
x2rdot = diff(x2r, t);
y2r = y1b + r2*sin(theta2)/2;
y2rdot = diff(y2r, t);
v2r_mag = simplify(sqrt(x2rdot**2 + y2rdot**2));
v2r_sq = simplify(x2rdot**2 + y2rdot**2);
v2r = x2rdot * N.i + y2rdot * N.j;
r2r = x2r * N.i + y2r * N.j;
v2r = x2rdot * N.i + y2rdot * N.j;
e2r_r1 = diff(r2r, r1);
e2r_r2 = diff(r2r, r2);
e2r_th1 = diff(r2r, theta1);
e2r_th2 = diff(r2r, theta2);

Frod1 = -(b1r+c1r*Abs(v1r_mag))*v1r;
Frod2 = -(b2r+c2r*Abs(v2r_mag))*v2r;
Fbob1 = -(b1b+c1b*Abs(v1b_mag))*v1b;
Fbob2 = -(b2b+c2b*Abs(v2b_mag))*v2b;
Qr1 = Frod1.dot(e1r_r1) + Frod2.dot(e2r_r1) + Fbob1.dot(e1b_r1) + Fbob2.dot(e2b_r1);
Qr1 = simplify(Qr1);
Qr2 = Frod1.dot(e1r_r2) + Frod2.dot(e2r_r2) + Fbob1.dot(e1b_r2) + Fbob2.dot(e2b_r2);
Qr2 = simplify(Qr2);
Qth1 = Frod1.dot(e1r_th1) + Frod2.dot(e2r_th1) + Fbob1.dot(e1b_th1) + Fbob2.dot(e2b_th1);
Qth1 = simplify(Qth1);
Qth2 = Frod1.dot(e1r_th2) + Frod2.dot(e2r_th2) + Fbob1.dot(e1b_th2) + Fbob2.dot(e2b_th2);
Qth2 = simplify(Qth2);
T = m1b/2 * v1b_sq + m2b/2 * v2b_sq + m1r/2 * v1r_sq + m2r/2 * v2r_sq + m1r/24*r1**2*diff(theta1, t)**2 + m2r/24 * r2**2*diff(theta2,t)**2
V = m1b * g * y1b + m1r * g * r1 * y1r + m2b * g * y2b + m2r * g * y2r + k1*(r1-l1)**2/2 + k2*(r2-l2)**2/2;
L = T - V; 
def compute_eq_of_motion(args):
    L, Q, coord = args
    t = symbols('t')
    lhs = diff(diff(L, diff(coord, t)), t) - diff(L, coord)
    return Eq(lhs, Q)
	
# Below line was commented out because it caused individual equations to be 
# incredibly long, so I decided to treat generalized dissipation forces as 
# variables. 
#Qs = [Qr1, Qr2, Qth1, Qth2];
Qs = [symbols("Qr1"), symbols("Qr2"), symbols("Qtheta1"), symbols("Qtheta2")]
coords = [r1, r2, theta1, theta2]
d2r1 = diff(r1, t, 2);
d2r2 = diff(r2, t, 2);
d2th1 = diff(theta1, t, 2);
d2th2 = diff(theta2, t, 2);

with Pool(cpu_count()) as pool:
    equations = pool.map(compute_eq_of_motion, [(L, Qs[i], coords[i]) for i in range(4)])

d2 = [d2r1, d2r2, d2th1, d2th2];
# Solve the system
sols = solve(equations, d2, simplify=True)

secdernames = ["d2r1", "d2r2", "d2theta1", "d2theta2"]
for i in range(4):
	print(secdernames[i] + " = \n" + latex(sols[d2[i]]))

And it caused IPython to crash.

Coordinates, velocities and generalized basis vectors

As can be seen, we have four degrees of freedom in this system. The angles the two pendulums make with the positive xx-axis — θ1\theta_1 and θ2\theta_2, respectively — are among our degrees of freedom. We will also need degrees of freedom corresponding to the lengths of the pendulum rods. These degrees of freedom could either be the extent to which they are extended beyond their rest length or their total length. For the sake of simplicity, we will opt to use their total lengths — r1r_1 and r2r_2, respectively. Hence

x1=r1cos⁡θ1x˙1=r˙1cos⁡θ1−r1θ˙1sin⁡θ1y1=r1sin⁡θ1y˙1=r˙1sin⁡θ1+r1θ˙1cos⁡θ1x2=x1+r2cos⁡θ2x˙2=x˙1+r˙2cos⁡θ2−r2θ˙2sin⁡θ2y2=y1+r2sin⁡θ2y˙2=y˙1+r˙2sin⁡θ2+r2θ˙2cos⁡θ2.\begin{aligned} x_1 &= r_1 \cos{\theta_1} & \dot{x}_1 &= \dot{r}_1 \cos{\theta_1} - r_1 \dot{\theta}_1 \sin{\theta_1}\\ y_1 &= r_1 \sin{\theta_1} & \dot{y}_1 &= \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1 \cos{\theta_1} \\ x_2 &= x_1 + r_2\cos{\theta_2} & \dot{x}_2 &= \dot{x}_1 + \dot{r}_2\cos{\theta_2} - r_2\dot{\theta}_2 \sin{\theta_2} \\ y_2 &= y_1 + r_2\sin{\theta_2} & \dot{y}_2 &= \dot{y}_1 + \dot{r}_2\sin{\theta_2} + r_2\dot{\theta}_2 \cos{\theta_2}. \end{aligned}

This means that the velocity of the first pendulum bob is

v⃗1=[x˙1y˙1]=[r˙1cos⁡θ1−r1θ˙1sin⁡θ1r˙1sin⁡θ1+r1θ˙1cos⁡θ1].\begin{aligned} \vec{v}_1 &= \begin{bmatrix} \dot{x}_1 \\ \dot{y}_1 \end{bmatrix} \\ &= \begin{bmatrix} \dot{r}_1 \cos{\theta_1} - r_1 \dot{\theta}_1 \sin{\theta_1} \\ \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1 \cos{\theta_1} \end{bmatrix}. \end{aligned}

Hence

∣v⃗1∣2=r˙12+r12θ˙12.\begin{aligned} |\vec{v}_1|^2 &= \dot{r}_1^2 + r_1^2 \dot{\theta}_1^2. \end{aligned}

As for the velocity of the second pendulum bob, it is

v⃗2=[r˙1cos⁡θ1−r1θ˙1sin⁡θ1+r˙2cos⁡θ2−r2θ˙2sin⁡θ2r˙1sin⁡θ1+r1θ˙1cos⁡θ1+r˙2sin⁡θ2+r2θ˙2cos⁡θ2].\begin{aligned} \vec{v}_2 &= \begin{bmatrix} \dot{r}_1 \cos{\theta_1} - r_1 \dot{\theta}_1 \sin{\theta_1} + \dot{r}_2\cos{\theta_2} - r_2\dot{\theta}_2 \sin{\theta_2} \\ \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1 \cos{\theta_1} + \dot{r}_2\sin{\theta_2} + r_2\dot{\theta}_2 \cos{\theta_2} \end{bmatrix}. \end{aligned}

Let Δ=θ2−θ1\Delta = \theta_2-\theta_1, then square of the velocity is

∣v⃗2∣2=r˙12cos⁡2θ1+r12θ˙12sin⁡2θ1+r˙22cos⁡2θ2+r22θ˙22sin⁡2θ2−2r1r˙1θ˙1cos⁡θ1sin⁡θ1+2r˙1r˙2cos⁡θ1cos⁡θ2−2r˙1r2θ˙2cos⁡θ1sin⁡θ2−2r1r˙2θ˙1sin⁡θ1cos⁡θ2+2r1r2θ˙1θ˙2sin⁡θ1sin⁡θ2−2r˙2r2θ˙2cos⁡θ2sin⁡θ2+r˙12sin⁡2θ1+r12θ˙12cos⁡2θ1+r˙22sin⁡2θ2+r22θ˙22cos⁡2θ2+2r1r˙1θ˙1sin⁡θ1cos⁡θ1+2r˙1r˙2sin⁡θ1sin⁡θ2+2r˙1r2θ˙2sin⁡θ1cos⁡θ2+2r1r˙2θ˙1cos⁡θ1sin⁡θ2+2r1r2θ˙1θ˙2cos⁡θ1cos⁡θ2+2r2r˙2θ˙2sin⁡θ2cos⁡θ2=r˙12+r12θ˙12+r˙22+r22θ˙22+2r1r˙1θ˙1(−cos⁡θ1sin⁡θ1+cos⁡θ1sin⁡θ1)+2r˙1r˙2(cos⁡θ1cos⁡θ2+sin⁡θ1sin⁡θ2)+2r˙1r2θ˙2(−cos⁡θ1sin⁡θ2+sin⁡θ1cos⁡θ2)+2r1r˙2θ˙1(−sin⁡θ1cos⁡θ2+cos⁡θ1sin⁡θ2)+2r1r2θ˙1θ˙2(sin⁡θ1sin⁡θ2+cos⁡θ1cos⁡θ2)+2r2r˙2θ˙2(−cos⁡θ2sin⁡θ2+sin⁡θ2cos⁡θ2)=r˙12+r12θ˙12+r˙22+r22θ˙22+2r˙1r˙2cos⁡(θ2−θ1)−2r˙1r2θ2˙sin⁡(θ2−θ1)+2r1r˙2θ˙1sin⁡(θ2−θ1)+2r1r2θ˙1θ˙2cos⁡(θ2−θ1)=r˙12+r12θ˙12+r˙22+r22θ˙22+2r˙1r˙2cos⁡Δ−2r˙1r2θ2˙sin⁡Δ+2r1r˙2θ˙1sin⁡Δ+2r1r2θ˙1θ˙2cos⁡Δ=r˙12+r12θ˙12+r˙22+r22θ˙22+2cos⁡Δ(r˙1r˙2+r1r2θ˙1θ˙2)+2sin⁡Δ(r1r˙2θ˙1−r˙1r2θ˙2).\begin{aligned} |\vec{v}_2|^2 &= \dot{r}_1^2 \cos^2{\theta_1} + r_1^2 \dot{\theta}_1^2\sin^2{\theta_1} + \dot{r}_2^2\cos^2{\theta_2} + r_2^2\dot{\theta}_2^2\sin^2{\theta_2} -2r_1\dot{r}_1\dot{\theta}_1 \cos{\theta}_1\sin{\theta_1} + 2\dot{r}_1\dot{r}_2\cos{\theta_1}\cos{\theta_2} - 2\dot{r}_1r_2\dot{\theta}_2\cos{\theta_1}\sin{\theta_2} - 2r_1\dot{r}_2 \dot{\theta}_1 \sin{\theta_1}\cos{\theta_2} + 2r_1r_2 \dot{\theta}_1\dot{\theta}_2\sin{\theta_1}\sin{\theta_2}\\ &-2\dot{r}_2r_2\dot{\theta}_2\cos{\theta_2}\sin{\theta_2} + \dot{r}_1^2\sin^2{\theta_1} + r_1^2\dot{\theta}_1^2\cos^2{\theta_1} + \dot{r}_2^2\sin^2{\theta_2} + r_2^2\dot{\theta}_2^2\cos^2{\theta_2} + 2r_1\dot{r}_1\dot{\theta}_1\sin{\theta_1}\cos{\theta_1} + 2\dot{r}_1\dot{r}_2\sin{\theta_1}\sin{\theta_2} + 2\dot{r}_1r_2\dot{\theta}_2\sin{\theta_1}\cos{\theta_2} + 2r_1\dot{r}_2\dot{\theta}_1 \cos{\theta_1}\sin{\theta_2}\\ &+2r_1r_2\dot{\theta}_1\dot{\theta}_2\cos{\theta_1}\cos{\theta_2} + 2r_2\dot{r}_2\dot{\theta}_2\sin{\theta_2}\cos{\theta_2} \\ &= \dot{r}_1^2 + r_1^2 \dot{\theta}_1^2 + \dot{r}_2^2 + r_2^2\dot{\theta}_2^2 + 2r_1\dot{r}_1\dot{\theta}_1(-\cos{\theta_1}\sin{\theta_1} + \cos{\theta_1}\sin{\theta_1}) + 2\dot{r}_1\dot{r}_2(\cos{\theta_1}\cos{\theta_2}+\sin{\theta_1}\sin{\theta_2})+2\dot{r}_1r_2\dot{\theta}_2(-\cos{\theta_1}\sin{\theta_2} + \sin{\theta_1}\cos{\theta_2}) \\ &+ 2r_1\dot{r}_2\dot{\theta}_1(-\sin{\theta_1}\cos{\theta_2}+\cos{\theta_1}\sin{\theta_2}) + 2r_1r_2\dot{\theta}_1\dot{\theta}_2(\sin{\theta_1}\sin{\theta_2} + \cos{\theta_1}\cos{\theta_2}) + 2r_2\dot{r}_2\dot{\theta}_2 (-\cos{\theta_2}\sin{\theta_2} + \sin{\theta_2}\cos{\theta_2}) \\ &= \dot{r}_1^2 + r_1^2 \dot{\theta}_1^2 + \dot{r}_2^2 + r_2^2\dot{\theta}_2^2 + 2\dot{r}_1\dot{r}_2 \cos{(\theta_2-\theta_1)} - 2\dot{r}_1r_2\dot{\theta_2}\sin{(\theta_2-\theta_1)} + 2r_1\dot{r}_2 \dot{\theta}_1 \sin{(\theta_2-\theta_1)} + 2r_1r_2\dot{\theta}_1\dot{\theta}_2\cos{(\theta_2-\theta_1)} \\ &= \dot{r}_1^2 + r_1^2 \dot{\theta}_1^2 + \dot{r}_2^2 + r_2^2\dot{\theta}_2^2 + 2\dot{r}_1\dot{r}_2 \cos{\Delta} - 2\dot{r}_1r_2\dot{\theta_2}\sin{\Delta} + 2r_1\dot{r}_2 \dot{\theta}_1 \sin{\Delta} + 2r_1r_2\dot{\theta}_1\dot{\theta}_2\cos{\Delta} \\ &= \dot{r}_1^2 + r_1^2 \dot{\theta}_1^2 + \dot{r}_2^2 + r_2^2\dot{\theta}_2^2 + 2\cos{\Delta}(\dot{r}_1\dot{r}_2 + r_1r_2\dot{\theta}_1\dot{\theta}_2) + 2\sin{\Delta}(r_1\dot{r}_2\dot{\theta}_1-\dot{r}_1r_2\dot{\theta}_2). \end{aligned}

Let us define ∣Δv⃗21∣2=∣v⃗2∣2−∣v⃗1∣2|\Delta \vec{v}_{21}|^2 = |\vec{v}_2|^2 - |\vec{v}_1|^2, as this will simplify our Lagrangian later.

∣Δv⃗21∣2=r˙22+r22θ˙22+2cos⁡Δ(r˙1r˙2+r1r2θ˙1θ˙2)+2sin⁡Δ(r1r˙2θ˙1−r˙1r2θ˙2).\begin{aligned} |\Delta \vec{v}_{21}|^2 &= \dot{r}_2^2 + r_2^2\dot{\theta}_2^2 + 2\cos{\Delta}(\dot{r}_1\dot{r}_2 + r_1r_2\dot{\theta}_1\dot{\theta}_2) + 2\sin{\Delta}(r_1\dot{r}_2\dot{\theta}_1-\dot{r}_1r_2\dot{\theta}_2). \end{aligned}

Dissipative forces

We will assume that the dissipative forces are proportion to the velocity and velocity squared of the pendulum bobs. Meaning they will have the form

F⃗D,j=−(bj+cj∣v⃗j∣)v⃗j.\begin{aligned} \vec{F}_{D,j} &= -(b_j+c_j|\vec{v}_j|)\vec{v}_j. \end{aligned}

Where jj is the pendulum bob of interest, bjb_j and cjc_j are constants.

Kinetic energy

The kinetic energy of the system is given by

T=m12∣v⃗1∣2+m22∣v⃗2∣2=m1+m22∣v⃗1∣2+m22∣Δv⃗21∣2.\begin{aligned} T &= \dfrac{m_1}{2}|\vec{v}_1|^2 + \dfrac{m_2}{2}|\vec{v}_2|^2 \\ &= \dfrac{m_1+m_2}{2}|\vec{v}_1|^2 + \dfrac{m_2}{2}|\Delta \vec{v}_{21}|^2. \end{aligned}

Potential energy

The potential energy of the system is given by

V=m1gy1+m2gy2+k1(r1−l1)2+k2(r2−l2)22=m1gr1sin⁡θ1+m2g(r1sin⁡θ1+r2sin⁡θ2)+k1(r1−l1)2+k2(r2−l2)22=(m1+m2)gr1sin⁡θ1+m2gr2sin⁡θ2+k1(r1−l1)2+k2(r2−l2)22.\begin{aligned} V &= m_1 gy_1 + m_2gy_2 + \dfrac{k_1(r_1-l_1)^2+k_2(r_2-l_2)^2}{2}\\ &= m_1 gr_1\sin{\theta_1} + m_2g(r_1\sin{\theta_1} + r_2\sin{\theta_2}) + \dfrac{k_1(r_1-l_1)^2+k_2(r_2-l_2)^2}{2}\\ &= (m_1+m_2)gr_1\sin{\theta_1} + m_2gr_2\sin{\theta_2} + \dfrac{k_1(r_1-l_1)^2+k_2(r_2-l_2)^2}{2}. \end{aligned}

Lagrangian

Hence the Lagrangian of the system is

L=T−V=m1+m22∣v⃗1∣2+m22∣Δv⃗21∣2−[(m1+m2)gr1sin⁡θ1+m2gr2sin⁡θ2]−k1(r1−l1)2+k2(r2−l2)22=(m1+m2)[∣v⃗1∣22−gr1sin⁡θ1]+m2[∣Δv⃗21∣22−gr2sin⁡θ2]−k1(r1−l1)2+k2(r2−l2)22.\begin{aligned} \mathcal{L} &= T - V \\ &= \dfrac{m_1+m_2}{2}|\vec{v}_1|^2 + \dfrac{m_2}{2}|\Delta \vec{v}_{21}|^2 - \left[(m_1+m_2)gr_1\sin{\theta_1} + m_2gr_2\sin{\theta_2}\right] - \dfrac{k_1(r_1-l_1)^2+k_2(r_2-l_2)^2}{2} \\ &= (m_1+m_2)\left[\dfrac{|\vec{v}_1|^2}{2} - gr_1\sin{\theta_1}\right] + m_2\left[\dfrac{|\Delta \vec{v}_{21}|^2}{2} - gr_2\sin{\theta_2}\right] - \dfrac{k_1(r_1-l_1)^2+k_2(r_2-l_2)^2}{2}. \end{aligned}

We will not expand this Lagrangian, as doing so just adds to its complexity. Instead, we will calculate the derivatives of each of its components.

Derivative of components of the Lagrangian

Square of the velocity of the first pendulum's bob

The relevant partial and standard derivatives are:

∂∣v⃗1∣2∂r1=2r1θ˙12∂∣v⃗1∣2∂r2=0∂∣v⃗1∣2∂θ1=0∂∣v⃗1∣2∂θ2=0∂∣v⃗1∣2∂r˙1=2r˙1∂∣v⃗1∣2∂r˙2=0∂∣v⃗1∣2∂θ˙1=2r12θ˙1∂∣v⃗1∣2∂θ˙2=0ddt∂∣v⃗1∣2∂r˙1=2r¨1ddt∂∣v⃗1∣2∂r˙2=0ddt∂∣v⃗1∣2∂θ˙1=2r12θ¨1+4r1r˙1θ˙1ddt∂∣v⃗1∣2∂θ˙2=0\begin{aligned} \dfrac{\partial |\vec{v}_1|^2}{\partial r_1} &= 2r_1\dot{\theta}_1^2 & \dfrac{\partial |\vec{v}_1|^2}{\partial r_2} &= 0 & \dfrac{\partial |\vec{v}_1|^2}{\partial \theta_1} &= 0 & \dfrac{\partial |\vec{v}_1|^2}{\partial \theta_2} &= 0\\ \dfrac{\partial |\vec{v}_1|^2}{\partial \dot{r}_1} &= 2\dot{r}_1 & \dfrac{\partial |\vec{v}_1|^2}{\partial \dot{r}_2} &= 0 & \dfrac{\partial |\vec{v}_1|^2}{\partial \dot{\theta}_1} &= 2r_1^2\dot{\theta}_1 & \dfrac{\partial |\vec{v}_1|^2}{\partial \dot{\theta}_2} &= 0\\ \dfrac{d}{dt} \dfrac{\partial |\vec{v}_1|^2}{\partial \dot{r}_1} &= 2\ddot{r}_1 & \dfrac{d}{dt}\dfrac{\partial |\vec{v}_1|^2}{\partial \dot{r}_2} &= 0 & \dfrac{d}{dt}\dfrac{\partial |\vec{v}_1|^2}{\partial \dot{\theta}_1} &= 2r_1^2 \ddot{\theta}_1 + 4r_1\dot{r}_1\dot{\theta}_1 & \dfrac{d}{dt}\dfrac{\partial |\vec{v}_1|^2}{\partial \dot{\theta}_2} &= 0 \end{aligned}

Hence the negative functional derivatives are

δ′∣v⃗1∣2δ′r1=ddt∂∣v⃗1∣2∂r˙1−∂∣v⃗1∣2∂r1δ′∣v⃗1∣2δ′r2=ddt∂∣v⃗1∣2∂r˙2−∂∣v⃗1∣2∂r2δ′∣v⃗1∣2δ′θ1=ddt∂∣v⃗1∣2∂θ˙1−∂∣v⃗1∣2∂θ1δ′∣v⃗1∣2δ′θ2=ddt∂∣v⃗1∣2∂θ˙2−∂∣v⃗1∣2∂θ2=2r¨1−2r1θ˙12=0=2r12θ¨1+4r1r˙1θ˙1=0.\begin{aligned} \dfrac{\delta' |\vec{v}_1|^2}{\delta' r_1} &= \dfrac{d}{dt}\dfrac{\partial |\vec{v}_1|^2}{\partial \dot{r}_1} - \dfrac{\partial |\vec{v}_1|^2}{\partial r_1} & \dfrac{\delta' |\vec{v}_1|^2}{\delta' r_2} &= \dfrac{d}{dt}\dfrac{\partial |\vec{v}_1|^2}{\partial \dot{r}_2} - \dfrac{\partial |\vec{v}_1|^2}{\partial r_2} & \dfrac{\delta' |\vec{v}_1|^2}{\delta' \theta_1} &= \dfrac{d}{dt}\dfrac{\partial |\vec{v}_1|^2}{\partial \dot{\theta}_1} - \dfrac{\partial |\vec{v}_1|^2}{\partial \theta_1} & \dfrac{\delta' |\vec{v}_1|^2}{\delta' \theta_2} &= \dfrac{d}{dt}\dfrac{\partial |\vec{v}_1|^2}{\partial \dot{\theta}_2} - \dfrac{\partial |\vec{v}_1|^2}{\partial \theta_2}\\ &= 2\ddot{r}_1 - 2r_1\dot{\theta}_1^2 & &= 0 & &=2r_1^2\ddot{\theta}_1 + 4r_1\dot{r}_1\dot{\theta}_1 & &= 0. \end{aligned}

Difference in the square of each bob's velocity

Hence the partial and standard derivatives of the difference in the square of each bob's velocity is

∂∣Δv⃗21∣2∂r1=2r2θ˙1θ˙2cos⁡Δ+2r˙2θ˙1sin⁡Δ∂∣Δv⃗21∣2∂r2=2r2θ˙22+2r1θ˙1θ˙2cos⁡Δ−2r˙1θ˙2sin⁡Δ∂∣Δv⃗21∣2∂θ1=−2sin⁡Δ⋅−1(r˙1r˙2+r1r2θ˙1θ˙2)+2cos⁡Δ⋅−1(r1r˙2θ˙1−r˙1r2θ˙2)∂∣Δv⃗21∣2∂θ2=−2sin⁡Δ(r˙1r˙2+r1r2θ˙1θ˙2)+2cos⁡Δ(r1r˙2θ˙1−r˙1r2θ˙2)=2sin⁡Δ(r˙1r˙2+r1r2θ˙1θ˙2)−2cos⁡Δ(r1r˙2θ˙1−r˙1r2θ˙2)∂∣Δv⃗21∣2∂r˙1=2r˙2cos⁡Δ−2r2θ˙2sin⁡Δ∂∣Δv⃗21∣2∂r˙2=2r˙2+2r˙1cos⁡Δ+2r1θ˙1sin⁡Δ∂∣Δv⃗21∣2∂θ˙1=2r1r2θ˙2cos⁡Δ+2r1r˙2sin⁡Δ∂∣Δv⃗21∣2∂θ˙2=2r22θ˙2+2r1r2θ˙1cos⁡Δ−2r˙1r2sin⁡Δ\begin{aligned} \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial r_1} &= 2r_2\dot{\theta}_1\dot{\theta}_2\cos{\Delta} + 2\dot{r}_2\dot{\theta}_1\sin{\Delta} & \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial r_2} &= 2r_2\dot{\theta}_2^2+2r_1\dot{\theta}_1\dot{\theta}_2\cos{\Delta}-2\dot{r}_1\dot{\theta}_2\sin{\Delta} \\ \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \theta_1} &= -2\sin{\Delta}\cdot -1(\dot{r}_1\dot{r}_2 + r_1r_2\dot{\theta}_1\dot{\theta}_2) + 2\cos{\Delta}\cdot -1(r_1\dot{r}_2\dot{\theta}_1-\dot{r}_1r_2\dot{\theta}_2) & \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \theta_2} &= -2\sin{\Delta}(\dot{r}_1\dot{r}_2 + r_1r_2\dot{\theta}_1\dot{\theta}_2) + 2\cos{\Delta}(r_1\dot{r}_2\dot{\theta}_1-\dot{r}_1r_2\dot{\theta}_2) \\ &= 2\sin{\Delta}(\dot{r}_1\dot{r}_2 + r_1r_2\dot{\theta}_1\dot{\theta}_2) - 2\cos{\Delta}(r_1\dot{r}_2\dot{\theta}_1-\dot{r}_1r_2\dot{\theta}_2)\\ \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{r}_1} &= 2\dot{r}_2\cos{\Delta} - 2r_2\dot{\theta}_2\sin{\Delta} & \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{r}_2} &= 2\dot{r}_2 + 2\dot{r}_1\cos{\Delta} + 2r_1\dot{\theta}_1\sin{\Delta} \\ \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{\theta}_1} &= 2r_1r_2\dot{\theta}_2\cos{\Delta} + 2r_1\dot{r}_2\sin{\Delta} & \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{\theta}_2} &=2r_2^2\dot{\theta}_2 + 2r_1r_2\dot{\theta}_1\cos{\Delta} - 2\dot{r}_1r_2\sin{\Delta} \end{aligned}

Let us define Δ˙1=2θ˙1−θ˙2\dot{\Delta}_1 = 2\dot{\theta}_1 - \dot{\theta}_2 and Δ˙2=2θ˙2−θ˙1\dot{\Delta}_2 = 2\dot{\theta}_2 - \dot{\theta}_1.

ddt∂∣Δv⃗21∣2∂r˙1=2r¨2cos⁡Δ−2r˙2Δ˙sin⁡Δ−2r˙2θ˙2sin⁡Δ−2r2θ¨2sin⁡Δ−2r2θ˙2Δ˙cos⁡Δ=2cos⁡Δ(r¨2−r2θ˙2Δ˙)−2sin⁡Δ(r˙2Δ˙+r˙2θ˙2+r2θ¨2)=2cos⁡Δ(r¨2−r2θ˙2Δ˙)−2sin⁡Δ(r˙2(2θ˙2−θ˙1)+r2θ¨2)=2cos⁡Δ(r¨2−r2θ˙2Δ˙)−2sin⁡Δ(r˙2Δ˙2+r2θ¨2)ddt∂∣Δv⃗21∣2∂r˙2=2r¨2+2r¨1cos⁡Δ−2r˙1Δ˙sin⁡Δ+2r˙1θ˙1sin⁡Δ+2r1θ¨1sin⁡Δ+2r1θ˙1Δ˙cos⁡Δ=2r¨2+2cos⁡Δ(r¨1+r1θ˙1Δ˙)+2sin⁡Δ(r1θ¨1+r˙1θ˙1−r˙1Δ˙)=2r¨2+2cos⁡Δ(r¨1+r1θ˙1Δ˙)+2sin⁡Δ(r1θ¨1+r˙1(2θ˙1−θ¨2))=2r¨2+2cos⁡Δ(r¨1+r1θ˙1Δ˙)+2sin⁡Δ(r1θ¨1+r˙1Δ˙1)ddt∂∣Δv⃗21∣2∂θ˙1=2r˙1r2θ˙2cos⁡Δ+2r1r˙2θ˙2cos⁡Δ+2r1r2θ¨2cos⁡Δ−2r1r2θ˙2Δ˙sin⁡Δ+2r˙1r˙2sin⁡Δ+2r1r¨2sin⁡Δ+2r1r˙2Δ˙cos⁡Δ=2cos⁡Δ(r˙1r2θ˙2+r1r˙2(θ˙2+Δ˙)+r1r2θ¨2)+2sin⁡Δ(r˙1r˙2+r1r¨2−r1r2θ˙2Δ˙)=2cos⁡Δ(r˙1r2θ˙2+r1r˙2Δ˙2+r1r2θ¨2)+2sin⁡Δ(r˙1r˙2+r1r¨2−r1r2θ˙2Δ˙)ddt∂∣Δv⃗21∣2∂θ˙2=4r2r˙2θ˙2+2r22θ¨2+2r˙1r2θ˙1cos⁡Δ+2r1r˙2θ˙1cos⁡Δ+2r1r2θ¨1cos⁡Δ−2r1r2θ˙1Δ˙sin⁡Δ−2r¨1r2sin⁡Δ−2r˙1r˙2sin⁡Δ−2r˙1r2Δ˙cos⁡Δ=4r2r˙2θ˙2+2r22θ¨2+2cos⁡Δ(r˙1r2(θ˙1−Δ˙)+r1r˙2θ˙1+r1r2θ¨1)−2sin⁡Δ(r1r2θ˙1Δ˙+r¨1r2+r˙1r˙2)=4r2r˙2θ˙2+2r22θ¨2+2cos⁡Δ(r˙1r2Δ˙1+r1r˙2θ˙1+r1r2θ¨1)−2sin⁡Δ(r1r2θ˙1Δ˙+r¨1r2+r˙1r˙2).\begin{aligned} \dfrac{d}{dt} \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{r}_1} &= 2\ddot{r}_2\cos{\Delta} - 2\dot{r}_2\dot{\Delta}\sin{\Delta} - 2\dot{r}_2\dot{\theta}_2\sin{\Delta} - 2r_2\ddot{\theta}_2\sin{\Delta} - 2r_2\dot{\theta}_2\dot{\Delta}\cos{\Delta} \\ &= 2\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2\dot{\Delta}) - 2\sin{\Delta}(\dot{r}_2\dot{\Delta} + \dot{r}_2\dot{\theta}_2+r_2\ddot{\theta}_2)\\ &= 2\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2\dot{\Delta}) - 2\sin{\Delta}(\dot{r}_2(2\dot{\theta}_2-\dot{\theta}_1)+r_2\ddot{\theta}_2)\\ &= 2\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2\dot{\Delta}) - 2\sin{\Delta}(\dot{r}_2\dot{\Delta}_2+r_2\ddot{\theta}_2)\\ \dfrac{d}{dt}\dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{r}_2} &= 2\ddot{r}_2 + 2\ddot{r}_1 \cos{\Delta} -2\dot{r}_1\dot{\Delta}\sin{\Delta} + 2\dot{r}_1\dot{\theta}_1\sin{\Delta} + 2r_1\ddot{\theta}_1\sin{\Delta} + 2r_1\dot{\theta}_1\dot{\Delta}\cos{\Delta} \\ &= 2\ddot{r}_2 + 2\cos{\Delta}(\ddot{r}_1 + r_1\dot{\theta}_1 \dot{\Delta}) + 2\sin{\Delta}(r_1\ddot{\theta}_1 + \dot{r}_1\dot{\theta}_1 - \dot{r}_1\dot{\Delta})\\ &= 2\ddot{r}_2 + 2\cos{\Delta}(\ddot{r}_1 + r_1\dot{\theta}_1 \dot{\Delta}) + 2\sin{\Delta}(r_1\ddot{\theta}_1 + \dot{r}_1(2\dot{\theta}_1 - \ddot{\theta}_2))\\ &= 2\ddot{r}_2 + 2\cos{\Delta}(\ddot{r}_1 + r_1\dot{\theta}_1 \dot{\Delta}) + 2\sin{\Delta}(r_1\ddot{\theta}_1 + \dot{r}_1\dot{\Delta}_1)\\ \dfrac{d}{dt}\dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{\theta}_1} &= 2\dot{r}_1r_2\dot{\theta}_2\cos{\Delta} + 2r_1\dot{r}_2\dot{\theta}_2\cos{\Delta} + 2r_1r_2\ddot{\theta}_2\cos{\Delta} - 2r_1r_2\dot{\theta}_2\dot{\Delta}\sin{\Delta} + 2\dot{r}_1\dot{r}_2\sin{\Delta} + 2r_1\ddot{r}_2\sin{\Delta} + 2r_1\dot{r}_2\dot{\Delta}\cos{\Delta} \\ &= 2\cos{\Delta}(\dot{r}_1r_2\dot{\theta}_2 + r_1\dot{r}_2 (\dot{\theta}_2+\dot{\Delta})+r_1r_2\ddot{\theta}_2) +2\sin{\Delta}(\dot{r}_1\dot{r}_2+r_1\ddot{r}_2-r_1r_2\dot{\theta}_2\dot{\Delta})\\ &= 2\cos{\Delta}(\dot{r}_1r_2\dot{\theta}_2 + r_1\dot{r}_2 \dot{\Delta}_2+r_1r_2\ddot{\theta}_2) +2\sin{\Delta}(\dot{r}_1\dot{r}_2+r_1\ddot{r}_2-r_1r_2\dot{\theta}_2\dot{\Delta})\\ \dfrac{d}{dt}\dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{\theta}_2} &= 4r_2\dot{r}_2\dot{\theta}_2 + 2r_2^2\ddot{\theta}_2 + 2\dot{r}_1r_2\dot{\theta}_1\cos{\Delta} + 2r_1\dot{r}_2\dot{\theta}_1\cos{\Delta} + 2r_1r_2\ddot{\theta}_1\cos{\Delta} - 2r_1r_2\dot{\theta}_1\dot{\Delta}\sin{\Delta} - 2\ddot{r}_1r_2\sin{\Delta} - 2\dot{r}_1\dot{r}_2\sin{\Delta} - 2\dot{r}_1r_2\dot{\Delta}\cos{\Delta} \\ &=4r_2\dot{r}_2\dot{\theta}_2 + 2r_2^2\ddot{\theta}_2 +2\cos{\Delta}(\dot{r}_1r_2(\dot{\theta}_1-\dot{\Delta})+r_1\dot{r}_2\dot{\theta}_1+r_1r_2\ddot{\theta}_1)-2\sin{\Delta}(r_1r_2\dot{\theta}_1\dot{\Delta} + \ddot{r}_1r_2 + \dot{r}_1\dot{r}_2) \\ &=4r_2\dot{r}_2\dot{\theta}_2 + 2r_2^2\ddot{\theta}_2 +2\cos{\Delta}(\dot{r}_1r_2\dot{\Delta}_1+r_1\dot{r}_2\dot{\theta}_1+r_1r_2\ddot{\theta}_1)-2\sin{\Delta}(r_1r_2\dot{\theta}_1\dot{\Delta} + \ddot{r}_1r_2 + \dot{r}_1\dot{r}_2). \end{aligned}

Hence the negative functional derivative for r1r_1 is

δ′∣Δv⃗21∣2δ′r1=ddt∂∣Δv⃗21∣2∂r˙1−∂∣Δv⃗21∣2∂r1=2cos⁡Δ(r¨2−r2θ˙2Δ˙)−2sin⁡Δ(r˙2Δ˙2+r2θ¨2)−(2r2θ˙1θ˙2cos⁡Δ+2r˙2θ˙1sin⁡Δ)=2cos⁡Δ(r¨2−r2θ˙2(Δ˙+θ˙1))−2sin⁡Δ(r˙2(Δ˙2+θ˙1)+r2θ¨2).\begin{aligned} \dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' r_1} &= \dfrac{d}{dt}\dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{r}_1} - \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial r_1} \\ &= 2\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2\dot{\Delta}) - 2\sin{\Delta}(\dot{r}_2\dot{\Delta}_2+r_2\ddot{\theta}_2) - \left(2r_2\dot{\theta}_1\dot{\theta}_2\cos{\Delta} + 2\dot{r}_2\dot{\theta}_1\sin{\Delta}\right) \\ &= 2\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2(\dot{\Delta}+\dot{\theta}_1)) - 2\sin{\Delta} (\dot{r}_2(\dot{\Delta}_2+\dot{\theta}_1)+r_2\ddot{\theta}_2). \end{aligned}

Where Δ˙+θ˙1=θ˙2−θ˙1+θ˙1=θ˙2\dot{\Delta} + \dot{\theta}_1 = \dot{\theta}_2 - \dot{\theta}_1 + \dot{\theta}_1 = \dot{\theta}_2 and Δ˙2+θ˙1=2θ˙2−θ˙1+θ˙1=2θ˙2\dot{\Delta}_2 + \dot{\theta}_1 = 2\dot{\theta}_2 - \dot{\theta}_1 + \dot{\theta}_1 = 2\dot{\theta}_2.

δ′∣Δv⃗21∣2δ′r1=2cos⁡Δ(r¨2−r2θ˙22)−2sin⁡Δ(2r˙2θ˙2+r2θ¨2).\begin{aligned} \dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' r_1} &= 2\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2^2) - 2\sin{\Delta} (2\dot{r}_2\dot{\theta}_2+r_2\ddot{\theta}_2). \end{aligned}

As for r2r_2

δ′∣Δv⃗21∣2δ′r2=ddt∂∣Δv⃗21∣2∂r˙2−∂∣Δv⃗21∣2∂r2=2r¨2+2cos⁡Δ(r¨1+r1θ˙1Δ˙)+2sin⁡Δ(r1θ¨1+r˙1Δ˙1)−[2r2θ˙22+2r1θ˙1θ˙2cos⁡Δ−2r˙1θ˙2sin⁡Δ]=2r¨2−2r2θ˙22+2cos⁡Δ(r¨1+r1θ˙1(Δ˙−θ˙2))+2sin⁡Δ(r1θ¨1+r˙1(Δ˙1+θ˙2)).\begin{aligned} \dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' r_2} &= \dfrac{d}{dt}\dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{r}_2} - \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial r_2} \\ &= 2\ddot{r}_2 + 2\cos{\Delta}(\ddot{r}_1 + r_1\dot{\theta}_1 \dot{\Delta}) + 2\sin{\Delta}(r_1\ddot{\theta}_1 + \dot{r}_1\dot{\Delta}_1) - \left[2r_2\dot{\theta}_2^2+2r_1\dot{\theta}_1\dot{\theta}_2\cos{\Delta}-2\dot{r}_1\dot{\theta}_2\sin{\Delta}\right]\\ &= 2\ddot{r}_2 -2r_2\dot{\theta}_2^2 + 2\cos{\Delta}(\ddot{r}_1 + r_1\dot{\theta}_1( \dot{\Delta}-\dot{\theta}_2))+2\sin{\Delta}(r_1\ddot{\theta}_1 + \dot{r}_1(\dot{\Delta}_1+\dot{\theta}_2)). \end{aligned}

Hence Δ˙−θ˙2=θ˙2−θ˙1−θ˙2=−θ˙1\dot{\Delta}-\dot{\theta}_2 = \dot{\theta}_2-\dot{\theta}_1-\dot{\theta}_2 = -\dot{\theta}_1 and Δ˙1+θ˙2=2θ˙1−θ˙2+θ˙2=2θ˙1\dot{\Delta}_1 + \dot{\theta}_2 = 2\dot{\theta}_1 - \dot{\theta}_2 + \dot{\theta}_2 = 2\dot{\theta}_1.

δ′∣Δv⃗21∣2δ′r2=2r¨2−2r2θ˙22+2cos⁡Δ(r¨1−r1θ˙12)+2sin⁡Δ(r1θ¨1+2r˙1θ˙1).\begin{aligned} \dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' r_2} &= 2\ddot{r}_2 -2r_2\dot{\theta}_2^2 + 2\cos{\Delta}(\ddot{r}_1 - r_1\dot{\theta}_1^2)+2\sin{\Delta}(r_1\ddot{\theta}_1 + 2\dot{r}_1\dot{\theta}_1). \end{aligned}

As for θ1\theta_1

δ′∣Δv⃗21∣2δ′θ1=ddt∂∣Δv⃗21∣2∂θ˙1−∂∣Δv⃗21∣2∂θ1=2cos⁡Δ(r˙1r2θ˙2+r1r˙2Δ˙2+r1r2θ¨2)+2sin⁡Δ(r˙1r˙2+r1r¨2−r1r2θ˙2Δ˙)−[2sin⁡Δ(r˙1r˙2+r1r2θ˙1θ˙2)−2cos⁡Δ(r1r˙2θ˙1−r˙1r2θ˙2)]=2cos⁡Δ(r˙1r2(θ˙2−θ˙2)+r1r˙2(Δ˙2+θ˙1)+r1r2θ¨2)+2sin⁡Δ(r˙1r˙2−r˙1r˙2+r1r¨2−r1r2θ˙2(Δ˙+θ˙1))=2cos⁡Δ(2r1r˙2θ˙2+r1r2θ¨2)+2sin⁡Δ(r1r¨2−r1r2θ˙22).\begin{aligned} \dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' \theta_1} &= \dfrac{d}{dt}\dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{\theta}_1} - \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \theta_1} \\ &= 2\cos{\Delta}(\dot{r}_1r_2\dot{\theta}_2 + r_1\dot{r}_2 \dot{\Delta}_2+r_1r_2\ddot{\theta}_2) +2\sin{\Delta}(\dot{r}_1\dot{r}_2+r_1\ddot{r}_2-r_1r_2\dot{\theta}_2\dot{\Delta}) - \left[2\sin{\Delta}(\dot{r}_1\dot{r}_2 + r_1r_2\dot{\theta}_1\dot{\theta}_2) - 2\cos{\Delta}(r_1\dot{r}_2\dot{\theta}_1-\dot{r}_1r_2\dot{\theta}_2)\right] \\ &= 2\cos{\Delta}(\dot{r}_1r_2(\dot{\theta}_2 - \dot{\theta}_2)+ r_1\dot{r}_2 (\dot{\Delta}_2+\dot{\theta}_1)+r_1r_2\ddot{\theta}_2) +2\sin{\Delta}(\dot{r}_1\dot{r}_2-\dot{r}_1\dot{r}_2+r_1\ddot{r}_2-r_1r_2\dot{\theta}_2(\dot{\Delta}+\dot{\theta}_1)) \\ &= 2\cos{\Delta}(2r_1\dot{r}_2\dot{\theta}_2+r_1r_2\ddot{\theta}_2) +2\sin{\Delta}(r_1\ddot{r}_2-r_1r_2\dot{\theta}_2^2). \end{aligned}

As for θ2\theta_2

δ′∣Δv⃗21∣2δ′θ2=ddt∂∣Δv⃗21∣2∂θ˙2−∂∣Δv⃗21∣2∂θ2=4r2r˙2θ˙2+2r22θ¨2+2cos⁡Δ(r˙1r2Δ˙1+r1r˙2θ˙1+r1r2θ¨1)−2sin⁡Δ(r1r2θ˙1Δ˙+r¨1r2+r˙1r˙2)−[−2sin⁡Δ(r˙1r˙2+r1r2θ˙1θ˙2)+2cos⁡Δ(r1r˙2θ˙1−r˙1r2θ˙2)]=4r2r˙2θ˙2+2r22θ¨2+2cos⁡Δ(r˙1r2(Δ˙1+θ˙2)+r1r˙2(θ˙1−θ˙1)+r1r2θ¨1)+2sin⁡Δ(r1r2θ˙1(θ˙2−Δ˙)−r¨1r2+r˙1r˙2−r˙1r˙2)=4r2r˙2θ˙2+2r22θ¨2+2cos⁡Δ(2r˙1r2θ˙1+r1r2θ¨1)+2sin⁡Δ(r1r2θ˙1(θ˙2−(θ˙2−θ˙1))−r¨1r2)=4r2r˙2θ˙2+2r22θ¨2+2cos⁡Δ(2r˙1r2θ˙1+r1r2θ¨1)+2sin⁡Δ(r1r2θ˙12−r¨1r2).\begin{aligned} \dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' \theta_2} &= \dfrac{d}{dt}\dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \dot{\theta}_2} - \dfrac{\partial |\Delta \vec{v}_{21}|^2}{\partial \theta_2} \\ &= 4r_2\dot{r}_2\dot{\theta}_2 + 2r_2^2\ddot{\theta}_2 +2\cos{\Delta}(\dot{r}_1r_2\dot{\Delta}_1+r_1\dot{r}_2\dot{\theta}_1+r_1r_2\ddot{\theta}_1)-2\sin{\Delta}(r_1r_2\dot{\theta}_1\dot{\Delta} + \ddot{r}_1r_2 + \dot{r}_1\dot{r}_2) - \left[-2\sin{\Delta}(\dot{r}_1\dot{r}_2 + r_1r_2\dot{\theta}_1\dot{\theta}_2) + 2\cos{\Delta}(r_1\dot{r}_2\dot{\theta}_1-\dot{r}_1r_2\dot{\theta}_2)\right] \\ &= 4r_2\dot{r}_2\dot{\theta}_2 + 2r_2^2\ddot{\theta}_2 +2\cos{\Delta}(\dot{r}_1r_2(\dot{\Delta}_1+\dot{\theta}_2)+r_1\dot{r}_2(\dot{\theta}_1-\dot{\theta}_1)+r_1r_2\ddot{\theta}_1)+2\sin{\Delta}(r_1r_2\dot{\theta}_1(\dot{\theta}_2-\dot{\Delta}) - \ddot{r}_1r_2 + \dot{r}_1\dot{r}_2-\dot{r}_1\dot{r}_2) \\ &= 4r_2\dot{r}_2\dot{\theta}_2 + 2r_2^2\ddot{\theta}_2 +2\cos{\Delta}(2\dot{r}_1r_2\dot{\theta}_1+r_1r_2\ddot{\theta}_1)+2\sin{\Delta}(r_1r_2\dot{\theta}_1(\dot{\theta}_2-(\dot{\theta}_2-\dot{\theta}_1))-\ddot{r}_1r_2) \\ &= 4r_2\dot{r}_2\dot{\theta}_2 + 2r_2^2\ddot{\theta}_2 +2\cos{\Delta}(2\dot{r}_1r_2\dot{\theta}_1+r_1r_2\ddot{\theta}_1)+2\sin{\Delta}(r_1r_2\dot{\theta}_1^2-\ddot{r}_1r_2). \end{aligned}

Euler-Lagrange equations with dissipation

r1r_1

It is important to note that δ′f(qi)δ′qi=−∂f∂qi\dfrac{\delta' f(q_i)}{\delta' q_i} = -\dfrac{\partial f}{\partial q_i} and of course if a term does not depend on qiq_i or q˙i\dot{q}_i its functional derivative with respect to qiq_i is zero. Hence

δ′Lδ′r1=(m1+m2)[δ′∣v⃗1∣2δ′r12−gsin⁡θ1δ′r1δ′r1]+m2[δ′∣Δv⃗21∣2δ′r12]−k12δ′(r1−l1)2δ′r1.\begin{aligned} \dfrac{\delta' \mathcal{L}}{\delta' r_1} &= (m_1+m_2)\left[\dfrac{\dfrac{\delta' |\vec{v}_1|^2}{\delta' r_1}}{2} -g\sin{\theta_1}\dfrac{\delta' r_1}{\delta' r_1}\right] + m_2\left[\dfrac{\dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' r_1}}{2}\right] - \dfrac{k_1}{2} \dfrac{\delta' (r_1-l_1)^2}{\delta' r_1}. \end{aligned}

We have deliberately ignored the m2gr2sin⁡θ2m_2gr_2\sin{\theta_2} and −k2(r2−l2)22-\dfrac{k_2(r_2-l_2)^2}{2} as they are independent of r1r_1.

δ′Lδ′r1=(m1+m2)[2r¨1−2r1θ˙122+gsin⁡θ1]+m2[2cos⁡Δ(r¨2−r2θ˙22)−2sin⁡Δ(2r˙2θ˙2+r2θ¨2)2]+k1(r1−l1)=(m1+m2)[r¨1−r1θ˙12+gsin⁡θ1]+m2[cos⁡Δ(r¨2−r2θ˙22)−sin⁡Δ(2r˙2θ˙2+r2θ¨2)]+k1(r1−l1).\begin{aligned} \dfrac{\delta' \mathcal{L}}{\delta' r_1} &= (m_1+m_2)\left[\dfrac{2\ddot{r}_1-2r_1\dot{\theta}_1^2}{2} + g\sin{\theta_1}\right] + m_2\left[\dfrac{2\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2^2) - 2\sin{\Delta} (2\dot{r}_2\dot{\theta}_2+r_2\ddot{\theta}_2)}{2}\right] + k_1(r_1-l_1)\\ &= (m_1+m_2)\left[\ddot{r}_1-r_1\dot{\theta}_1^2 + g\sin{\theta_1}\right] + m_2\left[\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2^2) - \sin{\Delta} (2\dot{r}_2\dot{\theta}_2+r_2\ddot{\theta}_2)\right] + k_1(r_1-l_1). \end{aligned}

The generalized dissipation force canonical to r1r_1 is hence

Qr1=−(b1+c1∣v⃗1∣)v⃗1⋅∂r⃗1∂r1−(b2+c2∣v⃗2∣)v⃗2⋅∂r⃗2∂r1=−(b1+c1∣v⃗1∣)[r˙1cos⁡θ1−r1θ˙1sin⁡θ1r˙1sin⁡θ1+r1θ˙1cos⁡θ1]⋅[cos⁡θ1sin⁡θ1]−(b2+c2∣v⃗2∣)[r˙1cos⁡θ1−r1θ˙1sin⁡θ1+r˙2cos⁡θ2−r2θ˙2sin⁡θ2r˙1sin⁡θ1+r1θ˙1cos⁡θ1+r˙2sin⁡θ2+r2θ˙2cos⁡θ2]⋅[cos⁡θ1sin⁡θ1]=−(b1+c1∣v⃗1∣)[r˙1cos⁡2θ1−r1θ˙1sin⁡θ1cos⁡θ1+r˙1sin⁡2θ1+r1θ˙1cos⁡θ1sin⁡θ1]−(b2+c2∣v⃗2∣)[r˙1cos⁡2θ1−r1θ˙1sin⁡θ1cos⁡θ1+r˙2cos⁡θ1cos⁡θ2−r2θ˙2cos⁡θ1sin⁡θ2+r˙1sin⁡2θ1+r1θ˙1cos⁡θ1sin⁡θ1+r˙2sin⁡θ1sin⁡θ2+r2θ˙2sin⁡θ1cos⁡θ2]=−(b1+c1∣v⃗1∣)[r˙1(cos⁡2θ1+sin⁡2θ1)+r1θ˙1(−sin⁡θ1cos⁡θ1+sin⁡θ1cos⁡θ1)]−(b2+c2∣v⃗2∣)[r˙1(cos⁡2θ1+sin⁡2θ1)+r1θ˙1(−sin⁡θ1cos⁡θ1+sin⁡θ1cos⁡θ1)+r˙2(cos⁡θ1cos⁡θ2+sin⁡θ1sin⁡θ2)+r2θ˙2(−cos⁡θ1sin⁡θ2+sin⁡θ1cos⁡θ2)]=−(b1+c1∣v⃗1∣)r˙1−(b2+c2∣v⃗2∣)[r˙1+r˙2cos⁡(θ2−θ1)−r2θ˙2sin⁡(θ2−θ1)].=−(b1+c1∣v⃗1∣)r˙1−(b2+c2∣v⃗2∣)[r˙1+r˙2cos⁡Δ−r2θ˙2sin⁡Δ].\begin{aligned} Q_{r_1} &= -(b_1+c_1|\vec{v}_1|)\vec{v}_1\cdot \dfrac{\partial \vec{r}_1}{\partial r_1} - (b_2+c_2|\vec{v}_2|)\vec{v}_2\cdot \dfrac{\partial \vec{r}_2}{\partial r_1} \\ &= -(b_1+c_1|\vec{v}_1|)\begin{bmatrix} \dot{r}_1\cos{\theta_1} - r_1\dot{\theta}_1\sin{\theta_1} \\ \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1\cos{\theta_1} \end{bmatrix} \cdot \begin{bmatrix} \cos{\theta_1} \\ \sin{\theta_1} \end{bmatrix} - (b_2+c_2|\vec{v}_2|)\begin{bmatrix} \dot{r}_1 \cos{\theta_1} - r_1 \dot{\theta}_1 \sin{\theta_1} + \dot{r}_2\cos{\theta_2} - r_2\dot{\theta}_2 \sin{\theta_2} \\ \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1 \cos{\theta_1} + \dot{r}_2\sin{\theta_2} + r_2\dot{\theta}_2 \cos{\theta_2} \end{bmatrix} \cdot \begin{bmatrix} \cos{\theta_1} \\ \sin{\theta_1} \end{bmatrix} \\ &= -(b_1+c_1|\vec{v}_1|)\left[\dot{r}_1\cos^2{\theta_1} - r_1\dot{\theta}_1\sin{\theta_1}\cos{\theta_1} + \dot{r}_1\sin^2{\theta_1} + r_1\dot{\theta}_1\cos{\theta_1}\sin{\theta_1}\right] - (b_2+c_2|\vec{v}_2|)\left[\dot{r}_1\cos^2{\theta_1} - r_1\dot{\theta}_1\sin{\theta_1}\cos{\theta_1} + \dot{r}_2\cos{\theta_1}\cos{\theta_2}-r_2\dot{\theta}_2\cos{\theta_1}\sin{\theta_2} \right.\\ &\left.+ \dot{r}_1\sin^2{\theta_1} + r_1\dot{\theta}_1\cos{\theta_1}\sin{\theta_1} + \dot{r}_2\sin{\theta_1}\sin{\theta_2} + r_2\dot{\theta}_2\sin{\theta_1}\cos{\theta_2} \right] \\ &= -(b_1+c_1|\vec{v}_1|)\left[\dot{r}_1(\cos^2{\theta_1}+\sin^2{\theta_1})+r_1\dot{\theta}_1(-\sin{\theta}_1\cos{\theta_1}+\sin{\theta_1}\cos{\theta_1})\right] - (b_2+c_2|\vec{v}_2|)\left[\dot{r}_1(\cos^2{\theta_1}+\sin^2{\theta_1}) + r_1\dot{\theta}_1(-\sin{\theta_1}\cos{\theta_1}+\sin{\theta_1}\cos{\theta_1}) \right.\\ &\left. + \dot{r}_2(\cos{\theta_1}\cos{\theta_2}+\sin{\theta_1}\sin{\theta_2})+r_2\dot{\theta}_2(-\cos{\theta_1}\sin{\theta_2} + \sin{\theta_1}\cos{\theta_2}) \right] \\ &= -(b_1+c_1|\vec{v}_1|)\dot{r}_1 - (b_2+c_2|\vec{v}_2|)\left[\dot{r}_1+\dot{r}_2\cos{(\theta_2-\theta_1)}-r_2\dot{\theta}_2\sin{(\theta_2-\theta_1)} \right]. \\ &= -(b_1+c_1|\vec{v}_1|)\dot{r}_1 - (b_2+c_2|\vec{v}_2|)\left[\dot{r}_1+\dot{r}_2\cos{\Delta}-r_2\dot{\theta}_2\sin{\Delta} \right]. \\ \end{aligned}

Hence the Euler-Lagrange equation for r1r_1 with dissipative forces is

(m1+m2)[r¨1−r1θ˙12+gsin⁡θ1]+m2[cos⁡Δ(r¨2−r2θ˙22)−sin⁡Δ(2r˙2θ˙2+r2θ¨2)]+k1(r1−l1)=Qr1.\begin{aligned} (m_1+m_2)\left[\ddot{r}_1-r_1\dot{\theta}_1^2 + g\sin{\theta_1}\right] + m_2\left[\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2^2) - \sin{\Delta} (2\dot{r}_2\dot{\theta}_2+r_2\ddot{\theta}_2)\right] + k_1(r_1-l_1) &= Q_{r_1}. \end{aligned}

Dividing by m1+m2m_1+m_2

r¨1−r1θ˙12+gsin⁡θ1+m2m1+m2[cos⁡Δ(r¨2−r2θ˙22)−sin⁡Δ(2r˙2θ˙2+r2θ¨2)]+k1m1+m2(r1−l1)=Qr1m1+m2.\begin{aligned} \ddot{r}_1-r_1\dot{\theta}_1^2 + g\sin{\theta_1} + \dfrac{m_2}{m_1+m_2}\left[\cos{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2^2) - \sin{\Delta} (2\dot{r}_2\dot{\theta}_2+r_2\ddot{\theta}_2)\right] + \dfrac{k_1}{m_1+m_2}(r_1-l_1) &= \dfrac{Q_{r_1}}{m_1+m_2}. \end{aligned}

Expanding out second derivative terms and placing them first on the left-hand side yields

r¨1+m2cos⁡Δm1+m2r¨2+0θ¨1−m2r2sin⁡Δm1+m2θ¨2−r1θ˙12+gsin⁡θ1−m2m1+m2[r2θ˙22cos⁡Δ+2r˙2θ˙2sin⁡Δ]+k1m1+m2(r1−l1)=Qr1m1+m2.\begin{aligned} \ddot{r}_1 + \dfrac{m_2\cos{\Delta}}{m_1+m_2}\ddot{r}_2 + 0\ddot{\theta}_1 - \dfrac{m_2r_2\sin{\Delta}}{m_1+m_2}\ddot{\theta}_2 - 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{k_1}{m_1+m_2}(r_1-l_1) &= \dfrac{Q_{r_1}}{m_1+m_2}. \end{aligned}

Moving all terms that do not involve second derivatives to the right-hand side yields

r¨1+m2cos⁡Δm1+m2r¨2+0θ¨1−m2r2sin⁡Δm1+m2θ¨2=r1θ˙12−gsin⁡θ1+m2m1+m2[r2θ˙22cos⁡Δ+2r˙2θ˙2sin⁡Δ]+Qr1−k1(r1−l1)m1+m2.\begin{aligned} \ddot{r}_1 + \dfrac{m_2\cos{\Delta}}{m_1+m_2}\ddot{r}_2 + 0\ddot{\theta}_1 - \dfrac{m_2r_2\sin{\Delta}}{m_1+m_2}\ddot{\theta}_2 &= 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}. \end{aligned}

r2r_2

As for r2r_2

δ′Lδ′r2=(m1+m2)[δ′∣v⃗1∣2δ′r22]+m2[δ′∣Δv⃗21∣2δ′r22−gsin⁡θ2δ′r2δ′r2]−k22δ′(r2−l2)2δ′r2=(m1+m2)[02]+m2[2r¨2−2r2θ˙22+2cos⁡Δ(r¨1−r1θ˙12)+2sin⁡Δ(r1θ¨1+2r˙1θ˙1)2+gsin⁡θ2]+k2(r2−l2)=m2[r¨2−r2θ˙22+cos⁡Δ(r¨1−r1θ˙12)+sin⁡Δ(r1θ¨1+2r˙1θ˙1)+gsin⁡θ2]+k2(r2−l2)Qr2=−(b1+c1∣v⃗1∣)v⃗1⋅∂r⃗1∂r2−(b2+c2∣v⃗2∣)v⃗2⋅∂r⃗2∂r2=−(b1+c1∣v⃗1∣)[r˙1cos⁡θ1−r1θ˙1sin⁡θ1r˙1sin⁡θ1+r1θ˙1cos⁡θ1]⋅0⃗−(b2+c2∣v⃗2∣)[r˙1cos⁡θ1−r1θ˙1sin⁡θ1+r˙2cos⁡θ2−r2θ˙2sin⁡θ2r˙1sin⁡θ1+r1θ˙1cos⁡θ1+r˙2sin⁡θ2+r2θ˙2cos⁡θ2]⋅[cos⁡θ2sin⁡θ2]=−(b2+c2∣v⃗2∣)[r˙1cos⁡θ1cos⁡θ2−r1θ˙1sin⁡θ1cos⁡θ2+r˙2cos⁡2θ2−r2θ˙2sin⁡θ2cos⁡θ2+r˙1sin⁡θ1sin⁡θ2+r1θ˙1cos⁡θ1sin⁡θ2+r˙2sin⁡2θ2+r2θ˙2cos⁡θ2sin⁡θ2]=−(b2+c2∣v⃗2∣)[r˙1(cos⁡θ1cos⁡θ2+sin⁡θ1sin⁡θ2)+r1θ˙1(−sin⁡θ1cos⁡θ2+cos⁡θ1sin⁡θ2)+r˙2(cos⁡2θ2+sin⁡2θ2)+r2θ˙2(−sin⁡θ2cos⁡θ2+cos⁡θ2sin⁡θ2)]=−(b2+c2∣v⃗2∣)[r˙1cos⁡(θ2−θ1)+r1θ˙1sin⁡(θ2−θ1)+r˙2]=−(b2+c2∣v⃗2∣)[r˙1cos⁡Δ+r1θ˙1sin⁡Δ+r˙2].\begin{aligned} \dfrac{\delta' \mathcal{L}}{\delta' r_2} &= (m_1+m_2)\left[\dfrac{\dfrac{\delta' |\vec{v}_1|^2}{\delta' r_2}}{2}\right] + m_2\left[\dfrac{\dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' r_2}}{2} - g\sin{\theta}_2\dfrac{\delta' r_2}{\delta' r_2}\right] - \dfrac{k_2}{2} \dfrac{\delta' (r_2-l_2)^2}{\delta' r_2} \\ &= (m_1+m_2)\left[\dfrac{0}{2}\right] + m_2\left[\dfrac{2\ddot{r}_2 -2r_2\dot{\theta}_2^2 + 2\cos{\Delta}(\ddot{r}_1 - r_1\dot{\theta}_1^2)+2\sin{\Delta}(r_1\ddot{\theta}_1 + 2\dot{r}_1\dot{\theta}_1)}{2} + g\sin{\theta_2}\right] + k_2(r_2-l_2) \\ &= m_2\left[\ddot{r}_2 - r_2\dot{\theta}_2^2 + \cos{\Delta}(\ddot{r}_1 - r_1\dot{\theta}_1^2)+\sin{\Delta}(r_1\ddot{\theta}_1 + 2\dot{r}_1\dot{\theta}_1) + g\sin{\theta_2}\right] + k_2(r_2-l_2)\\ Q_{r_2} &= -(b_1+c_1|\vec{v}_1|)\vec{v}_1 \cdot \dfrac{\partial \vec{r}_1}{\partial r_2} - (b_2+c_2|\vec{v}_2|)\vec{v}_2 \cdot \dfrac{\partial \vec{r}_2}{\partial r_2} \\ &= -(b_1+c_1|\vec{v}_1|)\begin{bmatrix} \dot{r}_1\cos{\theta_1} - r_1\dot{\theta}_1\sin{\theta_1} \\ \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1\cos{\theta_1} \end{bmatrix} \cdot \vec{0} - (b_2+c_2|\vec{v}_2|)\begin{bmatrix} \dot{r}_1 \cos{\theta_1} - r_1 \dot{\theta}_1 \sin{\theta_1} + \dot{r}_2\cos{\theta_2} - r_2\dot{\theta}_2 \sin{\theta_2} \\ \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1 \cos{\theta_1} + \dot{r}_2\sin{\theta_2} + r_2\dot{\theta}_2 \cos{\theta_2} \end{bmatrix} \cdot \begin{bmatrix} \cos{\theta_2} \\ \sin{\theta_2} \end{bmatrix} \\ &= - (b_2+c_2|\vec{v}_2|)\left[\dot{r}_1\cos{\theta_1}\cos{\theta_2} - r_1\dot{\theta}_1\sin{\theta_1}\cos{\theta_2} + \dot{r}_2\cos^2{\theta_2}-r_2\dot{\theta}_2\sin{\theta_2}\cos{\theta_2} + \dot{r}_1\sin{\theta_1}\sin{\theta_2} + r_1\dot{\theta}_1\cos{\theta_1}\sin{\theta_2} + \dot{r}_2\sin^2{\theta_2} + r_2\dot{\theta}_2 \cos{\theta_2}\sin{\theta_2}\right] \\ &= - (b_2+c_2|\vec{v}_2|)\left[\dot{r}_1(\cos{\theta_1}\cos{\theta_2}+\sin{\theta_1}\sin{\theta_2}) + r_1\dot{\theta}_1(-\sin{\theta_1}\cos{\theta_2} + \cos{\theta_1}\sin{\theta_2}) + \dot{r}_2(\cos^2{\theta_2} + \sin^2{\theta_2})+r_2\dot{\theta}_2(-\sin{\theta_2}\cos{\theta_2} + \cos{\theta_2}\sin{\theta_2})\right] \\ &= - (b_2+c_2|\vec{v}_2|)\left[\dot{r}_1\cos{(\theta_2-\theta_1)} + r_1\dot{\theta}_1\sin{(\theta_2-\theta_1)} + \dot{r}_2\right] \\ &= - (b_2+c_2|\vec{v}_2|)\left[\dot{r}_1\cos{\Delta} + r_1\dot{\theta}_1\sin{\Delta} + \dot{r}_2\right]. \end{aligned}

Hence the Euler-Lagrange equation for r2r_2 with dissipative forces is

m2[r¨2−r2θ˙22+cos⁡Δ(r¨1−r1θ˙12)+sin⁡Δ(r1θ¨1+2r˙1θ˙1)+gsin⁡θ2]+k2(r2−l2)=Qr2\begin{aligned} m_2\left[\ddot{r}_2 - r_2\dot{\theta}_2^2 + \cos{\Delta}(\ddot{r}_1 - r_1\dot{\theta}_1^2)+\sin{\Delta}(r_1\ddot{\theta}_1 + 2\dot{r}_1\dot{\theta}_1) + g\sin{\theta_2}\right] + k_2(r_2-l_2) &= Q_{r_2} \end{aligned}

Dividing by m2m_2 yields

r¨2−r2θ˙22+cos⁡Δ(r¨1−r1θ˙12)+sin⁡Δ(r1θ¨1+2r˙1θ˙1)+gsin⁡θ2+k2(r2−l2)m2=Qr2m2.\begin{aligned} \ddot{r}_2 - r_2\dot{\theta}_2^2 + \cos{\Delta}(\ddot{r}_1 - r_1\dot{\theta}_1^2)+\sin{\Delta}(r_1\ddot{\theta}_1 + 2\dot{r}_1\dot{\theta}_1) + g\sin{\theta_2} + \dfrac{k_2(r_2-l_2)}{m_2} &= \dfrac{Q_{r_2}}{m_2}. \end{aligned}

Next we will expand out second time derivatives and moving everything else to the right-hand side

cos⁡Δr¨1+r¨2+r1sin⁡Δθ¨1+0θ¨2=r2θ˙22−gsin⁡θ2+r1θ˙12cos⁡Δ−2r˙1θ˙1sin⁡Δ+Qr2−k2(r2−l2)m2.\begin{aligned} \cos{\Delta}\ddot{r}_1 + \ddot{r}_2 + r_1\sin{\Delta}\ddot{\theta}_1 + 0\ddot{\theta}_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}. \end{aligned}

θ1\theta_1

As for θ1\theta_1

δ′Lδ′θ1=(m1+m2)[δ′∣v⃗1∣2δ′θ12−gr1δ′sin⁡θ1δ′θ1]+m2[δ′∣Δv⃗21∣2δ′θ12]=(m1+m2)[2r12θ¨1+4r1r˙1θ˙12+gr1cos⁡θ1]+m2[2cos⁡Δ(2r1r˙2θ˙2+r1r2θ¨2)+2sin⁡Δ(r1r¨2−r1r2θ˙22)2]=(m1+m2)[r12θ¨1+2r1r˙1θ˙1+gr1cos⁡θ1]+m2[cos⁡Δ(2r1r˙2θ˙2+r1r2θ¨2)+sin⁡Δ(r1r¨2−r1r2θ˙22)]Qθ1=−(b1+c1∣v⃗1∣)v⃗1⋅∂r⃗1∂θ1−(b2+c2∣v⃗2∣)v⃗2⋅∂r⃗2∂θ1=−(b1+c1∣v⃗1∣)[r˙1cos⁡θ1−r1θ˙1sin⁡θ1r˙1sin⁡θ1+r1θ˙1cos⁡θ1]⋅r1[−sin⁡θ1cos⁡θ1]−(b2+c2∣v⃗2∣)[r˙1cos⁡θ1−r1θ˙1sin⁡θ1+r˙2cos⁡θ2−r2θ˙2sin⁡θ2r˙1sin⁡θ1+r1θ˙1cos⁡θ1+r˙2sin⁡θ2+r2θ˙2cos⁡θ2]⋅r1[−sin⁡θ1cos⁡θ1]=−(b1+c1∣v⃗1∣)[−r1r˙1cos⁡θ1sin⁡θ1+r12θ˙1sin⁡2θ1+r1r˙1sin⁡θ1cos⁡θ1+r12θ˙1cos⁡2θ1]−(b2+c2∣v⃗2∣)[−r1r˙1cos⁡θ1sin⁡θ1+r12θ1˙sin⁡2θ1−r1r˙2sin⁡θ1cos⁡θ2+r1r2θ˙2sin⁡θ1sin⁡θ2+r1r˙1cos⁡θ1sin⁡θ1+r12θ˙1cos⁡2θ1+r1r˙2cos⁡θ1sin⁡θ2+r1r2θ˙2cos⁡θ1cos⁡θ2]=−(b1+c1∣v⃗1∣)[r1r˙1(−cos⁡θ1sin⁡θ1+sin⁡θ1cos⁡θ1)+r12θ˙1(sin⁡2θ1+cos⁡2θ1)]−(b2+c2∣v⃗2∣)[r1r˙1(−cos⁡θ1sin⁡θ1+cos⁡θ1sin⁡θ1)+r12θ1˙(sin⁡2θ1+cos⁡2θ1)+r1r˙2(−sin⁡θ1cos⁡θ2+cos⁡θ1sin⁡θ2)+r1r2θ˙2(sin⁡θ1sin⁡θ2+cos⁡θ1cos⁡θ2)]=−(b1+c1∣v⃗1∣)r12θ˙1−(b2+c2∣v⃗2∣)[r12θ1˙+r1r˙2sin⁡(θ2−θ1)+r1r2θ˙2cos⁡(θ2−θ1)]\begin{aligned} \dfrac{\delta' \mathcal{L}}{\delta' \theta_1} &= (m_1+m_2)\left[\dfrac{\dfrac{\delta' |\vec{v}_1|^2}{\delta' \theta_1}}{2} - gr_1\dfrac{\delta' \sin{\theta_1}}{\delta' \theta_1}\right] + m_2\left[\dfrac{\dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' \theta_1}}{2}\right] \\ &= (m_1+m_2)\left[\dfrac{2r_1^2\ddot{\theta}_1 + 4r_1\dot{r}_1\dot{\theta}_1}{2} + gr_1\cos{\theta}_1\right] + m_2\left[\dfrac{2\cos{\Delta}(2r_1\dot{r}_2\dot{\theta}_2+r_1r_2\ddot{\theta}_2) +2\sin{\Delta}(r_1\ddot{r}_2-r_1r_2\dot{\theta}_2^2)}{2}\right]\\ &= (m_1+m_2)\left[r_1^2\ddot{\theta}_1 + 2r_1\dot{r}_1\dot{\theta}_1 + gr_1\cos{\theta}_1\right] + m_2\left[\cos{\Delta}(2r_1\dot{r}_2\dot{\theta}_2+r_1r_2\ddot{\theta}_2) +\sin{\Delta}(r_1\ddot{r}_2-r_1r_2\dot{\theta}_2^2)\right]\\ Q_{\theta_1} &= -(b_1+c_1|\vec{v}_1|)\vec{v}_1 \cdot \dfrac{\partial \vec{r}_1}{\partial \theta_1} - (b_2+c_2|\vec{v}_2|)\vec{v}_2 \cdot \dfrac{\partial \vec{r}_2}{\partial \theta_1} \\ &= -(b_1+c_1|\vec{v}_1|)\begin{bmatrix} \dot{r}_1\cos{\theta_1} - r_1\dot{\theta}_1\sin{\theta_1} \\ \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1\cos{\theta}_1 \end{bmatrix} \cdot r_1\begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix} - (b_2+c_2|\vec{v}_2|) \begin{bmatrix} \dot{r}_1 \cos{\theta_1} - r_1 \dot{\theta}_1 \sin{\theta_1} + \dot{r}_2\cos{\theta_2} - r_2\dot{\theta}_2 \sin{\theta_2} \\ \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1 \cos{\theta_1} + \dot{r}_2\sin{\theta_2} + r_2\dot{\theta}_2 \cos{\theta_2} \end{bmatrix} \cdot r_1\begin{bmatrix} -\sin{\theta_1} \\ \cos{\theta_1} \end{bmatrix} \\ &= -(b_1+c_1|\vec{v}_1|)\left[-r_1\dot{r}_1\cos{\theta_1}\sin{\theta_1}+r_1^2\dot{\theta}_1\sin^2{\theta_1} + r_1\dot{r}_1\sin{\theta_1}\cos{\theta_1}+r_1^2\dot{\theta}_1\cos^2{\theta_1}\right] - (b_2+c_2|\vec{v}_2|)\left[-r_1\dot{r}_1\cos{\theta_1}\sin{\theta_1} + r_1^2\dot{\theta_1}\sin^2{\theta_1} -r_1\dot{r}_2\sin{\theta_1}\cos{\theta_2} \right. \\ &\left.+r_1r_2\dot{\theta}_2\sin{\theta_1}\sin{\theta_2}+r_1\dot{r}_1\cos{\theta_1}\sin{\theta_1}+r_1^2\dot{\theta}_1\cos^2{\theta_1} + r_1\dot{r}_2\cos{\theta_1}\sin{\theta_2}+r_1r_2\dot{\theta}_2\cos{\theta_1}\cos{\theta_2}\right] \\ &= -(b_1+c_1|\vec{v}_1|)\left[r_1\dot{r}_1(-\cos{\theta_1}\sin{\theta_1}+\sin{\theta_1}\cos{\theta_1}) + r_1^2\dot{\theta}_1(\sin^2{\theta_1} +\cos^2{\theta_1})\right] - (b_2+c_2|\vec{v}_2|)\left[r_1\dot{r}_1(-\cos{\theta_1}\sin{\theta_1} + \cos{\theta_1}\sin{\theta_1}) +r_1^2\dot{\theta_1}(\sin^2{\theta_1}+\cos^2{\theta_1})\right.\\ &\left.+r_1\dot{r}_2(-\sin{\theta_1}\cos{\theta_2}+\cos{\theta_1}\sin{\theta_2})+r_1r_2\dot{\theta}_2(\sin{\theta_1}\sin{\theta_2}+\cos{\theta_1}\cos{\theta_2})\right] \\ &= -(b_1+c_1|\vec{v}_1|)r_1^2\dot{\theta}_1 - (b_2+c_2|\vec{v}_2|)\left[ r_1^2\dot{\theta_1}+r_1\dot{r}_2\sin{(\theta_2-\theta_1)}+r_1r_2\dot{\theta}_2\cos{(\theta_2-\theta_1)}\right] \end{aligned}

Hence Equation (1) is

(m1+m2)[r12θ¨1+2r1r˙1θ˙1+gr1cos⁡θ1]+m2[cos⁡Δ(2r1r˙2θ˙2+r1r2θ¨2)+sin⁡Δ(r1r¨2−r1r2θ˙22)]=Qθ1.\begin{aligned} (m_1+m_2)\left[r_1^2\ddot{\theta}_1 + 2r_1\dot{r}_1\dot{\theta}_1 + gr_1\cos{\theta}_1\right] + m_2\left[\cos{\Delta}(2r_1\dot{r}_2\dot{\theta}_2+r_1r_2\ddot{\theta}_2) +\sin{\Delta}(r_1\ddot{r}_2-r_1r_2\dot{\theta}_2^2)\right] &= Q_{\theta_1}. \end{aligned}

Dividing by (m1+m2)r12(m_1+m_2)r_1^2 yields

θ¨1+2r˙1θ˙1r1+gcos⁡θ1r1+m2(m1+m2)r1[cos⁡Δ(2r˙2θ˙2+r2θ¨2)+sin⁡Δ(r¨2−r2θ˙22)]=Qθ1(m1+m2)r12.\begin{aligned} \ddot{\theta}_1 + \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[\cos{\Delta}(2\dot{r}_2\dot{\theta}_2+r_2\ddot{\theta}_2) +\sin{\Delta}(\ddot{r}_2-r_2\dot{\theta}_2^2)\right] &= \dfrac{Q_{\theta_1}}{(m_1+m_2)r_1^2}. \end{aligned}

Expanding out all second time derivatives and moving all other terms to the right-hand side yields

0r¨1+m2sin⁡Δ(m1+m2)r1r¨2+θ¨1+m2r2cos⁡Δ(m1+m2)r1θ¨2=−2r˙1θ˙1r1−gcos⁡θ1r1−m2(m1+m2)r1[2r˙2θ˙2cos⁡Δ−r2θ˙22sin⁡Δ]+Qθ1(m1+m2)r12.\begin{aligned} 0\ddot{r}_1 + \dfrac{m_2\sin{\Delta}}{(m_1+m_2)r_1}\ddot{r}_2 + \ddot{\theta}_1 + \dfrac{m_2r_2\cos{\Delta}}{(m_1+m_2)r_1}\ddot{\theta}_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}. \end{aligned}

θ2\theta_2

As for θ2\theta_2

δ′Lδ′θ2=(m1+m2)[δ′∣v⃗1∣2δ′θ22]+m2[δ′∣Δv⃗21∣2δ′θ22−gr2δ′sin⁡θ2δ′θ2]=(m1+m2)[02]+m2[4r2r˙2θ˙2+2r22θ¨2+2cos⁡Δ(2r˙1r2θ˙1+r1r2θ¨1)+2sin⁡Δ(r1r2θ˙12−r¨1r2)2+gr2cos⁡θ2]=m2[2r2r˙2θ˙2+r22θ¨2+cos⁡Δ(2r˙1r2θ˙1+r1r2θ¨1)+sin⁡Δ(r1r2θ˙12−r¨1r2)+gr2cos⁡θ2]Qθ2=−(b1+c1∣v⃗1∣)v⃗1⋅∂r⃗1∂θ2−(b2+c2∣v⃗2∣)v⃗2⋅∂r⃗2∂θ2=−(b2+c2∣v⃗2∣)[r˙1cos⁡θ1−r1θ˙1sin⁡θ1+r˙2cos⁡θ2−r2θ˙2sin⁡θ2r˙1sin⁡θ1+r1θ˙1cos⁡θ1+r˙2sin⁡θ2+r2θ˙2cos⁡θ2]⋅r2[−sin⁡θ2cos⁡θ2]=−(b2+c2∣v⃗2∣)[−r˙1r2cos⁡θ1sin⁡θ2+r1r2θ˙1sin⁡θ1sin⁡θ2−r2r˙2cos⁡θ2sin⁡θ2+r22θ˙2sin⁡2θ2+r˙1r2sin⁡θ1cos⁡θ2+r1r2θ˙1cos⁡θ1cos⁡θ2+r2r˙2sin⁡θ2cos⁡θ2+r22θ˙2cos⁡2θ2]=−(b2+c2∣v⃗2∣)[r˙1r2(−cos⁡θ1sin⁡θ2+sin⁡θ1cos⁡θ2)+r1r2θ˙1(sin⁡θ1sin⁡θ2+cos⁡θ1cos⁡θ2)+r2r˙2(−cos⁡θ2sin⁡θ2+sin⁡θ2cos⁡θ2)+r22θ˙2(sin⁡2θ2+cos⁡2θ2)]=−(b2+c2∣v⃗2∣)[r22θ˙2−r˙1r2sin⁡(θ2−θ1)+r1r2θ˙1cos⁡(θ2−θ1)].\begin{aligned} \dfrac{\delta' \mathcal{L}}{\delta' \theta_2} &= (m_1+m_2)\left[\dfrac{\dfrac{\delta' |\vec{v}_1|^2}{\delta' \theta_2}}{2}\right] + m_2\left[\dfrac{\dfrac{\delta' |\Delta \vec{v}_{21}|^2}{\delta' \theta_2}}{2} - gr_2\dfrac{\delta' \sin{\theta_2}}{\delta' \theta_2}\right] \\ &= (m_1+m_2)\left[\dfrac{0}{2}\right]+m_2\left[\dfrac{4r_2\dot{r}_2\dot{\theta}_2 + 2r_2^2\ddot{\theta}_2 +2\cos{\Delta}(2\dot{r}_1r_2\dot{\theta}_1+r_1r_2\ddot{\theta}_1)+2\sin{\Delta}(r_1r_2\dot{\theta}_1^2-\ddot{r}_1r_2)}{2} + gr_2\cos{\theta_2}\right]\\ &= m_2\left[2r_2\dot{r}_2\dot{\theta}_2 + r_2^2\ddot{\theta}_2 +\cos{\Delta}(2\dot{r}_1r_2\dot{\theta}_1+r_1r_2\ddot{\theta}_1)+\sin{\Delta}(r_1r_2\dot{\theta}_1^2-\ddot{r}_1r_2) + gr_2\cos{\theta_2}\right]\\ Q_{\theta_2} &= -(b_1+c_1|\vec{v}_1|)\vec{v}_1 \cdot \dfrac{\partial \vec{r}_1}{\partial \theta_2} - (b_2+c_2|\vec{v}_2|)\vec{v}_2\cdot \dfrac{\partial \vec{r}_2}{\partial \theta_2} \\ &= -(b_2+c_2|\vec{v}_2|)\begin{bmatrix} \dot{r}_1 \cos{\theta_1} - r_1 \dot{\theta}_1 \sin{\theta_1} + \dot{r}_2\cos{\theta_2} - r_2\dot{\theta}_2 \sin{\theta_2} \\ \dot{r}_1\sin{\theta_1} + r_1\dot{\theta}_1 \cos{\theta_1} + \dot{r}_2\sin{\theta_2} + r_2\dot{\theta}_2 \cos{\theta_2} \end{bmatrix} \cdot r_2\begin{bmatrix} -\sin{\theta_2}\\ \cos{\theta_2} \end{bmatrix} \\ &= -(b_2+c_2|\vec{v}_2|)\left[-\dot{r}_1r_2\cos{\theta}_1\sin{\theta_2} + r_1r_2\dot{\theta}_1\sin{\theta_1}\sin{\theta_2} - r_2\dot{r}_2\cos{\theta_2}\sin{\theta_2} + r_2^2\dot{\theta}_2\sin^2{\theta_2} + \dot{r}_1r_2\sin{\theta_1}\cos{\theta_2} + r_1r_2\dot{\theta}_1\cos{\theta_1}\cos{\theta_2} + r_2\dot{r}_2\sin{\theta_2}\cos{\theta_2} + r_2^2\dot{\theta}_2\cos^2{\theta_2}\right]\\ &= -(b_2+c_2|\vec{v}_2|)\left[\dot{r}_1r_2(-\cos{\theta}_1\sin{\theta_2} + \sin{\theta_1}\cos{\theta_2}) + r_1r_2\dot{\theta}_1(\sin{\theta_1}\sin{\theta_2}+\cos{\theta_1}\cos{\theta_2}) + r_2\dot{r}_2(-\cos{\theta_2}\sin{\theta_2} + \sin{\theta_2}\cos{\theta_2}) + r_2^2\dot{\theta}_2(\sin^2{\theta_2} +\cos^2{\theta_2})\right]\\ &= -(b_2+c_2|\vec{v}_2|)\left[ r_2^2\dot{\theta}_2-\dot{r}_1r_2\sin{(\theta_2-\theta_1)} + r_1r_2\dot{\theta}_1\cos{(\theta_2-\theta_1)}\right]. \end{aligned}

Hence Equation (1) for θ2\theta_2 is

m2[2r2r˙2θ˙2+r22θ¨2+cos⁡Δ(2r˙1r2θ˙1+r1r2θ¨1)+sin⁡Δ(r1r2θ˙12−r¨1r2)+gr2cos⁡θ2]=Qθ2.\begin{aligned} m_2\left[2r_2\dot{r}_2\dot{\theta}_2 + r_2^2\ddot{\theta}_2 +\cos{\Delta}(2\dot{r}_1r_2\dot{\theta}_1+r_1r_2\ddot{\theta}_1)+\sin{\Delta}(r_1r_2\dot{\theta}_1^2-\ddot{r}_1r_2) + gr_2\cos{\theta_2}\right] &= Q_{\theta_2}. \end{aligned}

Dividing by m2r22m_2r_2^2 yields

θ¨2+2r˙2θ˙2r2+cos⁡Δr2(2r˙1θ˙1+r1θ¨1)+sin⁡Δr2(r1θ˙12−r¨1)+gcos⁡θ2r2=Qθ2m2r22.\begin{aligned} \ddot{\theta}_2 + \dfrac{2\dot{r}_2\dot{\theta}_2}{r_2} + \dfrac{\cos{\Delta}}{r_2} (2\dot{r}_1\dot{\theta}_1+r_1\ddot{\theta}_1)+\dfrac{\sin{\Delta}}{r_2}(r_1\dot{\theta}_1^2-\ddot{r}_1) + \dfrac{g\cos{\theta_2}}{r_2} &= \dfrac{Q_{\theta_2}}{m_2r_2^2}. \end{aligned}

Next we will expand out second time derivatives and moving everything else to the right-hand side

−sin⁡Δr2r¨1+0r¨2+r1cos⁡Δr2θ¨1+θ¨2=−2r˙2θ˙2r2−gcos⁡θ2r2−2r˙1θ˙1cos⁡Δr2−r1θ˙12sin⁡Δr2+Qθ2m2r22.\begin{aligned} -\dfrac{\sin{\Delta}}{r_2}\ddot{r}_1 + 0\ddot{r}_2 + \dfrac{r_1\cos{\Delta}}{r_2}\ddot{\theta}_1 + \ddot{\theta}_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{aligned}

Analysis

There are three ways we could solve this problem; each of which involves numerical integration to obtain the final solution. Firstly, we could algebraically manipulate this ordinary differential equation (ODE) system until only one second time derivative appears in each equation. The final ODE system after this manipulation could, in turn, be numerically integrated using any standard scheme (e.g. the Runge-Kutta-Fehlberg method). Secondly, we could numerically integrate it as is using a differential-algebraic equation (DAE) solver, but these tend to be more prone to give convergence errors in my experience. Finally, we could convert the system to matrix form and invert it to obtain numerical approximations of each of our second time derivatives and use these to numerically integrate the system with a standard ODE solver. We will opt for this last method, as the first approach is almost guaranteed to introduce errors and the second gives convergence errors, at least in Julia.

Essentially, we will write our differential equation system as

Aq¨=b.\begin{aligned} \mathbf{A}\mathbf{\ddot{q}} &= \mathbf{b}. \end{aligned}

where q¨\mathbf{\ddot{q}} is a vector containing the second time derivatives of our generalized coordinates. Hence q¨=A−1b\mathbf{\ddot{q}}=\mathbf{A}^{-1} \mathbf{b}. Or, in full form, this above equation is

[1m2cos⁡Δm1+m20−m2r2sin⁡Δm1+m2cos⁡Δ1r1sin⁡Δ00m2sin⁡Δ(m1+m2)r11m2r2cos⁡Δ(m1+m2)r1−sin⁡Δr20r1cos⁡Δr21][r¨1r¨2θ¨1θ¨2]=[r1θ˙12−gsin⁡θ1+m2m1+m2(r2θ˙22cos⁡Δ+2r˙2θ˙2sin⁡Δ)+Qr1−k1(r1−l1)m1+m2r2θ˙22−gsin⁡θ2+r1θ˙12cos⁡Δ−2r˙1θ˙1sin⁡Δ+Qr2−k2(r2−l2)m2−2r˙1θ˙1r1−gcos⁡θ1r1−m2(m1+m2)r1[2r˙2θ˙2cos⁡Δ−r2θ˙22sin⁡Δ]+Qθ1(m1+m2)r12−2r˙2θ˙2r2−gcos⁡θ2r2−2r˙1θ˙1cos⁡Δr2−r1θ˙12sin⁡Δr2+Qθ2m2r22].\begin{aligned} \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} \begin{bmatrix} \ddot{r}_1 \\ \ddot{r}_2 \\ \ddot{\theta}_1 \\ \ddot{\theta}_2 \end{bmatrix} &= \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}

So the solution is

[r¨1r¨2θ¨1θ¨2]=[1m2cos⁡Δm1+m20−m2r2sin⁡Δm1+m2cos⁡Δ1r1sin⁡Δ00m2sin⁡Δ(m1+m2)r11m2r2cos⁡Δ(m1+m2)r1−sin⁡Δr20r1cos⁡Δr21]−1[r1θ˙12−gsin⁡θ1+m2m1+m2(r2θ˙22cos⁡Δ+2r˙2θ˙2sin⁡Δ)+Qr1−k1(r1−l1)m1+m2r2θ˙22−gsin⁡θ2+r1θ˙12cos⁡Δ−2r˙1θ˙1sin⁡Δ+Qr2−k2(r2−l2)m2−2r˙1θ˙1r1−gcos⁡θ1r1−m2(m1+m2)r1[2r˙2θ˙2cos⁡Δ−r2θ˙22sin⁡Δ]+Qθ1(m1+m2)r12−2r˙2θ˙2r2−gcos⁡θ2r2−2r˙1θ˙1cos⁡Δr2−r1θ˙12sin⁡Δr2+Qθ2m2r22].\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}

Ordinarily, I would use a symplectic method to integrate a classical mechanical system, as it minimizes cumulative errors in the Hamiltonian over long-term integration. That being said, symplectic methods typically are either implicit (which significantly increases their computational complexity) or require a separable Hamiltonian. The Hamiltonian of this system would not separable as the kinetic energy cannot be written entirely in terms of momenta. Additionally, rewriting the kinetic energy in terms of the momenta would be tedious and prone to error.