Primitive of Power of x over Even Power of x minus Even Power of a

Theorem
where $0 < p \le 2 m$.

Proof
The integrand is a rational function.

It has simple poles at $x = \omega_k a$ where $\omega_k = e^{\pi i k /m} $, $k = 0, 1, \ldots, 2 m - 1$ are the $2m:th roots of unity:

Its residue at $x = \omega_k$ is then:
 * $\Res f {\omega_k a} = \dfrac {\paren {\omega_k a}^{p - 2m} } {2 m}$

so that:
 * $\ds \map f x = \sum_{k \mathop = 0}^{2 m - 1} \dfrac {\paren {\omega_k a}^{p - 2m} } {2 m \paren {x - \omega_k a} }$

which has a primitive:
 * $\ds \map F x = \sum_{k \mathop = 0}^{2 m - 1} \dfrac {\paren {\omega_k a}^{p - 2m} } {2 m} \map \ln {x - \omega_k a}$

For positive real $x, a \in \R_{>0}$ we can write:


 * $\map \ln {x - \omega_k a} = \dfrac 1 2 \map \ln {x^2 - 2 a x \map \cos {\dfrac {2 \pi k} m} + a^2} - i \map \arctan {\dfrac {a \map \sin {\dfrac {2 \pi k} m} } {x - a \map \cos {\dfrac {2 \pi k} m} } }$


 * $\paren {\omega_k a}^{p - 2 m} = a^{p - 2 m} \paren {\map \cos {\dfrac {p k \pi} m} + i \map \sin {\dfrac {p k \pi} m} }$

and the formula follows.