Solution (source code)

= Solution

With $x=\ell\sin\theta$ and $y=-at^2/2-\ell\cos\theta$, discard a total <derivative> from the <kinetic energy> to obtain
$$
L=\tfrac12m\ell^2\dot\theta^2+ m\ell(g-a)\cos\theta.
$$
\b[Thus $\ddot\theta+(g-a)\sin\theta/\ell=0$. If $a=g$, then $\ddot\theta=0$: the pendulum is weightless in the lift and rotates uniformly (or remains fixed).]