up previous next
2.2.12 A Groebner Basis Example
A Groebner basis of an ideal I is calculated with the command GBasis(I), as illustrated in the following example.

Let r be a root of the equation x^7-x-1 over the rationals. The minimal polynomial of (4r-1)/r^3 can be found by computing the reduced Groebner basis of the ideal (x^7-x-1,x^3y-4x+1) with respect to the lexicographic term-ordering with x>y.

Example
  Use R ::= QQ[x,y], Lex;
  Set Indentation;  -- to improve the appearance of the output
  G := GBasis(Ideal(x^7-x-1,x^3y-4x+1));
  G;

[ 1602818757152090759440/34524608236181199361x - 4457540/5875764481y^7
  - 47746460716124220/34524608236181199361y^6 +
  890175715271333840/34524608236181199361y^5 -
  3541992534667352220/34524608236181199361y^4 -
  55943894513139464160/34524608236181199361y^3 -
  56473654361333280980/34524608236181199361y^2 -
  27971979712025453040/34524608236181199361y -
  400704689288022689860/34524608236181199361, 1/16384y^7 - 5/16384y^6
  + 147/16384y^4 + 5/128y^3 - 31/16384y^2 + 17/128y - 20479/16384]
-------------------------------
  Len(G);
2
-------------------------------
  F := 16384*G[2];  -- clear denominators
  F;
y^7 - 5y^6 + 147y^4 + 640y^3 - 31y^2 + 2176y - 20479
-------------------------------
The Groebner basis is reported as a list with two elements. The second gives a univariate polynomial which is the minimal polynomial for r.

Note that the statement declaring the ring includes the modifier, Lex. Without this modifier, the default term-ordering, DegRevLex, is used. The command Set Indentation forces each polynomial of the Groebner basis to be printed on a new line.