7
$\begingroup$

I am using NSolve to solve an equation, as shown here:

T == (0.000250709 E^(0.0269867/(0.0000734429 + 1. T)))/(1.00025 - 
    1. E^(0.0539734/(0.0000734429 + 1. T)))

NSolve[T == (0.000250709 E^(0.0269867/(0.0000734429 + 
          1. T)))/(1.00025 - 
     1. E^(0.0539734/(0.0000734429 + 1. T))), {T}, Reals]

It gives me the warning Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result. >>, but still displays the result. Is it wrong to use NSolve for for such a general task, or am I missing a parameter?

$\endgroup$

1 Answer 1

10
$\begingroup$

No errors if you work with exact arithmetic instead:

NSolve[Rationalize[
         T == (0.000250709 E^(0.0269867/(0.0000734429 + 1. T)))/
              (1.00025 - 1. E^(0.0539734/(0.0000734429 + 1. T))), 10^-10], {T}, Reals]

(*{{T -> -6.55871*10^-164}, {T -> 216.923}}*)
$\endgroup$
2
  • $\begingroup$ It works, thanks.. but I'm not sure why. Does NSolve have an issue working with high precision? $\endgroup$
    – BillyJean
    Commented May 1, 2013 at 13:35
  • 1
    $\begingroup$ @niles, it's just that NSolve[] has some trouble if inexact numbers are present in the input. That's where Rationalize[] comes in. $\endgroup$ Commented May 15, 2013 at 11:49

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.