Writes the system to temporary file
Adds slack variables if needed (i.e. if system is overdetermined)
Invokes the command phc -b (launches the blackbox solver)
Stores output of phc in temporary file
Parses and outputs the solutions.
Suppose we want numerical approximations of all complex isolated solutions to the following system:
i1 : R = CC[x,y,z] o1 = R o1 : PolynomialRing |
i2 : S = {x+y+z-1, x^2+y^2, x+y-z-3} 2 2 o2 = {x + y + z - 1, x + y , x + y - z - 3} o2 : List |
We call PHCpack’s blackbox solver:
i3 : L = solveSystem(S) *** variables in the ring : {x, y, z} *** o3 = {{1-ii, 1+ii, -1}, {1+ii, 1-ii, -1}} o3 : List |
The method solveSystem prints the the PHCpack input and output file names and returns two solutions. The solutions are of type Point, defined in NAGtypes. Each Point comes with diagnostics. For example, LastT is the end value of the continuation parameter; if it equals 1, then the solver reached the end of the path properly.
i4 : oneSoln = L_0 o4 = oneSoln o4 : Point |
i5 : peek oneSoln o5 = Point{ConditionNumber => 6.32111 } Coordinates => {1-ii, 1+ii, -1} LastT => 1 SolutionStatus => Regular |
The method handles overdetermined systems by inserting slack variables.
i6 : system = {y-x^2, z-x^3, x+y+z-1, x+y+ x^3 -1} 2 3 3 o6 = {- x + y, - x + z, x + y + z - 1, x + x + y - 1} o6 : List |
i7 : #system > numcols vars R --overdetermined system o7 = true |
i8 : solns = solveSystem(system); *** variables in the ring : {x, y, z} *** *** after parseSolutions, ring has {x, y, z} *** |
i9 : numSolns = #solns o9 = 3 |
The method solveSystem does not check the dimension of the system; it checks for number of equations instead. So solveSystem will return an error if there are less equations than unknowns even if the system is zero-dimensional. In addition, if the system is square but not zero-dimensional, the output is meaningless. Thus, it is suggested that the user checks the dimension of the system before using solveSystem.