Duplicate solutions in NSolve
This is an extended comment. Actually, the answers only appear to be the same. For instance, eq[[6]]
and eq[[7]]
actually are
{{s1 -> 0, i1 -> 0, s2 -> 18.249999999999982`, i2 -> 0, s3 -> 0, i3 -> 0}}
{{s1 -> 0, i1 -> 0, s2 -> 18.249999999988777`, i2 -> 0, s3 -> 0, i3 -> 0}}
More generally, Union@eq
does not reduce the number of solutions, indicating that there are small differences among them. Perhaps, NSolve
performs its analysis on the equations in various orders, yielding solutions that differ in some cases only by roundoff.
Incidentally,
Solve[Rationalize[eqns, 0], unks]
gives the twelve desired solutions exactly.
$Version
(* "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)" *)
Rationalize
the 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} // Rationalize //
Simplify;
unks = {s1, i1, s2, i2, s3, i3};
Use arbitrary precision by setting the WorkingPrecision
eq = NSolve[eqns, unks, WorkingPrecision -> 7]
(* {{i1 -> 0, s1 -> 0, s2 -> -62.9200 - 11.5510 I, i2 -> -15.1800 + 38.4020 I,
s3 -> 79.3500 + 14.4388 I, i3 -> 15.2500 - 38.7566 I}, {i1 -> 0, s1 -> 0,
s2 -> -62.9200 + 11.5510 I, i2 -> -15.1800 - 38.4020 I,
s3 -> 79.3500 - 14.4388 I, i3 -> 15.2500 + 38.7566 I}, {i1 -> 0, s1 -> 0,
s2 -> 18.25000, i2 -> 0, s3 -> 0, i3 -> 0}, {i1 -> 0, s1 -> 0, s2 -> 0,
i2 -> 0, s3 -> 18.00000, i3 -> 0}, {i1 -> 0, s1 -> 14.21852, s2 -> 0,
i2 -> 0, s3 -> 0.700000, i3 -> 0.4148148}, {i1 -> 0, s1 -> 15.33333,
s2 -> 0, i2 -> 0, s3 -> 0, i3 -> 0}, {i1 -> 0, s1 -> 0, s2 -> 0, i2 -> 0,
s3 -> 0.700000, i3 -> 9.41499}, {i1 -> 0, s1 -> 14.30667, s2 -> 0.560000,
i2 -> 0.4666667, s3 -> 0, i3 -> 0}, {i1 -> 0, s1 -> 0, s2 -> 0.560000,
i2 -> 10.60545, s3 -> 0, i3 -> 0}, {i1 -> 0, s1 -> 0, s2 -> 0, i2 -> 0,
s3 -> 0.700000, i3 -> -1.714995}, {i1 -> 0, s1 -> 0, s2 -> 0.560000,
i2 -> -1.245448, s3 -> 0, i3 -> 0}, {i1 -> 0, s1 -> 0, s2 -> 0, i2 -> 0,
s3 -> 0, i3 -> 0}} *)
Verifying solutions
And @@ (eqns /. eq // Flatten)
(* True *)
NSolve
returned the expected 12 solutions
Length[eq]
(* 12 *)