# Real integral evaluating as indeterminate

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}$.

-
What happens if you append // FullSimplify to the integral within Assuming[]? –  Ｊ. Ｍ. Jun 10 '13 at 16:38
Interesting. Adding FullSimplify[] within Assuming[] yields ComplexInfinity. But how could that be? For example, replacing p by 3 inside the integral gives a real result: Integrate[Sin[x]*Cos[x]^3/(Cos[x] + 2), {x, 0, Pi}] = 26/3 - 8 Log[3]. –  Doubt Jun 10 '13 at 16:43
Anyway... if I input only the integral, and I extract the expression inside the resulting 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 integer p. –  Ｊ. Ｍ. Jun 10 '13 at 16:45
Great 0x4A4D, this works, but where did I go wrong in In[1]? –  Doubt Jun 10 '13 at 16:52
I really don't know. Sometimes, the software just does the darndest things... –  Ｊ. Ｍ. Jun 10 '13 at 17:03