Consider the integral $$I(a)=\int_{0}^{\pi/2} \cos^a (x)\sin(ax) dx$$ where $a\geq 0$
I am trying to evaluate the above integral using Mathematica using the following code :
int[a_] = Assuming[a >= 0,
Integrate[Cos[x]^a*Sin[a*x], {x, 0, Pi/2}] // FullSimplify]
The answer we get is -2^(-1 - a) (E^(I a π) Beta[-1, -a, 1 + a] + π Cot[a π])
Problem is that the definite integral was real for $a\geq 0$ but the answer contains imaginary number $i=\sqrt{-1}$. How do we get a real answer?
Any help would be appreciated.







{}button above the edit window. The edit window help button?is useful for learning how to format your questions and answers. You may also find the meta Q&A, How to copy code from Mathematica so it looks good on this site, helpful – Michael E2 Mar 12 '23 at 21:01