How to integrate $\int \frac{\cos^m x}{\cos nx} \,\mathrm{d}x$ How to integrate $$\int \frac{\cos^m x}{\cos nx} \,\mathrm{d}x$$

Motivation: $\int \cos mx \sec nx \,\mathrm{d}x $ and $ \int \cos mx\sec^n x\,\mathrm{d}x $ and  $\int \cos^m x \cos nx \,\mathrm{d}x $ and $\int \cos mx \cos nx \,\mathrm{d}x$ are all integrals with closed forms (including summations) I've solved myself or read elsewhere.

Plugging various $m,n$ into wolfram shows the antiderivative always has a combination of trig functions and $\tanh^{-1}$. Nothing I've tried has worked or even simplified it.
HINT

Let $y=\cos(x),$ then
$$\frac{\cos^m x}{\cos nx} = \frac{(\cos x)^m}{T_n(\cos x)} = f(\cos x),$$
where $T_n(y)$ are the Chebyshev's polynomials of the first kind.

If $m\ge n$ it is necessary to single out an integer part of the ratio of polynomials.
Let 
$$g_{n-1}(y) = y^m\bmod T_n(y),\quad h(y) = f(y) - g_{n-1}(y),$$
then 
$$f(y) = r(y) + h(y),$$
where 
$$r(y) = \frac{g_{n-1}(y)}{T_n(y)},$$
$h(y)$ are polynomial of $y$ or zero, and $g_{n-1}(y)$ is polynomial of order $(n-1)$ or less.

Then,
$$T_n(y) = 2^n\prod_{k=1}^n (y-y_{n,k}),$$
where
$$y_{n,k} = \cos\left|\frac{2k-1}{2n}\right|.$$
So
$$r(y) = \frac {g_{n-1}(y)}{2^n \prod_{k=1}^n (y-y_{n,k})} = \sum_\limits{k=1}^n \frac{a_k}{y-y_{n,k}},$$
and
$$a_k = \lim_{y\to y_{n,k}}r(y)(y-y_{n,k}).$$
In this way,
$$\int\frac{\cos^m(x)}{\cos nx}\,dx = \sum_{k=1}^n a_k\int\frac{dx}{\cos x - y_{n,k}} + \int h(\cos x)\,dx,$$
where $h(y)$ is the polynomial, and the integrals under the sum can be calculated using the universal trig substitution.
You may wanna check out Liouville's theorem (Hamiltonian); I guess it can't be integrated.