# Why do big-O terms disappear in definite integrals since Mathematica 9?

In Mathematica 8, when I computed the following input:

Integrate[Series[Cos[x], {x, 0, 2}], {x, 0, a}]


Mathematica returned an expression that had a O[a^4] in it. (In other words, the result had the head SeriesData.)

Since Mathematica 9, the same input returns the result without the Big-O term, as if it had internally called Normal before or after calculating the integral.

Note that this only happens when I compute definite integrals.

My old code doesn't compute anymore! Is there a way to get back to the Mathematica 8 behaviour?

I assume Wolfram Research had a good reason for this change. Are there any dangers associated with definite integrals of SeriesData objects?

• I will add that it doesn't just tack Normal on there -- at least, not literally in the sense that the new Integrate[] is the old Integrate[Normal[]]. Try integrating a SparseArray object, you get a sparse array back (although it has been integrated appropriately). Oct 28, 2014 at 19:23
• It's now item n+1 on my list of things to look into. Alas, n is, like Buzz Lightyear, somewhere beyond infinity. Oct 28, 2014 at 22:26
• According the Trace log, it seems the correct indefinite integral result (SeriesData[x, 0, {1, 0, -1/6}, 1, 4, 1]) is correctly found during calculation. But for some mysterious reason a - a^3 / 6 suddenly jumps out... Nov 1, 2014 at 10:18

 SeriesData[ a , 0 , #, 0, Length@#, 1] &@CoefficientList[#, a] &@
Integrate[Series[Cos[x], {x, 0, 3}], {x, 0, a}]


second try:

 int = (SeriesData[a, 0, #[[1]], 0, #[[2]] + 1, 1] &@
{CoefficientList[Integrate[ Normal@# , {x, 0, a }] , a], #[[5]] }) &;

int@Series[Cos[x], {x, 0, 3}]


 int@Series[x^4, {x, 0, 3}]


Now after working that out the hard way I wonder why you don't just use the indefinite integral.

• If the (integrated) series has a term a^n, your code just slaps an O[a]^n+1 onto it. This is wrong, for instance when integrating Series[x^4, {x, 0, 3}]: Your code gives O[a]^0 when it should give O[a]^5. Oct 28, 2014 at 19:35
• good call, see edit.. Oct 28, 2014 at 19:49