1
$\begingroup$

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

$\endgroup$
1
  • 2
    $\begingroup$ NSolve[-(0.25/(1 - x)) == Log[1. + 0.606531 (-0.5 + x)], {x}, Reals] $\endgroup$
    – Moo
    Jan 1, 2019 at 17:49

2 Answers 2

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

(*

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

*)

enter image description here

Even

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

works.

$\endgroup$
1
$\begingroup$

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!

$\endgroup$
4
  • $\begingroup$ Why is FindRoot "a better choice" than NSolve or Solve? $\endgroup$ Jan 1, 2019 at 18:38
  • $\begingroup$ And how did you know to seed the solutions at 1.5 and at .5? $\endgroup$ Jan 1, 2019 at 19:03
  • $\begingroup$ @ 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. $\endgroup$ Jan 1, 2019 at 19:14
  • $\begingroup$ @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. $\endgroup$ Jan 1, 2019 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.