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

phcSolve -- a blackbox solver to approximate all complex isolated solutions (invokes "phc -b")

Synopsis

Description

Suppose we want to compute the numerical solutions to the following system:
i1 : R = QQ[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 = phcSolve(S)
using temporary files /tmp/M2-5160-1PHCinput and /tmp/M2-5160-1PHCoutput

o3 = {{1+ii, 1-ii, -1}, {1-ii, 1+ii, -1}}

o3 : List
We see that there are two solutions. Let’s take a look at the first one:
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 solutions are of type Point, defined in NAGtypes. Each Point comes with diagnostics to help determine how ‘good’ it is. 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.

A brief discussion on the dimension of the system is in place. If we try to run: we get an error. This is because the code does not check for dimension of the system; it checks for number of equations instead.

One way to solve problems to make the system and then use only minimal generators of the ideal by using "mingens". Here is a second system which is square, but has a free variable anyway (x) :
i6 : I = ideal(y-x^2,z-x^3,x^2-y)

               2         3       2
o6 = ideal (- x  + y, - x  + z, x  - y)

o6 : Ideal of R
i7 : dim I

o7 = 1
The system is not zero-dimensional (there is a free variable!!); but the code does not know that; since we have the system is “square”...
i8 : system = flatten entries gens I

         2         3       2
o8 = {- x  + y, - x  + z, x  - y}

o8 : List
i9 : vol = mixedVolume(system) -- this returns zero, not so useful
using temporary files /tmp/M2-5160-2PHCinput and /tmp/M2-5160-2PHCoutput

o9 = 0
i10 : phcSolve(system)
using temporary files /tmp/M2-5160-3PHCinput and /tmp/M2-5160-3PHCoutput

o10 = {(2.09881e-16-4.14836e-16*ii, 1.43602e-31-4.12544e-31*ii,
      -----------------------------------------------------------------------
      1.05539e-31+3.17302e-31*ii)}

o10 : List

Thus, if you are not sure if you have a *truly* square (or overdetermined system), that is, if you want to make sure the system is not positive dimensional (underdetermined), you can check this by getting rid of the non-minimal generators of the ideal (note: here we use "mingens" which returns a matrix; we could have used "trim" which returns an ideal)

In case we need slack variables:
i11 : dim trim I

o11 = 1
Also, if the system is overdetermined, then the method inserts slack variables, so it still works:
i12 : system={y-x^2, z-x^3,x+y+z-1,x+y+ x^3 -1}

          2         3                      3
o12 = {- x  + y, - x  + z, x + y + z - 1, x  + x + y - 1}

o12 : List
i13 : #system > numcols vars R --overdetermined system

o13 = true
i14 : solns =phcSolve(system);
using temporary files /tmp/M2-5160-4PHCinput and /tmp/M2-5160-4PHCoutput
i15 : numSolns = #solns

o15 = 3

Ways to use phcSolve :

  • phcSolve(List)