I have a equation to solve which contains a Nintegrate Eq[x] with quite amount error, ( eq, NIntegrate obtained 0.0022713447954780078and 0.0002507808156033819 for the integral and error estimates.)

I want to find root of Eq[x]+f[x]==0 but I only need to get some a value that makes Eq[x]+f[x]<0.001 due to the error.

How can I do this in FindRoot?

  • 3
    $\begingroup$ Show us your code with all definitions, constants, etc so we can run it on our own computers. Otherwise we can only give you generic guesses, such as minimizing the function Eq[x] + f[x] using NMiminize instead of trying to find a root with FindRoot. $\endgroup$ – MarcoB Jun 21 '18 at 2:24

Try AccuracyGoal -> 3 with the secant method:

f[x_?NumericQ] := Cos[x] + RandomReal[0.0009]; (* noisy cosine *)
sol = FindRoot[f[x], {x, 1}, AccuracyGoal -> 3, Method -> "Secant"]
f[x] /. sol
  {x -> 1.57058}

Note: Without specifying Method -> "Secant", FindRoot appears to use Newton's method, probably numerically approximating the derivative, which would be a disaster for my function f[x] above.

  • $\begingroup$ Thanks. It looks promising, I will try on my equation. $\endgroup$ – p.s Jun 21 '18 at 3:16

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.