I'm solving a system of 3 non-linear equations with FindRoot
for the variables x
, y
and K
, and I'm doing this in a Table
so that I can give dfferent initial conditions.
But then, of course I get lots of repeated solutions.
The first thing I'm doing to get rid of imaginary solutions and also of solutions where $K$ is negative is
selection1 = Select[myList, ((x /. #) \[Element] Reals) && ((K /. #) \[Element] Reals) && ((y /. #) \[Element] Reals) && ((Kext /. #) > 0) &]
and now I want to eliminate repeated solutions. After doing
DeleteDuplicates[selection1, Equal[##] &]
it doesn't do great thing, so I think the best way would be to do what has been proposed here, i.e., something like
DeleteDuplicates[m, Abs[#1 - #2] < 10^-10 &]
but this only works when there is one variable. However my List selection1
is of the type {{x->1., y->2., z->3.}, {x->1., y->2., z->3.}, ...}
, and I want to apply the criterium Abs[#1 - #2] < 10^-10
to x
, y
and K
.
PS: In terms of performance I'm not sure if the way I'm doing the first selection is the appropriate one (maybe I should provide already those conditions in the FindRoot
comand? However I think that's only possible when using NSolve
though...).
DeleteDuplicates[myList, And @@ ((Abs[#1 - #2] < 10^-10 &) @@@ Thread[List[Values@#1, Values@#2]]) &]
$\endgroup$