Solution (source code)

= Solution

The derivatives needed in the <Euler-Lagrange equation> are
$$
\frac{\partial L}{\partial\dot\theta}
=ml^2\dot\theta+ml(\dot a_x\cos\theta+\dot a_y\sin\theta),
$$
$$
\frac{\partial L}{\partial\theta}
=ml\dot\theta(-\dot a_x\sin\theta+\dot a_y\cos\theta)-mgl\sin\theta.
$$
The terms proportional to $\dot a_i\dot\theta$ cancel after differentiation, leaving
$$
\boxed{l\ddot\theta+\ddot a_x\cos\theta+(g+\ddot a_y)\sin\theta=0.}
$$
With $\mathbf l=l(\sin\theta,-\cos\theta,0)$ and $\mathbf g=-g\hat{\mathbf y}$,
$$
[\mathbf l\times(\mathbf g-\ddot{\mathbf a})]_z
=-l\left[\ddot a_x\cos\theta+(g+\ddot a_y)\sin\theta\right]
=l^2\ddot\theta.
$$
Hence the vector equation is \b[$l^2\ddot\theta\hat{\mathbf z}=\mathbf l\times(\mathbf g-\ddot{\mathbf a})$]. In the translating support frame, $-m\ddot{\mathbf a}$ is the <inertial force>. The rod's <tension> passes through the hinge and contributes no <torque> about it. The same <torque> equation therefore has an immediate mechanical interpretation.