# NSolve does not work

I want to solve this eq'

$$((1 - t) r)/(1 - x) = \log[\exp[(r t )/x] + 1 - \exp[r]$$

without success, I tried to get a specific numeric solution

NSolve[-(0.25/(1 - x)) == Log[1. + 0.606531 (-0.5 + x)], {x}]


The output is the same line I wrote

• NSolve[-(0.25/(1 - x)) == Log[1. + 0.606531 (-0.5 + x)], {x}, Reals] – Moo Jan 1 '19 at 17:49

NSolve[-0.25/(1 - x) == Log[1. + 0.606531 (-0.5 + x)], x, Reals]


(*

{{x -> 0.100092}, {x -> 1.51936}}

*)

Even

Solve[-0.25/(1. - x) == Log[1. + 0.606531 (-0.5 + x)], x, Reals]


works.

For the transcendental equations FindRoot is a better choice.

FindRoot[-(0.25/(1 - x)) == Log[1. + 0.606531 (-0.5 + x)], {x, 1.5}]

(* {x -> 1.51936}  *)

FindRoot[-(0.25/(1 - x)) == Log[1. + 0.606531 (-0.5 + x)], {x, 0.5}]

(*  {x -> 0.100092}  *)


Have fun!

• Why is FindRoot "a better choice" than NSolve or Solve? – David G. Stork Jan 1 '19 at 18:38
• And how did you know to seed the solutions at 1.5 and at .5? – David G. Stork Jan 1 '19 at 19:03
• @ David G. Stork If a transcendental equation has an exact solution Solve is the best choice, that's evident. If not, one can either use NSolve or FindRoot. I remember that years ago there was a discussion on this and the general opinion was that in this case, FindRoot is better. I, however, never tried to find out why is it so. – Alexei Boulbitch Jan 1 '19 at 19:14
• @David G. Stork To address your second question. I know it from the plot published in your answer. I did not discuss it, since it is rather evident. – Alexei Boulbitch Jan 1 '19 at 19:16