Gb Interface — DemoFile

First load the package.

<<  Gb.m

Next define the path of the Gb library. On my system, the Gb binaries live in the following directory.

GbHome  =  "/home/mkauers/systems/Gb";

Example 1: cyclic6

Consider the system cyclic6.

c6base  = {x[0] + x[1] + x[2] + x[3] + x[4] + x[5], 
          x [0] x[1] + x[1] x[2] + x[2] x[3] + x[3] x[4] + x[0] x[5] + 
            x[4] x[5], 
          x[0] x[1] x[2] + x[1] x[2] x[3] + x[2] x[3] x[4] + 
            x[0] x[1] x[5] + x[0] x[4] x[5] + x[3] x[4] x[5], 
          x[0] x[1] x[2] x[3] + x[1] x[2] x[3] x[4] + 
            x[0] x[1] x[2] x[5] + x[0] x[1] x[4] x[5] + 
            x[0] x[3] x[4] x[5] + x[2] x[3] x[4] x[5], 
          x[0] x[1] x[2] x[3] x[4] + x[0] x[1] x[2] x[3] x[5] + 
            x[0] x[1] x[2] x[4] x[5] + x[0] x[1] x[3] x[4] x[5] + 
            x[0] x[2] x[3] x[4] x[5] + 
            x[1] x[2] x[3] x[4] x[5], -1 + 
            x[0] x[1] x[2] x[3] x[4] x[5]};

The ideal generated by this system is represented by an Ideal object.

c6  =  
        GbIdeal[c6base,  {x[0], x[1], x[2], x[3], x[4], x[5]},  
          MonomialOrder  ->  DegreeReverseLexicographic];

Ideals look like their Gröbner bases. They are objects of type Ideal.

c6  //  Short[#,  3] &

Head[c6]

We can request information about the ideal:

GbDimension[c6]

GbDegree[c6]

GbMonomialOrder[c6]

As the dimension is zero and the order is DRL, we can apply the FGLM algorithm.

c6lex  =  GbFGLM[c6];

The resulting ideal is different from the original one because it has a different order

c6lex  ===  c6

We could compute the same ideal directly, but that would take much longer. (Note the possibility to specify a time constraint.)

c6lex2  =  
      GBasis[c6base,  {x[0], x[1], x[2], x[3], x[4], 
          x[5]}, 
MonomialOrder -> Lexicographic,  
        TimeConstraint  ->  20]

The detour over a degree reverse lexicographic order is very fast:

GbTime[c6] + GbTime[c6lex]

Given a zero dimensional ideal wrt. lexicographic order, we can compute a list of triangular sets:

GbTriangular[c6lex]

Example 2: elimination ordering

By specifying two sets of variables, we declare a block ordering (elimination ordering) with two blocks. Within each block, the specified ordering is used.

i = 
      GbIdeal[{x^2 + y + z - 1, x + y^2 + z - 1, x + y + z^2 - 1}, {x}, {y, 
          z},  MonomialOrder  ->  
          DegreeReverseLexicographic]

The elimination ideal is generated by all polynomials not containing variables from the first list. By the GBasis command we can extract the Gröbner basis from an ideal. The result is a list of polynomials.

GBasis[i]

