2
$\begingroup$

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.

Can anyone help me please?

a simple example could be:

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

$\endgroup$
  • $\begingroup$ Perhaps Limit[expr,x->0] could help? What means f1/(x)-f1/(x)`? $\endgroup$ – Ulrich Neumann Jul 14 '18 at 9:55
  • $\begingroup$ It is also very difficult for MM @UlrichNeumann $\endgroup$ – Holger Mate Jul 14 '18 at 9:58
  • $\begingroup$ I have edited f1... @UlrichNeumann $\endgroup$ – Holger Mate Jul 14 '18 at 9:58
  • $\begingroup$ 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? $\endgroup$ – Ulrich Neumann Jul 14 '18 at 10:04
  • $\begingroup$ Yes. It is why I can not put x=0 and find what I am seeking for. @UlrichNeumann $\endgroup$ – Holger Mate Jul 14 '18 at 10:05
3
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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; $\endgroup$ – Holger Mate Jul 15 '18 at 14:18
  • $\begingroup$ exp1 is here: pastebin.com/RjJtAALb $\endgroup$ – Holger Mate Jul 15 '18 at 14:18
  • $\begingroup$ Is it possible to use the same method of parallel computing for SeriesCoefficient? $\endgroup$ – Holger Mate Jul 16 '18 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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