Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Here I obtained one code which should tests some zeros of the poly for various g, but sometimes I have to many cycles because of step and I need to parallelize the running on all cores. Classical ParallelDo instead the Do doesn't work. What to do further


 LM = {};
 Lroots = x /. NSolve[(poly /. {g -> G}) == 0, x];

 res = 0;
 root = Lroots[[i]];
 If[Im[root] >= 0,
 L1 = Drop[Lroots, {i}];
 res = res + 1/(Times @@ (root - L1));
  , {i, 1, Length[Lroots]}
  M = 1/((4*G^2)*res);
  AppendTo[LM, M];

 , {G, 0.001, 15, 0.01}
share|improve this question
Could you maybe elaborate a bit further on what you try to calculate with the code? Maybe the Do can be avoided or is the parallelization of the Do the main point of the question? Do you perhaps intend to calculate an Integral along the real axis using Jordan's Lemma? (Im[root]>=0 and summing res as in residues makes me think that way) –  Max1 Apr 13 '14 at 21:10
Just to use all cores in computing the M –  Pipe Apr 14 '14 at 17:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.