15
$\begingroup$

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?

$\endgroup$
3
  • $\begingroup$ 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). $\endgroup$ Oct 28, 2014 at 19:23
  • 5
    $\begingroup$ It's now item n+1 on my list of things to look into. Alas, n is, like Buzz Lightyear, somewhere beyond infinity. $\endgroup$ Oct 28, 2014 at 22:26
  • 1
    $\begingroup$ 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... $\endgroup$
    – Silvia
    Nov 1, 2014 at 10:18

1 Answer 1

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

enter image description here

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}]

enter image description here

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

enter image description here

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

$\endgroup$
2
  • 1
    $\begingroup$ 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. $\endgroup$ Oct 28, 2014 at 19:35
  • $\begingroup$ good call, see edit.. $\endgroup$
    – george2079
    Oct 28, 2014 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.