In this section we give some more detail about how to control the computation of Groebner bases.
We may stop the computation of a homogeneous Groebner basis after S-polynomials up to a certain degree have been handled with the DegreeLimit option. (This is meaningful only in homogeneous situations.) Certains statistics about the suspended computation can be displayed with summary.
i1 : R = ZZ/101[x,y,z,w]; |
i2 : I = ideal(x*y-z^2,y^2-w^2) |
i3 : g2 = gb(I,DegreeLimit => 2) |
i4 : summary g2 |
i5 : g3 = gb(I,DegreeLimit => 3) |
i6 : summary g3 |
The computation advanced further with the higher degree limit.
The second computation advances the state of the Groebner basis object started by the first, and the two results are exactly the same Groebner basis object.
i7 : g2 |
i8 : g2 === g3 |
The option PairLimit can be used to stop after a certain number of S-polynomials have been reduced. After being reduced, the S-polynomial is added to the basis, or a syzygy has been found.
i9 : I = ideal(x*y-z^2,y^2-w^2) |
i10 : gb(I,PairLimit => 2) |
i11 : gb(I,PairLimit => 3) |
The option BasisElementLimit can be used to stop after a certain number of basis elements have been found.
i12 : I = ideal(x*y-z^2,y^2-w^2) |
i13 : gb(I,BasisElementLimit => 2) |
i14 : gb(I,BasisElementLimit => 3) |
The option CodimensionLimit can be used to stop after the apparent codimension, as gauged by the leading terms of the basis elements found so far, reaches a certain number.
The option SubringLimit can be used to stop after a certain number of basis elements in a subring have been found. The subring is determined by the monomial ordering in use. For Eliminate n the subring consists of those polynomials not involving any of the first n variables. For Lex the subring consists of those polynomials not involving the first variable. For ProductOrder {m,n,p} the subring consists of those polynomials not involving the first m variables.
Here is an example where we are satisfied to find one relation from which the variable t has been eliminated.
i15 : R = ZZ/101[t,F,G,MonomialOrder => Eliminate 1]; |
i16 : I = ideal(F - (t^3 + t^2 + 1), G - (t^4 - t)) |
i17 : transpose gens gb (I, SubringLimit => 1) |
Sometimes a Groebner basis computation can seem to last forever. An ongoing visual display of its progress can be obtained with gbTrace.
i18 : gbTrace 3 |
i19 : I = ideal(x*y-z^2,y^2-w^2) |
i20 : gb I |
Here is what the tracing symbols indicate.
{2} ready to reduce S-polynomials of degree 2 (0) there are 0 more S-polynomials (the basis is empty) g the generator yx-z2 has been added to the basis g the generator y2-w2 has been added to the basis {3} ready to reduce S-polynomials of degree 3 (1) there is 1 more S-polynomial m the reduced S-polynomial yz2-xw2 has been added to the basis {4} ready to reduce S-polynomials of degree 4 (2) there are 2 more S-polynomials m the reduced S-polynomial z4-x2w2 has been added to the basis o an S-polynomial reduced to zero and has been discarded {5} ready to reduce S-polynomials of degree 5 (1) there is 1 more S-polynomial o an S-polynomial reduced to zero and has been discarded
Let's turn off the tracing.
i21 : gbTrace 0 |
Each of the operations dealing with Groebner bases may be interrupted or stopped (by typing CTRL-C). The computation is continued by re-issuing the same command. Alternatively, the command can be issued with the option StopBeforeComputation => true. It will stop immediately, and return a Groebner basis object that can be inspected with summary, gens or syz. The computation can be continued later.
The function forceGB can be used to create a Groebner basis object with a specified Groebner basis. No computation is performed to check whether the specified basis is a Groebner basis.
If the Poincare polynomial (or Hilbert function) for a homogeneous submodule M is known, you can speed up the computation of a Groebner basis by informing the system. This is done by storing the Poincare polynomial in M.poincare.
As an example, we compute the Groebner basis of a random ideal, which is almost certainly a complete intersection, in which case we know the Hilbert function already.
i22 : R = ZZ/101[a..e]; |
i23 : T = (degreesRing R)_0 |
i24 : f = random(R^1,R^{-3,-3,-5,-6}); |
i25 : time betti gb f |
The matrix was randomly chosen, and we'd like to use the same one again, but this time with a hint about the Hilbert function, so first we must erase the memory of the Groebner basis computed above.
i26 : remove(f.cache,{false,0}) |
Now we provide the hint and compute the Groebner basis anew.
i27 : (cokernel f).poincare = (1-T^3)*(1-T^3)*(1-T^5)*(1-T^6) |
i28 : time betti gb f |
The computation turns out to be substantially faster.