Primitive of Reciprocal of p by Sine of a x plus q by 1 plus Cosine of a x

Theorem

 * $\displaystyle \int \frac {\mathrm d x} {p \sin a x + q \left({1 + \cos a x}\right)} = \frac 1 {a p} \ln \left\vert{q + p \tan \frac {a x} 2}\right\vert + C$

Proof
Let $z = a x + \arctan \dfrac {-p} q$.

Then:

Let $d = \sqrt {p^2 + q^2}$.

We have that $q^2 < p^2 + q^2$ and so: