Goto Chapter: Top 1 2 3 4 5 6 Bib Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

2 Using the packages GBNP and NMO
 2.1 Noncommutative polynomials (NPs)
 2.2 Gröbner Bases
 2.3 Orderings for monomials

2 Using the packages GBNP and NMO

This package deals with polynomials in noncommutative algebras and to do so makes use of the noncommutative polynomial operations provided by the GBNP [CK24] package, and orderings provided by the NMO package, which is now included within GBNP. In this chapter we remind users how to call some of these operations.

2.1 Noncommutative polynomials (NPs)

Recall that the main datatype used by the GBNP package is a list of noncommutative polynomials (NPs). The data type for a noncommutative polynomial (its NP format) is a list of two lists:

The two lists have the same length. The polynomial represented by the ordered pair [m,c] is ∑_i c_i m_i. A monomial is a list of positive integers. They are interpreted as the indices of the variables. So, if k = [1,3,2,2,1] and the variables are x,y,z (in this order), then k represents the monomial xzy^2x. There are various ways to print these, but the default uses variables a,b,c,.... The zero polynomial is represented by [[],[]] and the polynomial 1 is represented by [[[]],[1]]. The algorithms are applicable for the algebra F[x_1,x_2,...,x_t] of noncommutative polynomials in t variables over the field F. Accordingly, the list c should contain elements of F.

The GBNP functions GP2NP and NP2GP convert a polynomial to NP format and back again. Polynomials returned by NP2GP print with their coefficients enclosed in brackets. Polynomials may also be printed using the function PrintNP. The function PrintNPList is used to print a list of NPs, with one polynomial per line. The function CleanNP is used to collect terms and reorder them. The default ordering is first by degree and then lexicographically - MonomialGrlexOrdering. Alternative orderings are available - see section 2.3.


gap> A3 := FreeAssociativeAlgebraWithOne(Rationals,"a","b","c");;
gap> a := A3.1;; b := A3.2;; c := A3.3;;
gap> ## define a polynomial and convert to NP-format
gap> p1 := 7*a^2*b*c + 8*b*c*a;
(8)*b*c*a+(7)*a^2*b*c
gap> Lp1 := GP2NP( p1 );
[ [ [ 1, 1, 2, 3 ], [ 2, 3, 1 ] ], [ 7, 8 ] ]
gap> ## define an NP-poly; clean it; and convert to a polynomial
gap> Lp2 := [ [ [1,1], [1,2,1], [3], [1,1], [3,1,2] ], [5,6,7,8,9] ];;
gap> PrintNP( Lp2 );
 5a^2 + 6aba + 7c + 8a^2 + 9cab
gap> Lp2 := CleanNP( Lp2 );
[ [ [ 3, 1, 2 ], [ 1, 2, 1 ], [ 1, 1 ], [ 3 ] ], [ 9, 6, 13, 7 ] ]
gap> ## note the degree lexicographic ordering
gap> PrintNP( Lp2 );
 9cab + 6aba + 13a^2 + 7c
gap> p2 := NP2GP( Lp2, A3 );
(9)*c*a*b+(6)*a*b*a+(13)*a^2+(7)*c
gap> PrintNPList( [ Lp1, Lp2, [ [], [] ], [ [ [] ], [9] ] ] );
 7a^2bc + 8bca
 9cab + 6aba + 13a^2 + 7c
 0
 9 

2.2 Gröbner Bases

The GBNP package computes Gröbner bases using the function SGrobner. In the example below the polynomials {p,q} define an ideal in Z[a,b] which has a three element Gröbner basis.


gap> p := [ [ [2,2,2], [2,1], [1,2] ], [1,3,-1] ];;
gap> q := [ [ [1,1], [2] ], [1,1] ];; 
gap> PrintNPList( [p,q] );
 b^3 + 3ba - ab
 a^2 + b 
gap> GB := SGrobner( [p,q] );;
gap> PrintNPList(GB);
 a^2 + b 
 ba - ab 
 b^3 + 2ab 

2.3 Orderings for monomials

The three monomial orderings provided by the main GAP library are MonomialLexOrdering, MonomialGrlexOrdering and MonomialGrevlexOrdering. The first of these is the default used by GBNP.

The NMO package is now part of the package GBNP. It provides a choice of orderings on monomials, including lexicographic and length-lexicographic ones.


gap> Lp1;
[ [ [ 1, 1, 2, 3 ], [ 2, 3, 1 ] ], [ 7, 8 ] ]
gap> Lp2;
[ [ [ 3, 1, 2 ], [ 1, 2, 1 ], [ 1, 1 ], [ 3 ] ], [ 9, 6, 13, 7 ] ]
gap> GtNPoly( Lp1, Lp2 );
true
gap> ## select the lexicographic ordering and reorder p1, p2
gap> lexord := NCMonomialLeftLexicographicOrdering( A3 );;
gap> PatchGBNP( lexord );
LtNP patched.
GtNP patched.
gap> Lp1 := CleanNP( Lp1 );
[ [ [ 2, 3, 1 ], [ 1, 1, 2, 3 ] ], [ 8, 7 ] ]
gap> Lp2 := CleanNP( Lp2 );
[ [ [ 3, 1, 2 ], [ 3 ], [ 1, 2, 1 ], [ 1, 1 ] ], [ 9, 7, 6, 13 ] ]
gap> GtNPoly( Lp1, Lp2 );
false
gap> ## revert to degree lex order
gap> UnpatchGBNP();;
LtNP restored.
GtNP restored.
gap> Lp1 := CleanNP( Lp1 );
[ [ [ 1, 1, 2, 3 ], [ 2, 3, 1 ] ], [ 7, 8 ] ]
gap> Lp2 := CleanNP( Lp2 );
[ [ [ 3, 1, 2 ], [ 1, 2, 1 ], [ 1, 1 ], [ 3 ] ], [ 9, 6, 13, 7 ] ]
gap> GtNPoly( Lp1, Lp2 );
true

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 6 Bib Ind

generated by GAPDoc2HTML