I'm trying to solve the Kepler problem using the Lagrangian,
$$L = \frac{1}{2} m (\dot{r}^2 + r^2 \dot{\phi}^2) - U(r) $$
which after quite a bit of fiddling with, by noting that the angular momentum $M = mr^2 \dot{\phi}$ is a constant of motion and also $M = 2m\dot{f}$ where $\dot{f}$ s the sectorial velocity, leads to
$$\phi = \int{\frac{M dr/r^2}{\sqrt{2m(E - U(r)) - M^2 / r^2}}}{}$$
Now for the Kepler problem $U(r) \propto 1 / r$ and so $U(r) = \alpha / r$. Plugging that in, we get,
$$\phi = \int{\frac{M}{r^2\sqrt{2m(E + \alpha / r) - M^2 /r^2}}}{dr}$$
However, plugging that integration into WolphramAlpha gives an imaginary solution.
What am I doing wrong?