0
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ 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}]. $\endgroup$ – b.gates.you.know.what Mar 12 '13 at 20:36
2
$\begingroup$

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}]]
|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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