Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

share|improve this question
    
What happens if you append // FullSimplify to the integral within Assuming[]? –  J. M. 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
1  
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. –  J. M. 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
1  
I really don't know. Sometimes, the software just does the darndest things... –  J. M. Jun 10 '13 at 17:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.