5
$\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$
9
$\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$
  • $\begingroup$ It works, thanks.. but I'm not sure why. Does NSolve have an issue working with high precision? $\endgroup$ – BillyJean May 1 '13 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$ – J. M. will be back soon May 15 '13 at 11:49

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.