Here's a way to get the answer by changing the integral by symmetry. Powers of sine and cosine that depend on parameters have always been tricky for Integrate
. Not sure why the trick below works and the original fails.
Integrate[
Cos[phi]^2*Sin[phi]^n + Sin[phi]^2*Cos[phi]^n, {phi, 0, Pi/2},
Assumptions -> n > 0]
(* (Sqrt[π] Gamma[(1 + n)/2])/(2 Gamma[2 + n/2]) *)
Workarounds from my comments:
Both
Integrate[Cos[phi]^2*Sin[phi]^n, {phi, 0, Pi},
GenerateConditions -> False] // FullSimplify[#, n < -4] &
Normal@Integrate[#, {phi, 0, Pi}] & /@
Expand[(1 - Sin[phi]^2) Sin[phi]^n] // FullSimplify
give
(* (Sqrt[π] Gamma[(1 + n)/2])/(2 Gamma[2 + n/2]) *)
but not in a satisfying way.
And
Integrate[Cos[phi]^2*Sin[phi]^n // TrigToExp, {phi, 0, Pi}, Assumptions -> n > 0]
gives
(* (π^(3/2) Sec[(n π)/2])/(2 Gamma[1/2 - n/2] Gamma[2 + n/2]) *)
which you have to use Limit
to evaluate at odd integers. Or we can expand secant and gamma according to their infinite products to get the first result above:
(π^(3/2) Sec[(n π)/2])/(2 Gamma[1/2 - n/2] Gamma[2 + n/2]) /.
Sec[(n π)/2]/Gamma[1/2 - n/2] -> 1/(Pi ((π - n Pi)/(2 π))*
Product[
(1 - (π - n π)^2 /
(4 k^2 π^2)) ((1 + 1/k)^(1/2 (-1 - n))/(1 + (-1 - n)/(2 k))),
{k, Infinity}]) // FullSimplify
Update:
Integrate
tries a substitution $\phi = \arctan(p/2)$, which fails for reasons I don't understand, since the transformed integral, while improper, converges:
Cos[phi]^2*Sin[phi]^n*Dt[phi, p] /. phi -> ArcTan[p/2] /.
t : _Sin | _Cos :> TrigExpand[t] /. p -> phi // Simplify
Integrate[2 %, {phi, 0, \[Infinity]}, Assumptions -> n > 0]
(*
(8 (phi/Sqrt[4 + phi^2])^n)/(4 + phi^2)^2
(Sqrt[\[Pi]] Gamma[(1 + n)/2])/(2 Gamma[2 + n/2])
*)
My guess is that there's a simple(?) bug that is not particularly interesting, but maybe someone else will have more insight. Integrate
can generate answers to equivalent integrals involving things like Hypergeometric2F1[2, 1/2 + n/2, 3/2, 1]
, which is undefined for n>0
. It evaluates to ComplexInfinity
if n
is given a definite, nonnegative value. I do not know if that is connected to the idiv
divergence error.
Integrate[Cos[phi]^2*Sin[phi]^n // TrigToExp, {phi, 0, Pi}, Assumptions -> n > 0]
$\endgroup$(\[Pi]^(3/2) Sec[(n \[Pi])/2])/(2 Gamma[1/2 - n/2] Gamma[2 + n/2])
is not convenient (say for $n=1$). $\endgroup$Integrate::idiv
message. I didn't do it, so I must have aborted something when it had been internally turned off. Anyway, it misled me, as did no one else contradicting me. After turning it on, I now get the same error as you. $\endgroup$