# Integrate gives wrong result for simple function

Bug introduced in 5.0 or earlier and fixed in 11.3

It looks like this.

NIntegrate[1/(2 + Sin[x + y]), {x, 0, 2 Pi}, {y, 0, 2 Pi}]
22.7929
Integrate[1/(2 + Sin[x + y]), {x, 0, 2 Pi}, {y, 0, 2 Pi}]
0


Zero result is wrong since the denominator is nonsingular and always positive. Why is this or just a bug?

I noticed this more than three years ago (Version 9) and found it persisting till Version 11.2.

• The reason for the exception is not a pole (which is absent in the region of integration) but a discontinuity in the indefinite integral. A simplified case is $\int \frac{1}{\sin (x)+2} \, dx = \frac{2}{\sqrt{3}} \tan ^{-1}\left(\frac{2 \tan \left(\frac{x}{2}\right)+1}{\sqrt{3}}\right)$. Dealing correctly with discontinuous antiderivatives has been widely discussed in this forum. Nov 21, 2017 at 19:49

Using

Integrate[1/(2 + Sin[x + y]), {x, 0, 2 Pi}, {y, 0, 2 Pi}, PrincipalValue -> True] N[%] From help Mathematica sees a simple pole in the integrand. That is why it says

 Integrate[1/(2+Sin[x+y]),{x,0,2 Pi}] I actually do not see the pole myself. Since $\sin()$ can only be between $-1\dots1$, so integrand denominator can't be zero. But Mathematica says there is a pole there! Needs more investigation to find why Mathematica wants $y$ to be only between $-\pi\dots\pi$.

Update

I had to go back to version 2.2 to get Mathematica to give the same result as Integrate without using any options. (I could not test this on version 5 and 6 at this time)

Here is screen shot from version 2.2 on windows XP • Shifting either or both intervals to {-Pi, Pi} works. Integrate[1/(2 + Sin[x + y]), {x, 0, 2 Pi}, {y, -Pi, Pi}], Integrate[1/(2 + Sin[x + y]), {x, -Pi, Pi}, {y, 0, 2 Pi}], and Integrate[1/(2 + Sin[x + y]), {x, -Pi, Pi}, {y, -Pi, Pi}] each evaluates to (4*Pi^2)/Sqrt. Nov 20, 2017 at 18:25
• Nasser, Bob, please see my comment to the OP. Nov 21, 2017 at 19:54

On new Mathematica 11.3:

Integrate[1/(2 + Sin[x + y]), {x, 0, 2 Pi}, {y, 0, 2 Pi}]


$$\frac{4 \pi ^2}{\sqrt{3}}$$