# NSolve behaving differently in V9, V10.3 and V10.4

Bug introduced in 10.2 or earlier and fixed in 11.0.0

EDIT In a very fast response from Wolfram they state that this is a known problem and give an example of it working for version 10.4.1.

$Version (*10.4.1 for Microsoft Windows (64-bit) (April 11, 2016)*) NSolve[eqn, {h, r, fc}] (*{{h -> 6944.52 - 3662.26 I, r -> 4.68843*10^10 + 3.07219*10^12 I, fc -> -1.76222*10^8 + 3.51039*10^8 I}, {h -> 0.387583 + 0.0290387 I, r -> 44.9117 - 8.67483 I, fc -> 415.19 + 53.0697 I}} *)  Two solutions are supplied suggesting numerical issues which innaiz has identified below. The ever helpful Daniel Lichtblau suggests using the "EndomorphismMatrix" method which works well. sol = NSolve[eqn, {h, r, fc}, Method -> "EndomorphismMatrix"] (*{{h -> 0.387601 + 0.0289255 I, r -> 44.9137 - 8.66856 I, fc -> 415.189 + 53.0819 I}}*)  One solution is found which satisfies the equations: eqn /. sol (* {{True, True, True}} *)  This looks like the way forward. Original Post I need to solve equations of the form eqn = {0.046443987614013964 + 0.3690429826762282 I == h + r/(336.458333332019 - fc), 0.8898053473498362 + 0.5457057083738883 I == h + r/(449.9999999982421 - fc), 0.6745246773524501 + 0.07315743778713857 I == h + r/(563.5416666644653 - fc)}  So I use NSolve[] Using Version 9 NSolve[eqn, {h, r, fc}] (* {{h -> 0.387601 + 0.0289255 I, r -> 44.9137 - 8.66856 I, fc -> 415.189 + 53.0819 I}}*)  Using Version 10.3 (* {{h -> 17838.7 - 12957.1 I, r -> 2.88691*10^12 + 2.45046*10^12 I, fc -> 5.21787*10^7 + 1.8054*10^8 I}, {h -> 0.387583 + 0.0290387 I, r -> 44.9117 - 8.67483 I, fc -> 415.19 + 53.0697 I}} *)  Using Version 10.4 (* {} *)  So the solution is found in Version$9$. In Version$10.3$there are two solutions, one of which looks like it is a numerical artifact. Finally in Version$10.4$there is no solution. So is there a bug? I can use Solve but the problem is numeric and NSolve is meant to work better than Solve for numerical cases. What is the solution? Thanks • You can try one of the methods listed here: (a/103029). It might be considered a backslide, at least on this specific problem, I suppose. See also (a/104429); indeed this might be a duplicate of (104418) Apr 26, 2016 at 11:22 • Yes, it is a known issue, reported here and possibly elsewhere. As workaround could do NSolve[eqn, {h, r, fc},Method->"EndomorphismMatrix"]. Apr 26, 2016 at 16:18 • Thanks for your comments. I will try the workaround. – Hugh Apr 26, 2016 at 16:34 • MMA 11.0.0 seems to have the bug fixed without SetPrecision. It returns {{h -> 0.387601 + 0.0289255 I, r -> 44.9137 - 8.66856 I, fc -> 415.189 + 53.0819 I}} as in MMA 9. Aug 14, 2016 at 16:29 • It worked fine in 10.0.2 and fails in 10.2. So it must have been introduced in 10.1 or 10.2 Aug 15, 2016 at 1:50 ## 2 Answers Without SetPrecision it actually doesn't work fine in Mathematica 10.4.1: In[2]:= NSolve[eqn, {h, r, fc}] Out[2]= {{h -> 45112.4 + 69798. I, r -> 3.6894*10^11 - 2.09612*10^12 I, fc -> -3.94833*10^7 - 4.35473*10^7 I}, {h -> 0.387583 + 0.0290387 I, r -> 44.9117 - 8.67483 I, fc -> 415.19 + 53.0697 I}} In[3]:= eqn /. % Out[3]= {{False, False, False}, {False, False, False}}  However, in Mathematica 5.2 it works the same fine way as in version 9 in the subject question: In[2]:= NSolve[eqn, {h, r, fc}] Out[2]= {{h -> 0.3876007531699076 + 0.028925452482355368*I, r -> 44.913731800940106 - 8.668559624622056*I, fc -> 415.18940593411503 + 53.08192645339874*I}} In[3]:= eqn/.% Out[3]= {{True,True,True}}  Very sorry, this is not a reason to upgrade. • – user9660 Apr 26, 2016 at 17:34 • Mathematica 5.2. That's quite a downgrade! Thanks for investigating. – Hugh Apr 26, 2016 at 17:41 • Usually folks appreciate code that can easily be copied and pasted into Mathematica. Leaving off the In[] and Out[] labels and putting output between comments (*....*) helps with this. I left them in, because it's not that important in this case, imo. You can keep them from showing up be executing SetOptions[$FrontEnd, ExportMultipleCellsOptions -> {"IncludeCellLabels" -> False}]. (+1) Apr 27, 2016 at 10:47

Works fine in Mathematica 10.4.1

NSolve[SetPrecision[eqn, 16], {h, r, fc}] // Chop
(* {{h -> 0.3876007531699077 + 0.0289254524823553 I,
r -> 44.91373180094011 - 8.66855962462205 I,
fc -> 415.1894059341150 + 53.0819264533987 I}} *)
`