I am performing a numerical simulation of the example in this page, but am having problems because the Hamiltonian (specifically the $\phi$ momentum part of the kinetic energy) is undefined (infinite?) at $\theta = 0$.
$$H = \frac{P_\theta^2} {2 m l^2} + \frac{P_\phi^2} {2 m l^2 \sin^2 \theta} - m g l \cos \theta$$
Have I made a mistake or missed something, or is this a known and accepted feature of certain simple physical systems? Of course, on the same page, it can be seen that the Lagrangian is well behaved there, but I am using a symplectic integrator so I need the Hamiltonian form.
To put it another way; with the pendulum in its motionless free-hanging state, I understand that the Hamiltonian is degenerate. I am surprised there is no mention or discussion of this on the Wikipedia page.