Classical Mechanics – Troubles with Signs Using d’Alembert’s Principle

classical-mechanicsconstrained-dynamicsconventionscoordinate systems

I am trying to find the equation of motion for the system below using d'Alembert's and virtual work principles, however I must be making a mistake since my equation doesn't match the solution that I have found online.

System

Assumptions: No friction, $m_1 = m_2 = m$, $l$ is the length of the rigid bar which connects Block 1 with Block 2, $\vec{g}$ goes down.

In order to apply d'Alembert's and virtual work principles, I can define the virtual displacements differentiating the following equations:
\begin{align*}
x &= l \cos \theta \\
y &= l \sin\theta
\end{align*}

Thus, the virtual displacements are:

\begin{align*}
\delta x &= – l \sin \theta \delta \theta \\
\delta y &= l \cos \theta \delta \theta
\end{align*}

Assuming that Block 1 goes down and Block 2 goes right, the equation for the virtual work can be written as:
$$
\delta W = m\vec{g} \cdot \delta\vec{y} – m\vec{\ddot{y}} \cdot \delta\vec{y} – m\vec{\ddot{x}} \cdot \delta\vec{x} = mg \delta y – m\ddot{y}\delta y – m\ddot{x}\delta x= 0
$$

The last equation becomes:
$$
m g l \cos \theta \delta \theta -m(- l \sin\theta \dot{\theta}^2 + l \cos\theta \ddot{\theta}) l \cos \theta \delta \theta – m(-l\cos\theta\dot{\theta}^2-l\sin\theta\ddot{\theta})(-l\sin\theta\delta\theta) = 0
$$

Simplifying, the equation of motion that I get is:
$$
-g \cos \theta + l \ddot{\theta} = 0
$$

while the solution that I should get is:
$$
g \cos\theta + l\ddot{\theta} = 0
$$

I can't understand why my signs in the equation for the virtual work (I guess) are wrong, I must have made a stupid mistake but I'm having an hard time trying to figure it out.

Best Answer

If the y-axis grows upwards, as would be natural from the picture, all the equations are the same, except for the sign of the force, that is now $-mg$.

If y grows downwards, and $y=0$ where the axis crosses, then $y = -lsin(\theta)$. If $y=0$ is the initial position of the mass, then $y = h - lsin(\theta)$ where $h = lsin(\theta_0)$