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

1 Answer 1

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

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.