Macaulay2 » Documentation
Packages » PHCpack :: solveSystem
next | previous | forward | backward | up | index | toc

# solveSystem -- a numerical blackbox solver

- Usage:
    `solveSystem(S)`
    `solveSystem(S,numThreads=>4)`
    `solveSystem(S,computingPrecision=>2)`
    `solveSystem(S,randomSeed=>12345)`
- Inputs:
  - S, a list, contains a zero-dimensional system of polynomials with complex coefficients that contains at least as many equations as indeterminates
- Optional inputs:
  - computingPrecision => ..., default value 1, option to specify the working precision
  - numThreads => ..., default value 0, option to set the number of threads
  - randomSeed => ..., default value -1, option to set the seed of the random number generators
  - Verbose => ..., default value false, option to specify whether additional output is wanted
- Outputs:
  - a list, containing the solutions of S, each of type Point.
- Consequences:
  - 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.

## Description

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)

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

    o3 : List

The method solveSystem prints the PHCpack input and output file names and returns two solutions. The solutions are of type Point, defined in NAGtypes. Each point p comes with cached diagnostics. For example, p.cache.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{cache => CacheTable{...3...}   }
               Coordinates => {1-ii, 1+ii, -1}

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);
    *** after parseSolutions, ring has {x, y, z} ***

    i9 : numSolns = #solns

    o9 = 3

## Caveat

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.

## See also

- solveRationalSystem -- approximates solutions to a rational system of equations

## Ways to use solveSystem:

- `solveSystem(List)`

## For the programmer

The object solveSystem is a method function with options.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/PHCpack/PHCpackDoc.m2:1076:0.