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) using temporary files /var/folders/40/dy88l5qd361391m_3v2m51bm0000gn/T/M2-44693-0/0PHCinput and /var/folders/40/dy88l5qd361391m_3v2m51bm0000gn/T/M2-44693-0/0PHCoutput 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 = {1-ii, 1+ii, -1} 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); using temporary files /var/folders/40/dy88l5qd361391m_3v2m51bm0000gn/T/M2-44693-0/1PHCinput and /var/folders/40/dy88l5qd361391m_3v2m51bm0000gn/T/M2-44693-0/1PHCoutput |
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.