I use NC algebra to apply simplification rules on non commutative polynomials. I would like to treat a huge number of polynomials, ~200, so I would like to run these computations in parallel.

However, although Table works perfectly well, ParallelTable yields an error : $RecursionLimit::reclim : Recursion depth of 1024 exceeded. error

A minimum example would be:

<< NC`
<< NCAlgebra`;
Reduc[pol_, rul_] := 
  Module[{poln = NCReplaceRepeated[NCExpand[pol], rul]}, 
   If[SameQ[pol, poln], pol, Reduc[poln, rul]]];
xvars = {x1, x2};
yvars = {y1, y2};
evars = {e1, e2};
fvars = {f1, f2};

vars = {x1, x2, y1, y2};
gpvars = {e1, e2, f1, f2};
SetNonCommutative @@ vars
SetNonCommutative @@ gpvars
sub = { x1 -> (1 + e1)/2, y2 -> (1 + f2)/2};
ListTest = {x1, y2};
Table[Reduc[ListTest[[ii]], sub], {ii, 1, 2}]
ParallelTable[Reduc[ListTest[[ii]], sub], {ii, 1, 2}]

I can't understand why ; the variables x1 and y2 seem to me to be independant.Any help would be helpful.


1 Answer 1


If I had to guess why it is not working it is because Mathematica is being smart about your comparison and fails to stop the recursion. I would however suggest that you use NCExpandReplaceRepeated instead, which I suppose does exactly what you want and does not break ParallelTable. You command becomes simply:

ParallelTable[NCExpandReplaceRepeated[ListTest[[ii]], sub], {ii, 1, 2}]

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.