Mathematica evaluates the following integral as:
In[1]:= Assuming[p \[Element] Integers && p > 0,
Integrate[Sin[x]*Cos[x]^p/(Cos[x] + 2), {x, 0, Pi}]]
Out[1]= -2^p Beta[2/3, -p, 1 + p] + ((-1)^ p Hypergeometric2F1[1, 1, 1 - p, 2])/p
However, when I evaluate the resulting expression, I encounter a complex infinity. For example, for p = 3
:
In[2]:= -2^3 Beta[2/3, -3, 1 + 3] + ((-1)^3 Hypergeometric2F1[1, 1, 1 - 3, 2])/3
During evaluation of In[96]:= Infinity::indet: Indeterminate expression ComplexInfinity+ComplexInfinity encountered. >>
Out[2]= Indeterminate
Did I make a simple mistake in In[1]
that is causing this problem? Certainly $\sin x\cos^p x/(\cos x + 2)$ is real and finite over the whole real line, for $p\in\mathbb{N}$.
// FullSimplify
to the integral withinAssuming[]
? $\endgroup$FullSimplify[]
withinAssuming[]
yieldsComplexInfinity
. But how could that be? For example, replacingp
by3
inside the integral gives a real result:Integrate[Sin[x]*Cos[x]^3/(Cos[x] + 2), {x, 0, Pi}] = 26/3 - 8 Log[3]
. $\endgroup$ConditionalExpression[]
, I get(Hypergeometric2F1[1, 1 + p, 2 + p, -1/2] + (-1)^p Hypergeometric2F1[1, 1 + p, 2 + p, 1/2])/(2 (1 + p))
, which certainly is sensible for positive integerp
. $\endgroup$In[1]
? $\endgroup$