Consider the following three lines of Mathematica code and note that input line 1 and 3 are exactly the same (This is the smallest piece of code I found to demonstrate this behaviour).
>> Integrate[Exp[-a^2] Sin[2 p] ((a^2 + b^2) + b*Cos[p] + a*Sin[p]), {p, 0, 2 \[Pi]}]
0
>> $Assumptions = {t > 0};
>> Integrate[Exp[-a^2] Sin[2 p] ((a^2 + b^2) + b*Cos[p] + a*Sin[p]), {p, 0, 2 \[Pi]}]
8/3 Sqrt[a^2+b^2] E^-a^2
Note that the integral should yield 0, like in Mathematica’s first answer. The assumption I enter has apparently nothing to do with the integration. Is this a bug (I use Mathematica 8.0)?
Even stranger, if I split the integral into a sum of 2 or 3 integrals, each of them yields 0. Same thing if I take parts out of the integral which do not depend on p.
For me it looks like a bug but if there is something I’m missing, please let me know.
In Mathematica 7.0.1 the result is 0, while in 8.0.4 we get
Thus it has to be a bug, even worse it is an error. Fortunately, one can easily verify the result without a computer, but in case of a more involved integral it would be a major problem.