next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
PHCpack :: realFilter

realFilter -- returns real solutions with respect to a given tolerance

Synopsis

Description

We determine a solution to be real when the imaginary parts of all its variables are less than a given tolerance. In the example below we first call the blackbox solver to compute the intersection points of an ellipse with a parabola, storing the result in a list fSols of two real and two complex conjugated solutions. realFilter selects the two real solutions.
i1 : R = QQ[x,y];
i2 : f = {x^2 + 4*y^2 - 4, 2*y^2 - x};
i3 : fSols = phcSolve(f);
using temporary files /tmp/M2-5183-1PHCinput and /tmp/M2-5183-1PHCoutput
i4 : fSols/print
{1.23607, -.786151}
{1.23607, .786151}
{-3.23607, -1.27202*ii}
{-3.23607, 1.27202*ii}

o4 = {, , , }

o4 : List
i5 : realSols = realFilter(fSols,1.0e-10)

o5 = {{1.23607, -.786151}, {1.23607, .786151}}

o5 : List
Good values for the tolerance are relative to the accuracy and the condition number of the solution. To improve the accuracy of a solution, apply refineSolutions to increase working precision.
i6 : realSols_0#Coordinates_0 --this is the first coordinate of the first solution

o6 = 1.23606797749979-1.44265290902902e-129*ii

o6 : CC (of precision 53)

See also

Ways to use realFilter :