I am attempting to solve an equation given an input value, so that Mathematica can process an answer and produce a result. However, when I try to do so, it does not like the equation I give:
Solve[(Exp[2 h] - 1 - 2 h)/(5 h^2) == 0.1, h]
Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help.
Solve[(-1 + E^(2 h) - 2 h)/(5 h^2) == 0.1, h]
Upon failing to provide a solution, the error "Solve::inex" is displayed, which shows you the text above. I am unsure whether or not I must be more definitive with my input arguments. I am attempting to set h to 0.1 (and other values such as 002,-0:0001,-0:00002) and get a decimal value. Using NSolve doesn't produce a result either.
Solve
is usually better at polynomial problems and not as good at transcendental problems. Reduce
is often better at transcendental problems, but it too claims that it can't crack this. So the next thing I do is
Plot[{(Exp[2 h] - 1 - 2 h)/(5 h^2), 0.1 },{h,-5,3}]
and that tells me that your function is well behaved and has a solution near -3.
FindRoot
is often very aggressive when looking for roots if it is given a well behaved problem and a good initial guess. Thus
h/.FindRoot[(Exp[2 h] - 1 - 2 h)/(5 h^2) == 0.1 ,{h,-3}]
almost instantly tells me that the only (real) root is near -3.41498
This technique should work equally well for other positive values on the right hand side of your equation, perhaps even with only very rough estimates of what h might be. For negative values on the right hand side I suspect you may have other problems. You might use Plot
to investigate this before trying to use FindRoot