# General integral does not match special case?

Consider the following function:

f = (E^(2 I c \[Phi]) - (E^(2 I \[Phi]))^c) (E^(2 I \[Phi]))^n

Integrating this function with respect to \[Phi] from -\[Pi] to \[Pi] apparently gives:

int1 = Integrate[ f , {\[Phi], -\[Pi], \[Pi]}]

Suppose we would like n to be an integer, so we fully simplify as follows:

Assuming[Element[n, Integers], int1 // FullSimplify]

which, in general, is a non-zero quantity. However, for integer n we should be able to do the integral directly with this assumption in place. This suggests:

int2 = Assuming[Element[n, Integers], Integrate[ f , {\[Phi], -\[Pi], \[Pi]}] ]

0

Now it seems that the integral is actually zero for general integer n! Surely, only one of the two results can be true. Which one is it? And why is Mathematica producing these discrepancies? Is this a bug in Mathematica?

• possible duplicate: Usage of Assuming for Integration and links therein. Oct 9, 2018 at 3:17
• $$int2 = Assuming[Element[n, Integers], Integrate[ f , {\[Phi], -\[Pi], \[Pi]}] ]$$ Mathematica gives a nonzero answer for nonIntegral value of $c$ (Works fine ) otherwise it gives $0$ (a wrong answer). Oct 9, 2018 at 6:17

This gives: $$\frac{\sin (2 \pi (c+n))-2 \sin (\pi (c+n))}{c+n}$$; which can be simplified to your first answer.