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

ddtLq˙iLqi=jFD,jrjqi.\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.

  • rj\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=Lq˙ip_i = \dfrac{\partial \mathcal{L}}{\partial \dot{q}_i} is the generalized momentum canonical to qiq_i.

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

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

  • e^j,i=rjqi\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θ1r1θ˙1sinθ1y1=r1sinθ1y˙1=r˙1sinθ1+r1θ˙1cosθ1x2=x1+r2cosθ2x˙2=x˙1+r˙2cosθ2r2θ˙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

v1=[x˙1y˙1]=[r˙1cosθ1r1θ˙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

v12=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

v2=[r˙1cosθ1r1θ˙1sinθ1+r˙2cosθ2r2θ˙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

v22=r˙12cos2θ1+r12θ˙12sin2θ1+r˙22cos2θ2+r22θ˙22sin2θ22r1r˙1θ˙1cosθ1sinθ1+2r˙1r˙2cosθ1cosθ22r˙1r2θ˙2cosθ1sinθ22r1r˙2θ˙1sinθ1cosθ2+2r1r2θ˙1θ˙2sinθ1sinθ22r˙2r2θ˙2cosθ2sinθ2+r˙12sin2θ1+r12θ˙12cos2θ1+r˙22sin2θ2+r22θ˙22cos2θ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θ˙1r˙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 Δv212=v22v12|\Delta \vec{v}_{21}|^2 = |\vec{v}_2|^2 - |\vec{v}_1|^2, as this will simplify our Lagrangian later.

Δv212=r˙22+r22θ˙22+2cosΔ(r˙1r˙2+r1r2θ˙1θ˙2)+2sinΔ(r1r˙2θ˙1r˙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

FD,j=(bj+cjvj)vj.\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=m12v12+m22v22=m1+m22v12+m22Δv212.\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(r1l1)2+k2(r2l2)22=m1gr1sinθ1+m2g(r1sinθ1+r2sinθ2)+k1(r1l1)2+k2(r2l2)22=(m1+m2)gr1sinθ1+m2gr2sinθ2+k1(r1l1)2+k2(r2l2)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=TV=m1+m22v12+m22Δv212[(m1+m2)gr1sinθ1+m2gr2sinθ2]k1(r1l1)2+k2(r2l2)22=(m1+m2)[v122gr1sinθ1]+m2[Δv2122gr2sinθ2]k1(r1l1)2+k2(r2l2)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:

v12r1=2r1θ˙12v12r2=0v12θ1=0v12θ2=0v12r˙1=2r˙1v12r˙2=0v12θ˙1=2r12θ˙1v12θ˙2=0ddtv12r˙1=2r¨1ddtv12r˙2=0ddtv12θ˙1=2r12θ¨1+4r1r˙1θ˙1ddtv12θ˙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

δv12δr1=ddtv12r˙1v12r1δv12δr2=ddtv12r˙2v12r2δv12δθ1=ddtv12θ˙1v12θ1δv12δθ2=ddtv12θ˙2v12θ2=2r¨12r1θ˙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

Δv212r1=2r2θ˙1θ˙2cosΔ+2r˙2θ˙1sinΔΔv212r2=2r2θ˙22+2r1θ˙1θ˙2cosΔ2r˙1θ˙2sinΔΔv212θ1=2sinΔ1(r˙1r˙2+r1r2θ˙1θ˙2)+2cosΔ1(r1r˙2θ˙1r˙1r2θ˙2)Δv212θ2=2sinΔ(r˙1r˙2+r1r2θ˙1θ˙2)+2cosΔ(r1r˙2θ˙1r˙1r2θ˙2)=2sinΔ(r˙1r˙2+r1r2θ˙1θ˙2)2cosΔ(r1r˙2θ˙1r˙1r2θ˙2)Δv212r˙1=2r˙2cosΔ2r2θ˙2sinΔΔv212r˙2=2r˙2+2r˙1cosΔ+2r1θ˙1sinΔΔv212θ˙1=2r1r2θ˙2cosΔ+2r1r˙2sinΔΔv212θ˙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Δv212r˙1=2r¨2cosΔ2r˙2Δ˙sinΔ2r˙2θ˙2sinΔ2r2θ¨2sinΔ2r2θ˙2Δ˙cosΔ=2cosΔ(r¨2r2θ˙2Δ˙)2sinΔ(r˙2Δ˙+r˙2θ˙2+r2θ¨2)=2cosΔ(r¨2r2θ˙2Δ˙)2sinΔ(r˙2(2θ˙2θ˙1)+r2θ¨2)=2cosΔ(r¨2r2θ˙2Δ˙)2sinΔ(r˙2Δ˙2+r2θ¨2)ddtΔv212r˙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θ˙1r˙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Δv212θ˙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¨2r1r2θ˙2Δ˙)=2cosΔ(r˙1r2θ˙2+r1r˙2Δ˙2+r1r2θ¨2)+2sinΔ(r˙1r˙2+r1r¨2r1r2θ˙2Δ˙)ddtΔv212θ˙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

δΔv212δr1=ddtΔv212r˙1Δv212r1=2cosΔ(r¨2r2θ˙2Δ˙)2sinΔ(r˙2Δ˙2+r2θ¨2)(2r2θ˙1θ˙2cosΔ+2r˙2θ˙1sinΔ)=2cosΔ(r¨2r2θ˙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.

δΔv212δr1=2cosΔ(r¨2r2θ˙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

δΔv212δr2=ddtΔv212r˙2Δv212r2=2r¨2+2cosΔ(r¨1+r1θ˙1Δ˙)+2sinΔ(r1θ¨1+r˙1Δ˙1)[2r2θ˙22+2r1θ˙1θ˙2cosΔ2r˙1θ˙2sinΔ]=2r¨22r2θ˙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.

δΔv212δr2=2r¨22r2θ˙22+2cosΔ(r¨1r1θ˙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

δΔv212δθ1=ddtΔv212θ˙1Δv212θ1=2cosΔ(r˙1r2θ˙2+r1r˙2Δ˙2+r1r2θ¨2)+2sinΔ(r˙1r˙2+r1r¨2r1r2θ˙2Δ˙)[2sinΔ(r˙1r˙2+r1r2θ˙1θ˙2)2cosΔ(r1r˙2θ˙1r˙1r2θ˙2)]=2cosΔ(r˙1r2(θ˙2θ˙2)+r1r˙2(Δ˙2+θ˙1)+r1r2θ¨2)+2sinΔ(r˙1r˙2r˙1r˙2+r1r¨2r1r2θ˙2(Δ˙+θ˙1))=2cosΔ(2r1r˙2θ˙2+r1r2θ¨2)+2sinΔ(r1r¨2r1r2θ˙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

δΔv212δθ2=ddtΔv212θ˙2Δv212θ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θ˙1r˙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˙2r˙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θ˙12r¨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=fqi\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)[δv12δr12gsinθ1δr1δr1]+m2[δΔv212δr12]k12δ(r1l1)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(r2l2)22-\dfrac{k_2(r_2-l_2)^2}{2} as they are independent of r1r_1.

δLδr1=(m1+m2)[2r¨12r1θ˙122+gsinθ1]+m2[2cosΔ(r¨2r2θ˙22)2sinΔ(2r˙2θ˙2+r2θ¨2)2]+k1(r1l1)=(m1+m2)[r¨1r1θ˙12+gsinθ1]+m2[cosΔ(r¨2r2θ˙22)sinΔ(2r˙2θ˙2+r2θ¨2)]+k1(r1l1).\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+c1v1)v1r1r1(b2+c2v2)v2r2r1=(b1+c1v1)[r˙1cosθ1r1θ˙1sinθ1r˙1sinθ1+r1θ˙1cosθ1][cosθ1sinθ1](b2+c2v2)[r˙1cosθ1r1θ˙1sinθ1+r˙2cosθ2r2θ˙2sinθ2r˙1sinθ1+r1θ˙1cosθ1+r˙2sinθ2+r2θ˙2cosθ2][cosθ1sinθ1]=(b1+c1v1)[r˙1cos2θ1r1θ˙1sinθ1cosθ1+r˙1sin2θ1+r1θ˙1cosθ1sinθ1](b2+c2v2)[r˙1cos2θ1r1θ˙1sinθ1cosθ1+r˙2cosθ1cosθ2r2θ˙2cosθ1sinθ2+r˙1sin2θ1+r1θ˙1cosθ1sinθ1+r˙2sinθ1sinθ2+r2θ˙2sinθ1cosθ2]=(b1+c1v1)[r˙1(cos2θ1+sin2θ1)+r1θ˙1(sinθ1cosθ1+sinθ1cosθ1)](b2+c2v2)[r˙1(cos2θ1+sin2θ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+c1v1)r˙1(b2+c2v2)[r˙1+r˙2cos(θ2θ1)r2θ˙2sin(θ2θ1)].=(b1+c1v1)r˙1(b2+c2v2)[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¨1r1θ˙12+gsinθ1]+m2[cosΔ(r¨2r2θ˙22)sinΔ(2r˙2θ˙2+r2θ¨2)]+k1(r1l1)=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¨1r1θ˙12+gsinθ1+m2m1+m2[cosΔ(r¨2r2θ˙22)sinΔ(2r˙2θ˙2+r2θ¨2)]+k1m1+m2(r1l1)=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θ¨1m2r2sinΔm1+m2θ¨2r1θ˙12+gsinθ1m2m1+m2[r2θ˙22cosΔ+2r˙2θ˙2sinΔ]+k1m1+m2(r1l1)=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θ¨1m2r2sinΔm1+m2θ¨2=r1θ˙12gsinθ1+m2m1+m2[r2θ˙22cosΔ+2r˙2θ˙2sinΔ]+Qr1k1(r1l1)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)[δv12δr22]+m2[δΔv212δr22gsinθ2δr2δr2]k22δ(r2l2)2δr2=(m1+m2)[02]+m2[2r¨22r2θ˙22+2cosΔ(r¨1r1θ˙12)+2sinΔ(r1θ¨1+2r˙1θ˙1)2+gsinθ2]+k2(r2l2)=m2[r¨2r2θ˙22+cosΔ(r¨1r1θ˙12)+sinΔ(r1θ¨1+2r˙1θ˙1)+gsinθ2]+k2(r2l2)Qr2=(b1+c1v1)v1r1r2(b2+c2v2)v2r2r2=(b1+c1v1)[r˙1cosθ1r1θ˙1sinθ1r˙1sinθ1+r1θ˙1cosθ1]0(b2+c2v2)[r˙1cosθ1r1θ˙1sinθ1+r˙2cosθ2r2θ˙2sinθ2r˙1sinθ1+r1θ˙1cosθ1+r˙2sinθ2+r2θ˙2cosθ2][cosθ2sinθ2]=(b2+c2v2)[r˙1cosθ1cosθ2r1θ˙1sinθ1cosθ2+r˙2cos2θ2r2θ˙2sinθ2cosθ2+r˙1sinθ1sinθ2+r1θ˙1cosθ1sinθ2+r˙2sin2θ2+r2θ˙2cosθ2sinθ2]=(b2+c2v2)[r˙1(cosθ1cosθ2+sinθ1sinθ2)+r1θ˙1(sinθ1cosθ2+cosθ1sinθ2)+r˙2(cos2θ2+sin2θ2)+r2θ˙2(sinθ2cosθ2+cosθ2sinθ2)]=(b2+c2v2)[r˙1cos(θ2θ1)+r1θ˙1sin(θ2θ1)+r˙2]=(b2+c2v2)[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¨2r2θ˙22+cosΔ(r¨1r1θ˙12)+sinΔ(r1θ¨1+2r˙1θ˙1)+gsinθ2]+k2(r2l2)=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¨2r2θ˙22+cosΔ(r¨1r1θ˙12)+sinΔ(r1θ¨1+2r˙1θ˙1)+gsinθ2+k2(r2l2)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θ˙22gsinθ2+r1θ˙12cosΔ2r˙1θ˙1sinΔ+Qr2k2(r2l2)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)[δv12δθ12gr1δsinθ1δθ1]+m2[δΔv212δθ12]=(m1+m2)[2r12θ¨1+4r1r˙1θ˙12+gr1cosθ1]+m2[2cosΔ(2r1r˙2θ˙2+r1r2θ¨2)+2sinΔ(r1r¨2r1r2θ˙22)2]=(m1+m2)[r12θ¨1+2r1r˙1θ˙1+gr1cosθ1]+m2[cosΔ(2r1r˙2θ˙2+r1r2θ¨2)+sinΔ(r1r¨2r1r2θ˙22)]Qθ1=(b1+c1v1)v1r1θ1(b2+c2v2)v2r2θ1=(b1+c1v1)[r˙1cosθ1r1θ˙1sinθ1r˙1sinθ1+r1θ˙1cosθ1]r1[sinθ1cosθ1](b2+c2v2)[r˙1cosθ1r1θ˙1sinθ1+r˙2cosθ2r2θ˙2sinθ2r˙1sinθ1+r1θ˙1cosθ1+r˙2sinθ2+r2θ˙2cosθ2]r1[sinθ1cosθ1]=(b1+c1v1)[r1r˙1cosθ1sinθ1+r12θ˙1sin2θ1+r1r˙1sinθ1cosθ1+r12θ˙1cos2θ1](b2+c2v2)[r1r˙1cosθ1sinθ1+r12θ1˙sin2θ1r1r˙2sinθ1cosθ2+r1r2θ˙2sinθ1sinθ2+r1r˙1cosθ1sinθ1+r12θ˙1cos2θ1+r1r˙2cosθ1sinθ2+r1r2θ˙2cosθ1cosθ2]=(b1+c1v1)[r1r˙1(cosθ1sinθ1+sinθ1cosθ1)+r12θ˙1(sin2θ1+cos2θ1)](b2+c2v2)[r1r˙1(cosθ1sinθ1+cosθ1sinθ1)+r12θ1˙(sin2θ1+cos2θ1)+r1r˙2(sinθ1cosθ2+cosθ1sinθ2)+r1r2θ˙2(sinθ1sinθ2+cosθ1cosθ2)]=(b1+c1v1)r12θ˙1(b2+c2v2)[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¨2r1r2θ˙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¨2r2θ˙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θ˙1r1gcosθ1r1m2(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)[δv12δθ22]+m2[δΔv212δθ22gr2δsinθ2δθ2]=(m1+m2)[02]+m2[4r2r˙2θ˙2+2r22θ¨2+2cosΔ(2r˙1r2θ˙1+r1r2θ¨1)+2sinΔ(r1r2θ˙12r¨1r2)2+gr2cosθ2]=m2[2r2r˙2θ˙2+r22θ¨2+cosΔ(2r˙1r2θ˙1+r1r2θ¨1)+sinΔ(r1r2θ˙12r¨1r2)+gr2cosθ2]Qθ2=(b1+c1v1)v1r1θ2(b2+c2v2)v2r2θ2=(b2+c2v2)[r˙1cosθ1r1θ˙1sinθ1+r˙2cosθ2r2θ˙2sinθ2r˙1sinθ1+r1θ˙1cosθ1+r˙2sinθ2+r2θ˙2cosθ2]r2[sinθ2cosθ2]=(b2+c2v2)[r˙1r2cosθ1sinθ2+r1r2θ˙1sinθ1sinθ2r2r˙2cosθ2sinθ2+r22θ˙2sin2θ2+r˙1r2sinθ1cosθ2+r1r2θ˙1cosθ1cosθ2+r2r˙2sinθ2cosθ2+r22θ˙2cos2θ2]=(b2+c2v2)[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(sin2θ2+cos2θ2)]=(b2+c2v2)[r22θ˙2r˙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θ˙12r¨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θ˙12r¨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θ˙2r2gcosθ2r22r˙1θ˙1cosΔr2r1θ˙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¨=A1b\mathbf{\ddot{q}}=\mathbf{A}^{-1} \mathbf{b}. Or, in full form, this above equation is

[1m2cosΔm1+m20m2r2sinΔm1+m2cosΔ1r1sinΔ00m2sinΔ(m1+m2)r11m2r2cosΔ(m1+m2)r1sinΔr20r1cosΔr21][r¨1r¨2θ¨1θ¨2]=[r1θ˙12gsinθ1+m2m1+m2(r2θ˙22cosΔ+2r˙2θ˙2sinΔ)+Qr1k1(r1l1)m1+m2r2θ˙22gsinθ2+r1θ˙12cosΔ2r˙1θ˙1sinΔ+Qr2k2(r2l2)m22r˙1θ˙1r1gcosθ1r1m2(m1+m2)r1[2r˙2θ˙2cosΔr2θ˙22sinΔ]+Qθ1(m1+m2)r122r˙2θ˙2r2gcosθ2r22r˙1θ˙1cosΔr2r1θ˙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+m20m2r2sinΔm1+m2cosΔ1r1sinΔ00m2sinΔ(m1+m2)r11m2r2cosΔ(m1+m2)r1sinΔr20r1cosΔr21]1[r1θ˙12gsinθ1+m2m1+m2(r2θ˙22cosΔ+2r˙2θ˙2sinΔ)+Qr1k1(r1l1)m1+m2r2θ˙22gsinθ2+r1θ˙12cosΔ2r˙1θ˙1sinΔ+Qr2k2(r2l2)m22r˙1θ˙1r1gcosθ1r1m2(m1+m2)r1[2r˙2θ˙2cosΔr2θ˙22sinΔ]+Qθ1(m1+m2)r122r˙2θ˙2r2gcosθ2r22r˙1θ˙1cosΔr2r1θ˙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.