Skip to main content
2 of 2
added 1 character in body
Hector
  • 6.5k
  • 16
  • 35

First, let us generate a large sum with terms similar to your mini-example.

hugeExpr[n_] := 
  Plus @@ Array[
    RandomInteger[{-10, 10}] x^
       RandomInteger[{-3, 1000}] Sqrt[x + RandomInteger[{-10, 10}]]^
       RandomInteger[{-1, 1}] &, n];

expression = hugeExpr[300000];

The actual number of addends (Length[expression]) might not be 300K, but it will still be a large count. Now, the answer to your problem.

ParallelMap[Series[#, {x, 0, 2}] &, expression, Method -> "ItemsPerEvaluation" -> 15]

I tried it on a expression with over 40K terms and it took less than 2 seconds. If your expression is orders of magnitude larger than that, I would suggest you split it in chunks of say 100K addends, use ParallelMap on each chunk separately, save those results to individual files, and add them up later.

Hector
  • 6.5k
  • 16
  • 35