How to simulate a Double Pendulum with a Motor? I'm trying to find a specific formula for a variant of the 2D double pendulum experiment, but I'm afraid my physics skills are not up to the task. I'm hoping someone here can help me :). The situation is like in the double pendulum task, but with the following changes:

*

*There is no gravity


*The joint between the two rods (motor joint) cannot rotate freely, but an internal motor controls the angle between them. If the motor isn't moving, the two rods are basically a rigid body.


*I don't know the actual shape of the two rods, but I do know their individual masses, inertia and the location of the center of mass.
It looks something like this: (The rods look like rectangles here, but their actual shape is unknown)

α and β are the angles between the rods and the y-axis (one of them is negative here).
Note that the joint, that fixes the upper joint in the picture to the world, (static joint) can rotate freely.
Now I'm not looking for the general formula to simulate this situation, but I'm interested in the following specific case:

*

*First, both rods are at rest with the motor joint still at angle γ=β-α.

*Then, the motor spins a little bit and stops again. Once it stops, both rods will be at rest too, but the angles will be different: γ'=β'-α'.

The situation might look something like this now:

Note that the motor joint has a different angle, because the motor moved in the meantime. The static joint has a different angle as well, because the motor applies a force to both rods it is attached to. But before and after the motor movement, all velocities are zero.
Now, given α, β, γ' and all the mass information, how can I calculate α' (or β')?
It's fine if the formula assumes that the difference between γ and γ' is very small.
I already tried to figure this out on my own with derivations of the double pendulum formulas on the internet, but I don't know how to deal with the motor joint in those formulas.
I also implemented that situation in a 2D physics engine (box2d) and tried to deduce the formula in that simulation "experimentally", but couldn't figure it out.
 A: You would not be able to find an analytic formula for the angles for this highly dynamic system.

One approach is to freeze the second joint and see where the system will reach equilibrium. This happens when the combined center of mass swings to be directly underneath the pivot.
On the left is the situation you describe with a fixed joint between the two objects (each with mass $m$). Each is of length $L$ and has a center of mass at its center, indicated by the markers. The initial configuration is defined by the swing angle $\alpha$ and the fixed relative angle $\gamma$.

On the right is the equivalent combined object with a combined center of mass at a distance $c$ from the pivot at an angle $\delta$ from vertical.
After the object settles, $\delta = 0$ which means that the new angles $\alpha` = \alpha - \delta$ and $\beta` = \beta - \delta$.
So let us find what the angle $\delta$ is:
Along the x and y axes, the combined center of mass is
$$ \begin{aligned}
\text{horizontal} & &
 (m+m) c \sin \delta & =m \tfrac{L}{2} \sin \alpha + m \left( L \sin \alpha + \tfrac{L}{2} \sin \beta \right) \\ \text{vertical} & &
 (m+m) c \cos \delta & =m \tfrac{L}{2} \cos \alpha + m \left(L \cos \alpha + \tfrac{L}{2} \cos \beta \right) 
\end{aligned} $$
with solution
$$ \begin{aligned}
 \tan \delta & = \frac{3 \sin \alpha + \sin \beta}{3 \cos \alpha + \sin  \beta} \\
 c & = L \sqrt{ \frac{3 \cos (\alpha - \beta)+5}{8} }
\end{aligned} $$

If you want do want to run a simulation, and want the equations of motion of the two pendulums, to be solved for a combination of given torques $\tau_1$, $\tau_2$ or given motions $\ddot{\theta}_1$ and $\ddot{\theta}_2$ then consider the following system.

Each relative angle is $\theta_i$ and each torque is $\tau_i$.
Each body has a free-body-diagram as seen below, with mass $m_i$ and mass moment of inertial $\mathcal{I}_i$. The relevant distances and angles are also shown below:

and the Newton-Euler equations of motion (6 in total) are
$$\small \begin{aligned}\begin{pmatrix}{Fx}_{1}\\
{Fy}_{1}
\end{pmatrix}-\begin{pmatrix}\cos\theta_{2} & -\sin\theta_{2}\\
\sin\theta_{2} & \cos\theta_{2}
\end{pmatrix}\begin{pmatrix}{Fx}_{2}\\
{Fy}_{2}
\end{pmatrix}+\begin{pmatrix}-m_{1}g\sin\theta_{1}\\
-m_{1}g\cos\theta_{1}
\end{pmatrix} & =m_{1}\begin{pmatrix}c_{1}\ddot{\theta}_{1}\\
c_{1}\dot{\theta}_{1}^{2}
\end{pmatrix}\\
\tau_{1}-c_{1}{Fy}_{1}+\left(\ell_{1}-c_{1}\right)\cos\theta_{2}{Fx}_{2}-\left(\ell_{1}-c_{1}\right)\sin\theta_{2}{Fy}_{2} & =\mathcal{I}_{1}\left(\ddot{\theta}_{1}\right)\\
\begin{pmatrix}{Fx}_{2}\\
{Fy}_{2}
\end{pmatrix}+\begin{pmatrix}-m_{2}g\sin\left(\theta_{1}+\theta_{2}\right)\\
-m_{2}g\cos\left(\theta_{1}+\theta_{2}\right)
\end{pmatrix} & =m_{2}\begin{pmatrix}\ell_{1}\cos\theta_{2}\ddot{\theta}_{1}+\ell_{1}\sin\theta_{2}\dot{\theta}_{1}^{2}+c_{2}\left(\ddot{\theta}_{1}+\ddot{\theta}_{2}\right)\\
-\ell_{1}\sin\theta_{2}\ddot{\theta}_{1}+\ell_{1}\cos\theta_{2}\dot{\theta}_{1}^{2}+c_{2}\left(\dot{\theta}_{1}+\dot{\theta}_{2}\right)^{2}
\end{pmatrix}\\
\tau_{2}-c_{2}{Fy}_{2} & =\mathcal{I}_{2}\left(\ddot{\theta}_{1}+\ddot{\theta}_{2}\right)
\end{aligned}$$
The above system is to be solved for 6 unknowns, 4 of which are the 4 pivot forces ${Fx}_1$, ${Fy}_1$, ${Fx}_2$, and ${Fy}_2$, and the other two are joint accelerations or joint torques or a combination of the two for the two bodies.
