I was given the following integral to solve: $$\displaystyle \int 3^x\cos^3x dx$$
Writing $\cos^3x = \dfrac{\cos 3x + 3\cos x}{4}$ and $3^x = e^{x \ln 3}$, and using the standard result $\displaystyle \int e^{ax}\cos bxdx = \dfrac{e^{ax}(a\cos bx + b\sin bx)}{a^2 + b^2} + C$, I got,
$$\displaystyle \int 3^x\cos^3x dx = \dfrac{3^x}{4}\left[\dfrac{(\ln 3)\cos 3x + 3\sin 3x}{\sqrt{9 + (\ln 3)^2}} + \dfrac{(\ln 3)\cos x + \sin x}{\sqrt{1 + (\ln 3)^2}}\right] + C$$
My first thought upon seeing the integral was to generalise it as $I(a) = \displaystyle \int a^x (\cos x)^a dx$. But I realized that this does not lead to any easy solution and hence did it in the way mentioned. But can this antiderivative be evaluated in terms of elementary functions? And how could it be done?
Wolfram Alpha evaluates the integral as $$\int a^x\cos^a(x)dx=$$
$$\left(\frac{1}{\ln(a)-ia}\right)(1+e^{2ix})a^x\cos^a(x) \operatorname{F}_{2,1}\left(1, \frac{1}{2}(a-i\ln(a)+2);\frac{1}{2}(-a-i\ln(a)+2);-e^{2ix}\right)+C$$
Where $\operatorname{F}_{2,1}(a,b;c;x)$ is the Hypergeometric Series. It seems that we can arrive at this answer by using the binomial theorem to expand $\cos^a(x)$ into a series of complex exponentials and then integrate term by term. The answer is a little messy but to my knowledge this is the only answer for $a\in\Bbb{R}$, unless there are some Hypergeometric identities that can reduce the $\operatorname{F}_{2,1}$ term to something nicer.