next | previous | forward | backward | up | top | index | toc | Macaulay2 website
NAGtypes :: sortSolutions(List)

sortSolutions(List) -- sort the list of solutions



The sorting is done lexicographically regarding each complex n-vector as real 2n-vector. The output format of track and solveSystem is respected.
For the corresponding coordinates a and b (of two real 2n-vectors) a < b if b-a is larger than Tolerance.

i1 : needsPackage "NumericalAlgebraicGeometry"

o1 = NumericalAlgebraicGeometry

o1 : Package
i2 : R = CC[x,y];
i3 : s = solveSystem {x^2+y^2-1, x*y}

o3 = {{3.02251e-20+2.05294e-20*ii, -1}, {-3.02251e-20-2.05294e-20*ii, 1}, {1,
     8.30314e-21+4.44918e-20*ii}, {-1, -8.30314e-21-4.44918e-20*ii}}

o3 : List
i4 : sortSolutions s

o4 = {{-1, -8.30314e-21-4.44918e-20*ii}, {3.02251e-20+2.05294e-20*ii, -1},
     {-3.02251e-20-2.05294e-20*ii, 1}, {1, 8.30314e-21+4.44918e-20*ii}}

o4 : List


The sorting described above does not possess good properties, since there may be near ties in specific coordinate values between several points. A better way is to specify a random weight (of length 2n where n=#points) as an optional parameter sortSolutions(...,Weights=>...), which provides a linear functional that evaluates to distinct (and sufficiently) real numbers on the given points.

See also