Find $\int \frac{{\rm d}x}{1+e\cos x}$ 
Find $$\int \frac{{\rm d}x}{1+e\cos x}$$

*

*When $e$ lies between $0$ and $1$

*When $e$ is greater than $1$


I got $\int \frac{dx}{1+e\cos x}$ when $e$ lies between $0$ and $1$, by substituting $\tan\frac{x}{2} =t$.
$$\int \frac{dx}{1+e\cos x} = \frac{2}{\sqrt{1-e^2}} \tan^{-1}\left( \frac{\sqrt{1-e}}{\sqrt{1+e}}\tan \frac{x}{2} \right) +C,$$
which will not be valid for $e >1.$
What different attempt we can do for $e>1$?

Substituting $t=\tan(\frac{x}{2})$ we obtain for $e\neq1$ (and the case $e=1$ gives $\int \frac{dx}{1+\cos x}=\tan(\frac{x}{2})+c_1$)
$$\int \frac{dx}{1+e\cos x}=\int \frac{2}{1+t^2+e(1-t^2)}dt$$
$$=\int\frac{2}{t^2(1-e)+(1+e)}dt=\int\frac{2}{(1-e)\left(t^2+\frac{1+e}{1-e}\right)}dt=\frac{2}{1-e}\int\frac{1}{t^2+\frac{1+e}{1-e}}dt$$
$\bullet$ Then for $0<e<1$ you can use the $\tan$ substitution to obtain $\arctan$ function (as you did).
$\bullet$ For $e>1$, you can use partial fractions decomposition to obtain logarithms. To make the calculations simpler, you can let $c^2=-\frac{1+e}{1-e}$, then you have $\int\frac{1}{t^2-c^2}dt$