Select[%,  FreeQ[#,  x] &]

The "dirty" polynomials can be deleted automatically by using the option Eliminate. This may save IO time because the elimination is done by Gb already.

GbIdeal[{x^2 + y + z - 1, x + y^2 + z - 1, x + y + z^2 - 1}, {x}, {y, 
        z},  MonomialOrder  ->  DegreeReverseLexicographic,  
      Eliminate  ->  True]

The result is an ideal.

Example 3: computation of normal forms

It is also possible to compute normal forms of polynomials.

i = 
        GbIdeal[{x[0] + x[1] + x[2] + x[3] + x[4], 
            x[0] x[1] + x[1] x[2] + x[2] x[3] + x[0] x[4] + x[3] x[4], 
            x[0] x[1] x[2] + x[1] x[2] x[3] + x[0] x[1] x[4] + 
              x[0] x[3] x[4] + x[2] x[3] x[4], 
            x[0] x[1] x[2] x[3] + x[0] x[1] x[2] x[4] + 
              x[0] x[1] x[3] x[4] + x[0] x[2] x[3] x[4] + 
              x[1] x[2] x[3] x[4], -1 + 
              x[0] x[1] x[2] x[3] x[4]}, {x[0], x[1], x[2], x[3], 
            x[4]},  MonomialOrder  ->  DRL];

GbNormalForm[x[4]^10,  i]

We can construct ideals also by means of the GbPretend function which assumes that the given basis is already a Gröbner basis.

j = 
      GbPretend[{3*x^2 + x*y}, {x, y}, MonomialOrder -> DRL]

GbNormalForm[x^10, j]

Example 4: Hilbert polynomial and hilbert function

It is possible to compute the Hilbert polynomial and the Hilbert function of an ideal

i = 
      GbIdeal[{x*y - z^2}, {x, y, z}, MonomialOrder -> DRL, 
        Modulus -> 31]

GbHilbertPolynomial[i, Variable  ->  t]

GbHilbertFunction[i,  Variable  ->  t]

Series[%,  {t, 0, 5}]

Example 5: Switching to faster serveurs

Consider the following benchmark system.

kat9base  = {-x[1] + x[1]^2 + 2 x[2]^2 + 2 x[3]^2 + 
            2 x[4]^2 + 2 x[5]^2 + 2 x[6]^2 + 2 x[7]^2 + 2 x[8]^2 + 
            2 x[9]^2 + 2 x[10]^2, -x[2] + 2 x[1] x[2] + 
            2 x[2] x[3] + 2 x[3] x[4] + 2 x[4] x[5] + 2 x[5] x[6] + 
            2 x[6] x[7] + 2 x[7] x[8] + 2 x[8] x[9] + 2 x[9] x[10], 
          x[2]^2 - x[3] + 2 x[1] x[3] + 2 x[2] x[4] + 2 x[3] x[5] + 
            2 x[4] x[6] + 2 x[5] x[7] + 2 x[6] x[8] + 2 x[7] x[9] + 
            2 x[8] x[10], 
          2 x[2] x[3] - x[4] + 2 x[1] x[4] + 2 x[2] x[5] + 
            2 x[3] x[6] + 2 x[4] x[7] + 2 x[5] x[8] + 2 x[6] x[9] + 
            2 x[7] x[10], 
          x[3]^2 + 2 x[2] x[4] - x[5] + 2 x[1] x[5] + 2 x[2] x[6] + 
            2 x[3] x[7] + 2 x[4] x[8] + 2 x[5] x[9] + 
            2 x[6] x[10], 
2 x[3] x[4] + 
            2 x[2] x[5] - x[6] + 2 x[1] x[6] + 2 x[2] x[7] + 
            2 x[3] x[8] + 2 x[4] x[9] + 2 x[5] x[10], 
          x[4]^2 + 2 x[3] x[5] + 2 x[2] x[6] - x[7] + 2 x[1] x[7] + 
            2 x[2] x[8] + 2 x[3] x[9] + 2 x[4] x[10], 
          2 x[4] x[5] + 2 x[3] x[6] + 2 x[2] x[7] - x[8] + 
            2 x[1] x[8] + 2 x[2] x[9] + 2 x[3] x[10], 
          x[5]^2 + 2 x[4] x[6] + 2 x[3] x[7] + 2 x[2] x[8] - x[9] + 
            2 x[1] x[9] + 2 x[2] x[10], -1 + x[1] + 2 x[2] + 
            2 x[3] + 2 x[4] + 2 x[5] + 2 x[6] + 2 x[7] + 2 x[8] + 
            2 x[9] + 2 x[10]};

We do not obtain a Gröbner basis for this system using the standard serveur in a reasonable time:

kat9 = 
        GbIdeal[kat9base, Table[x[i], {i, 1, 10}], MonomialOrder -> DRL, 
          TimeConstraint -> 300];

However, it is possible to change to faster serveurs which are distributed together with the Gb system.

kat9fast = 
        GbIdeal[kat9base, Table[x[i], {i, 1, 10}], MonomialOrder -> DRL, 
          Algorithm  -> "accel_serveur"];

GbTime[kat9]

Which serveurs are available depends on your version of Gb. The Algorithm option accepts any string which is the prefix of a serveur name that can be found in the Gb directory (see GbHome).

Example 6: Computing cofactors

The interface package provides some functionalities which are not directly offered by the Gb system, but which can easily be implemented given the efficient Gröbner basis computation algorithm is available. For instance, given an ideal and a polynomial in that ideal, we can compute a representation of the polynomial in terms of the ideal's basis elements.

Fix a list of polynomials.

basis =  {-2 + 5* x^2 - 12*z + 8*x*z, 6*x + 10*x*z, 
          4 + 6*y*z - y^2*z, 5 - 9*x*y - 3*z - 4*y^2*z};

lc = 
        GbCofactors[x^2, basis, {x, y, z}, 
          MonomialOrder -> DRL];

The sum of all products of corresponding entries in the resulting list yields the polynomial specified as first argument. (If this polynomial is not in the ideal, the function returns the value $Failed.)

lc  .  basis  //  Expand