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.

I'm trying to evaluate the roots of a complex function at different starting points on a grid using Do[Do[FindRoot[g[z], {z, j + k*I}], {j, 10}], {k, 10}]. However, it gives me the following error messages:

FindRoot::jsing: Encountered a singular Jacobian at the point {z} ={-17.0839+14.7475 I}. Try perturbing the initial point(s). >>
FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>
FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>
FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>
General::stop: Further output of FindRoot::lstol will be suppressed during this calculation. >>
FindRoot::jsing: Encountered a singular Jacobian at the point {z} = {-16.872+27.5137 I}. Try perturbing the initial point(s). >>
FindRoot::jsing: Encountered a singular Jacobian at the point {z} = {-17.5117+54.0621 I}. Try perturbing the initial point(s). >>
General::stop: Further output of FindRoot::jsing will be suppressed during this calculation. >>

After the error messages it stops displaying any output. I know most of the starting points will generate those errors. I'm trying to use the Do loop so I can get past those errors to the valid starting points. Does anyone know how to suppress the errors and keep the loop running? I tried 'Off[General::stop]', but that doesn't seem to work.

share|improve this question
1  
Try Table[FindRoot[g[z], {z, j + k*I}], {j, 10}, {k, 10}]. Do will not produce any output, try Do[Do[1 + 1, {j, 10}], {k, 10}]. –  b.gatessucks Mar 12 '13 at 20:36
add comment

1 Answer

If you simply want to suppress the warnings then you can do:

Off[FindRoot::nlnum]

But it seems that you aren't going to output any answers unless you use something like:

Reap[Do[Do[Sow[FindRoot[g[z], {z, j + k*I}]], {j, 10}], {k, 10}]]
share|improve this answer
add comment

Your Answer

 
discard

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

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