I am attempting to find roots of a complex equation that involves exponential functions and small approximation values. I have had success using FindRoot for values that are simple and positive, but Mathematica does not like it when the values I enter are negative and rather small:

FindRoot[(Exp[2 h] - 1 - 2 h)/(5 h^2) == 0.002, {h, -200}]  
(* {h -> -199.499} *) 

FindRoot[(Exp[2 h] - 1 - 2 h)/(5 h^2) == (-0.0001), {h, 480}]  
(* FindRoot::cvmit: Failed to converge to the 
   requested accuracy or precision within 100 iterations. *)

I am unsure whether I should just change my input values or use another method of determining a good number. If I use any small number or negative value, it will fail to produce an answer and give me a FindRoot::lstol error.

  • 3
    $\begingroup$ What makes you think there are any values of h for which the expression is negative? $\endgroup$ – Carl Woll Jun 7 '18 at 2:13
  • $\begingroup$ To make it a bit more exlicit: The function Exp[2 h] is convex and you subtract its tangent a h = 0 and divide by a nonnegative term. Thus, you function is 0 at h=0 and positive everywhere else. So, your second equation has no solution, so Mathematica can try as hard as she can; she will inevitably fail. $\endgroup$ – Henrik Schumacher Jun 7 '18 at 8:31
  • 3
    $\begingroup$ I'm voting to close this question as off-topic because the issue arose from trying to solve an unsolvable equation. $\endgroup$ – Henrik Schumacher Jun 7 '18 at 8:33

You can ask Mathematica if it can tell you something about your function and in particular if it is going to be negative somewhere

Reduce[(Exp[2 h] - 1 - 2 h)/(5 h^2) < 0, h]
(* False *)

As you can see, there is no way your function will ever be negative. Therefore, it is no error in FindRoot but in your assumptions.

| improve this answer | |
  • $\begingroup$ Thanks. I suppose my standard values that were given would require me to explain that fact. $\endgroup$ – Apple Cola Jun 7 '18 at 2:21

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.