In v11.3 NSolve
returns a bunch of redundant solutions for the following set of six equations:
eqns={
0 == -0.07 s1 + 0.3 (0.75 i1 + s1) (1 - 0.05 (i1 + i2 + i3 + s1 + s2 + s3)),
0 == -0.28 i1,
0 == -0.07 s2 - 0.5 i1 s2 - 0.5 i2 s2 - 0.5 i3 s2 + 0.8 (0.75 i2 + s2) (1 - 0.05 (i1 + i2 + i3 + s1 + s2 + s3)),
0 == -0.28 i2 + 0.5 i1 s2 + 0.5 i2 s2 + 0.5 i3 s2,
0 == -0.07 s3 - 0.4 i1 s3 - 0.4 i2 s3 - 0.4 i3 s3 + 0.7 (0.75 i3 + s3) (1 - 0.05 (i1 + i2 + i3 + s1 + s2 + s3)),
0 == -0.28 i3 + 0.4 i1 s3 + 0.4 i2 s3 + 0.4 i3 s3};
unks={s1, i1, s2, i2, s3, i3};
eq = NSolve[eqns, unks];
Length[eq]
(* 30 *)
For example, {s1 -> 0, i1 -> 0, s2 -> 18.25, i2 -> 0, s3 -> 0, i3 -> 0}
shows up in eq
twice, {s1 -> 0, i1 -> 0, s2 -> 0, i2 -> 0, s3 -> 18., i3 -> 0}
shows up four times, etc.
In v11.2, NSolve
returns twelve unique solutions, as does Solve
in v11.3:
eq = Solve[eqns, unks];
Length[eq]
(* 12 *)
Giving NSolve
a Method
such as "EndomorphismMatrix"
, "CompanionMatrix"
, "Legacy"
, "Aberth"
, "JenkinsTraub"
as discussed here results in the proper set of twelve solutions. Edit: Even non-existent methods give twelve. However Method->"Homotopy"
gives 30.
Does v11.3 use a new Method
for NSolve
that produces this seeming bug? What would the best workaround be?
Edit:
$Version
gives "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)" so something must have changed since "11.3.0 for Mac OS X x86 (64-bit) (January 22, 2018)" in @MichaelE2's comment.
I've reported it to WRI.
BTW, this example surfaced in a general function I wrote, so any work-around should be generally applicable not just deal with this particular example.
Method -> "Legacy"
. SinceNSolve
started as a polynomial solver, maybe you're not losing anything. $\endgroup$