1
$\begingroup$

Can someone explain why these outputs differ?

In[5]:= g1 = 
   Integrate[Exp[-I x (n + 1)]/( Exp[I x] + 2), {x, 0, 2 Pi}, 
   Assumptions -> Element[n, Integers]];

In[6]:= g1 /. n -> 3

During evaluation of In[6]:= Infinity::indet: Indeterminate expression 0 ComplexInfinity encountered.

Out[6]= Indeterminate

In[7]:= g2 = Integrate[Exp[-I x (3 + 1)]/( Exp[I x] + 2), {x, 0, 2 Pi}]

Out[7]= π/16

The last is correct, the first seems to apply some incorrect assumptions? Note

In[8]:= g1

Out[8]= 2^(-1 - n) Beta[-(1/2), -1 - n, 0] Sin[n π]

See Background for context.

$\endgroup$
2
  • 1
    $\begingroup$ General result is valid: {Block[{$MaxExtraPrecision = 300, eps = 10^-300}, N[Limit[2^(-1 - n) Beta[-(1/2), -1 - n, 0] Sin[n \[Pi]], n -> 3 + eps], 100]] // Chop, N[Pi/16, 100]} $\endgroup$ Jul 14, 2018 at 14:37
  • $\begingroup$ Thanks you @MariuszIwaniuk, that answers it for me. $\endgroup$
    – Sooner
    Jul 18, 2018 at 10:33

1 Answer 1

4
$\begingroup$

Here is a workaround

g1[n_?IntegerQ] := Integrate[Exp[-I x (n + 1)]/(Exp[I x] + 2), {x, 0, 2 Pi} ];    
{g1[1], g1[2], g1[3] }
{π/4, -(π/8), π/16}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.