I found an example of FindRoot usage that I couldn't find documented. It looks like:

FindRoot[f[x] == 0.4, {x, 0, 1, 0, 1}]

The documentation shows this case FindRoot[lhs==rhs, {x, xstart, xmin, xmax}] searches for a solution, stopping the search if x ever gets outside the range. But the example I found has an extra argument. What does it mean?


  • 2
    $\begingroup$ I put True in that position and got the error FindRoot::bbound: Search region bound True for variable number 1 is not a number or Infinity. >> so my guess is search region bound. FindRoot[Cos[x] == 0.4, {x, 0, 1, 0, 3}] finds the solution $x \approx 1.59$. Another odd thing FindRoot[Cos[x] == 0.4, {x, 0, 1, 0, 0.5}] FindRoot::streg: The starting point {1.} is not in the search region {{0.},{0.5}}. >> $\endgroup$ – ssch Jan 7 '13 at 15:41
  • 4
    $\begingroup$ I think the 4 values are : 2 starting points and the search region; 2 starting points are used by the "Secant" method for instance. For instance try FindRoot[x^2 - 2 == 0, {x, 1.1, 1.9, 1.2, 2}, Method -> "Secant"] and move around the 1.1 or the 1.9. $\endgroup$ – b.gates.you.know.what Jan 7 '13 at 15:43
  • $\begingroup$ @b.gatessucks that agrees with my last error. $\endgroup$ – ssch Jan 7 '13 at 15:44

As suggested by b.gatessucks, the 4 values are the two starting points used by the "Secant" method for instance and the search region. In fact if you use

FindRoot[f[x], {x, x_a, x_b, -Infinity, Infinity}]

you get always the same result as for

FindRoot[f[x], {x, x_a, x_b}],

whilst if you take

FindRoot[f[x], {x, x_a, x_b, -y, y}]

with x_a or x_b bigger than y in modulus you'll get the error

FindRoot::streg: "The starting point is not in the search region"

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.