I noticed that NSolve
isn't running properly when I have some seemingly harmless numbers in my expression. Here is a simple example:
NSolve[1/x == 10^15, x]
(* {} *)
Interestingly, if I run this over a list of different powers many of them are failing (but not all):
Cases[#, {x_, {}}] &@ Table[{i, NSolve[1/x == 10^i, x]}, {i, Range[1, 50]}]
(* {{15, {}}, {18, {}}, {21, {}}, {23, {}}, {24, {}}, {25, {}},
{26, {}}, {29, {}}, {30, {}}, {32, {}}, {34, {}}, {39, {}},
{42, {}}, {43, {}}, {45, {}}, {49, {}}} *)
Why is this happening and is there is a generic workaround?
Note: I'm using Mathematica on Linux x86 10.0.2.0
WorkingPrecision
to anything other than the default value, it works. $\endgroup$(10.0)^i
instead:{{15, {}}, {18, {}}, {21, {}}, {24, {}}, {30, {}}, {34, {}}, {37, {}}, {43, {}}, {46, {}}}
I wonder if the answer is related to the binary (floating-point) representation of 1/10 or something like that. $\endgroup$Cases[Table[{v, NSolve[1/x == v, x]}, {v, RandomReal[10, 1000] 10^13}], {x_, {}}]
$\endgroup$Solve
, which works fine. $\endgroup$