It is probably because it is solving a degree 131397 equation:
(1 - 2.25577*^-5*h)^5.25588 == 0.9644952131579817 // Rationalize[#, 0] &
(* (1 - (225577 h)/10000000000)^(131397/25000) == 79369373/82291101 *)
Simpler comparison, to show equivalence with a rationalized equation:
s1 = NSolve[(1 - 2.25577*^-5*h)^5.30 == 0.9644952131579817 // Rationalize[#, 0] &, h];
s2 = NSolve[(1 - 2.25577*^-5*h)^5.30 == 0.9644952131579817, h];
s1 == s2
(* True *)
Update - Remarks: What I've gleaned from the documentation and this site is that NSolve
is based on algorithms for solving polynomial systems. It can be used to solve systems that can be converted to polynomial systems, such as the OP's equation with rationalized coefficients and power. It can be converted to a degree 131397 polynomial equation, with a RHS involving some pretty large integers, probably another factor in the slowness. One would expect that many of the 131397 solutions to the polynomial equation would be extraneous. Note: A recent improvement has extended the capabilities of NSolve
and Solve
to transcendental equations over a bounded domain; e.g., NSolve[Erfc[x] == BesselJ[1, x] && 0 < Re@x < 5 && 0 < Im@x < 5, x]
.
NSolve
to my mind is not the numeric analog to a symbolic Solve
. NSolve
is more specialized. Further NSolve
I believe will find all roots, and it will find all real roots if we specify the domain Reals
with NSolve[eqn, h, Reals]
. Solve
is content to return just one in the OP's case. There is a big difference in verifying that all solutions have been found and that one has been found.
In the case where one has a numeric equation with a single real root, NSolve
seems the wrong tool to me. FindRoot
would be my first thought. But clearly, Solve
turns out to be a good choice here. Knowing that Solve
would use inverse functions, one can suppress the message with
Quiet[Solve[(1 - 2.25577*^-5*h)^5.25588 == 0.9644952131579817, h], Solve::ifun]
FindRoot[(1. - (2.25577*^-5) h)^5.2558 == 0.9644952131579817, {h, 300}]
returns{h -> 303.869}
essentially instantaneously. $\endgroup$ – m_goldberg Nov 11 '14 at 4:27(1 - 2.25577*10^(-5)*h)
$\endgroup$ – Nasser Nov 11 '14 at 4:31