# Fast expansion of large expressions

I want to expand a very huge expression. Is there any way to do that without Series? Series works very slow, even when I want to find

Series[expression,{x,0,0}]


I can not put x=0 and find the value of the expression because there are some terms like below in the expression:

...+ f/x-f/x +...

I also can not also use Simplify or Limit, because it is large and MM can not simplify it.

a simple example could be:

a^2/x+ x/b+ c x^2/+ g x^10/Sqrt[x^2+v^2] - a^2/x +...

• Perhaps Limit[expr,x->0] could help? What means f1/(x)-f1/(x)? – Ulrich Neumann Jul 14 '18 at 9:55
• It is also very difficult for MM @UlrichNeumann – Holger Mate Jul 14 '18 at 9:58
• I have edited f1... @UlrichNeumann – Holger Mate Jul 14 '18 at 9:58
• Mathematica evaluates f/x - f/x (* 0*), so you probably mean somthing like a singularity ? Perhaps you can provide a simplified example of your problem? – Ulrich Neumann Jul 14 '18 at 10:04
• Yes. It is why I can not put x=0 and find what I am seeking for. @UlrichNeumann – Holger Mate Jul 14 '18 at 10:05

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.

• Thank you very much for your nice answer. When I try below code, MM still do not return anything: exp1 = f2x (-M11xx + M12xx); exp11 = ParallelMap[Series[#, {al, 0, 2}] &, exp1, Method -> "ItemsPerEvaluation" -> 15] // Normal; – Holger Mate Jul 15 '18 at 14:18
• exp1 is here: pastebin.com/RjJtAALb – Holger Mate Jul 15 '18 at 14:18
• Is it possible to use the same method of parallel computing for SeriesCoefficient? – Holger Mate Jul 16 '18 at 5:45