# Lagrangian: singularity in inverted pendulum EoMs?

Hi all, I'm doing some analysis of a bicycle mechanics problem and at one point the approximations I'm making mean that the problem reduces to the classic inverted pendulum. I'm very confused, as the equations I've worked out appear to have an unphysical singularity in them, and I can't see where it's coming from.

So, the problem is this: equations of motion of a point mass $$m$$ on the end of a light rigid rod (length $$l$$), the other end of which is attached to a light, frictionless carriage, constrained to move only in the horizontal direction.

So, the problem has two degrees of freedom: $$x$$ and $$\theta$$.

By my reckoning, the position vector of the pendulum bob, counting angle clockwise from the upwards vertical, is:

$$\mathbf{r}=(x + l \sin\theta, l \cos\theta)$$

This gives a Lagrangian of:

$$L = \frac{m \dot{\mathbf{r}}^2}{2} - m g \cos{\theta} = \frac{m \dot{x}^2}{2} + \frac{m l^2 \dot{\theta}^2}{2} + m \dot{x} \dot{\theta} l \cos{\theta} - m g \cos{\theta}$$

Now, the Euler-Lagrange equations end up as

$$\ddot{x} + \ddot{\theta} l \cos{\theta} - \dot{\theta}^2 l \sin{\theta} = 0$$
$$\ddot{\theta} + \ddot{x} \cos\theta / l - g \sin\theta/l=0$$

which in turn reduce to:

$$\ddot{x} = \frac{\dot{\theta}^2 l - g \cos \theta }{\sin\theta}$$
$$\ddot{\theta} = \frac{g / l - \dot{\theta}^2 \cos\theta}{\sin\theta}$$

Do you spot the problem yet? There's a nasty singularity when $$\theta \to 0$$.

Can anyone tell me what's going wrong here?

To anyone wondering, the "unphysical" singularity arises from the unphysical assumption of a light carriage. With a carriage of nonzero mass $$M$$ the EoMs become:
$$\ddot{x} = \frac{2 m \sin \theta \left(g \cos \theta - l \dot{\theta}^2\right)}{2 M + m (1 - \cos 2 \theta)}$$
$$\ddot{\theta} = \frac{m l \dot{\theta}^2 \cos \theta-g (m+M)}{- m l \sin \theta - M l / \sin\theta}$$
With no singularity as long as $$M \neq 0$$!