Related to one of my earlier questions, I have an integral that I've found after a few substitutions reduces to
$$\int f(x)g(x)dx$$
where $f(x)$ and $g(x)$ both have the form
$$\sum_{i=1}^nk_i\cos^{a_i}x,k_i\in\mathbb{R},a_i\in\mathbb{Z}$$
Therefore, the product should be in the same form, although there are potentially a lot of terms. I was hoping to write a program to perform the multiplication and, hopefully, evaluate the definite integral with the appropriate bounds. Towards this end, I was hoping I could come up with a closed form for the integral
$$\int\cos^axdx$$ I've found recursive formulas in a couple places and I've tried Wolfram, but, well...
I attempted to divide the problem into even and odd cases. For the odd case,
$$\int\cos^{2m+1}xdx=\int(1-\sin^2x)^m\cos xdx=\int(1-u^2)^mdu$$
I could use the binomial theorem here for $m>0$, but not sure what I could do for negative $m$.
Even case is similar.
$$\int\cos^{2m}xdx=\sec^{-2m}xdx=\int(1+\tan^2x)^{-m-1}\sec^2xdx=\int(1+u^2)^{-m-1}du$$
Here, negative $m$ is easier to work with than positive. Any advice? Are the recursive formulas really the way to go?