# Why can't Mathematica parallelize this?

The following code makes mathematica print "ParallelTable::nopar1: [...] cannot be parallelized; proceeding with sequential evaluation."

(*Exit[]*)
Subscript[r, 1] = Abs[x + y I];
Subscript[r, 2] = Abs[x + y I - a];
plots = ParallelTable[
ContourPlot[{Abs[Subscript[r, 1]]/Abs[Subscript[r, 2]] ==
Subscript[c, 1],
Subscript[c, 2] ==
Abs[Subscript[r, 2]] - Abs[Subscript[r, 1]]} /. a -> 5 //
Evaluate, {x, -6, 6}, {y, -6, 6},
FrameTicks -> {Range[-6, 6, 1], Range[-6, 6, 1], None,
None}], {Subscript[c, 1], 0, 2, 0.1}, {Subscript[c, 2], -2, 2,
0.2}];
Animate[plots[[i]][[j]], {i, 1, Length[plots], 1}, {j, 1,
Length[plots[[1]]], 1}]


Why does this happen even when the expression in ParallelTable can be easily evaluated for any values of $c_1$ and $c_2$ ?

Note: "Right Click> convert to StandardForm" will make the subscripts readable.

-
This works r1 = Abs[x + y I]; r2 = Abs[x + y I - a]; plots = ParallelTable[ ContourPlot[{Abs[r1]/Abs[r2] == c1, c2 == Abs[r2] - Abs[r1]} /. a -> 5 // Evaluate, {x, -6, 6}, {y, -6, 6}, FrameTicks -> {Range[-6, 6, 1], Range[-6, 6, 1], None, None}], {c1, 0, 2, 0.1}, {c2, -2, 2, 0.2}]; – chris Nov 16 '12 at 9:13

It seems Mathematica does not like subscript variables for ParallelTable So if you define

r1 = Abs[x + y I];
r2 = Abs[x + y I - a];


then

plots = ParallelTable[
ContourPlot[{Abs[r1]/Abs[r2] == c1, c2 == Abs[r2] - Abs[r1]} /.
a -> 5 // Evaluate, {x, -6, 6}, {y, -6, 6},
FrameTicks -> {Range[-6, 6, 1], Range[-6, 6, 1], None, None},
ContourStyle ->{{ColorData[10][c1*5]},
Directive[Dashed, ColorData[10][(c2 + 2)*2.5]]}], {c1, 0, 2, 0.1}, {c2, -2, 2,
0.2}];


produces

plots // Flatten // Show


-
Thanks, that seems to work. Is there any real reason why mathematica fails to parallelize when there are subscripts? – Navin Nov 16 '12 at 14:21
@Navin this I don't know. Parallelize is still a fragile beast AFAIK. – chris Nov 16 '12 at 15:12