I was aware that there are too many errors on any CAS to be listed on the margin of their accompanying documentation. But finding the culprit after hours of debugging, a very simple bug but with a very high impact since other complex calculations are being based on its proper calculation, is a disturbing experience. It turns out that, in Mathematica,
In[1]:= badIntegration = Integrate[1 / (2 + Cos[x]), {x, 0, y}, Assumptions -> y > Pi]
Out[1]:= 2(Pi+ ArcTan[Tan[y/2]/ Sqrt(3))/Sqrt(3)
is symbolically evaluated as a discontinuous function, even if it must clearly be continuous, since the integrand is everywhere continuous, finite and positive. But the Weierstrass substitution method used internally when symbolically calculating integrals of inverse trigonometric functions sometimes produces discontinuities. Go figure.
Lesson learned: as a safety measure, always use multiple CAS programs (SAGE, Maple, …) to compare solutions when getting strange results.