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

4 Functions for Noncommutative Monomials
 4.1 Basic functions for monomials

4 Functions for Noncommutative Monomials

A monomial, such as \(ab^2a\) is represented in GBNP as the list \([1,2,2,1]\). Polynomials have a more complicated structure, for example \(6ab^2a - 7ab + 8ba\) is represented in GBNP by \([ [ [1,2,2,1], [1,2], [2,1] ], [6,-7,8] ]\), which is a list of monomials followed by the corresponding list of coefficients. Polynomials are dealt with in the following chapter.

As shown in Section 2.1, GBNP has functions PrintNP and PrintNPList to print a polynomial and a list of polynomials. Here we provide equivalent functions for monomials.

4.1 Basic functions for monomials

4.1-1 Predefined algebras

For convenience of use in examples, three algebras over the rationals, AlbebraIBNP and AlgebrakIBNP with \(k \in [2,3,4]\), are predefined in this package.


gap> GeneratorsOfAlgebra( AlgebraIBNP );
[ (1)*<identity ...>, (1)*a, (1)*b ]
gap> Algebra2IBNP = AlgebraIBNP;
true
gap> A3 := Algebra3IBNP;
<algebra-with-one over Rationals, with 3 generators>

4.1-2 PrintNM
‣ PrintNM( monomial )( operation )
‣ PrintNMList( list )( operation )

Recall, from GBNP, that the actual letters printed are controlled by the operation GBNP.ConfigPrint.


gap> GBNP.ConfigPrint( "a", "b", "c" );
gap> mon := [2,1,1,1,3,3,1];;
gap> PrintNM( mon );
ba^3c^2a
gap> L := [ [1,2,2], [3,1,2], [3,3,3], [2], [ ] ];;
gap> PrintNMList( L );                            
ab^2
cab
c^3
b
1

4.1-3 NM2GM
‣ NM2GM( monomial, algebra )( operation )
‣ NM2GMList( list, algebra )( operation )

Recall, from GBNP, that the functions NP2GP and NP2GPList convert a polynomial (or list of polynomials) in NP-format to an element of the algebra. This package provides additional functions NM2GM and NM2GMList which do the equivalent conversion for monomials.


gap> m := NM2GM( mon, A3 );
(1)*b*a^3*c^2*a
gap> NM2GMList( [ mon, Reversed(mon), Concatenation(mon,mon) ], A3 );
[ (1)*b*a^3*c^2*a, (1)*a*c^2*a^3*b, (1)*(b*a^3*c^2*a)^2 ]

4.1-4 GM2NM
‣ GM2NM( monomial )( operation )
‣ GM2NMList( list )( operation )

Recall, from GBNP, that the functions GP2NP and GP2NPList convert a polynomial (or list of polynomials) to the equivalent NP-format. This package provides additional functions GM2NM and GM2NMList which do the equivalent conversion for monomials.


gap> a:=A3.1;; b:=A3.2;; c:=A3.3;;
gap> p := (a*b*c)^2;;             
gap> GM2NM(p);
[ 1, 2, 3, 1, 2, 3 ]
gap> GM2NMList( [ p, p^2, a^3, b^4, c^5 ] );
[ [ 1, 2, 3, 1, 2, 3 ], [ 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 ], [ 1, 1, 1 ], 
  [ 2, 2, 2, 2 ], [ 3, 3, 3, 3, 3 ] ]

4.1-5 PrefixNM
‣ PrefixNM( monomial, posint )( operation )
‣ SubwordNM( monomial, posint, posint )( operation )
‣ SuffixNM( monomial, posint )( operation )

These are the three operations which pick a sublist from a monomial list.


gap> mon := [2,1,1,1,3,3,1];;
gap> PrefixNM( mon, 3 );
[ 2, 1, 1 ]
gap> SubwordNM( mon, 3, 6 );
[ 1, 1, 3, 3 ]
gap> SuffixNM( mon, 3 );
[ 3, 3, 1 ]

4.1-6 SuffixPrefixPosNM
‣ SuffixPrefixPosNM( monomial, monomial, posint, posint )( operation )

The operation SuffixPrefixPosNM( left, right, start, limit) looks for overlaps of type suffix of left = prefix of right. The size of the smallest such overlap is returned. The overlaps which are considered are controlled by the third and fourth arguments. We commence by looking at the overlap of size start and go no further than the overlap of size limit. When no overlap exists, \(0\) is returned. To test all possibilities, start should be \(1\) and limit should be \(min(|left|,|right|)-1\). It is the user's responsibility to make sure that these bounds are correct - no checks are made.


gap> m1 := [2,1,1,1,2,2,1,1];;           ## m1 = ba^3b^2a^2
gap> m2 := [1,1,2,2,1,1];;               ## m2 = a^2b^2a^2
gap> SuffixPrefixPosNM( m1, m2, 1, 5 );  ## overlap is a                   
1
gap> SuffixPrefixPosNM( m1, m2, 2, 5 );  ## overlap is a^2
2
gap> SuffixPrefixPosNM( m1, m2, 3, 5 );  ## no longer an overlap
0
gap> SuffixPrefixPosNM( m2, m1, 1, 5 );  ## overlap is ba^2
3

4.1-7 SubwordPosNM
‣ SubwordPosNM( monomial, monomial, posint )( operation )
‣ IsSubwordNM( monomial, monomial )( operation )

The operation SubwordPosNM( small, large, start ); answers the question for monomials Is small a subword of large?. The value returned is the start position in large of the first subword found. When no subword is found, \(0\) is returned. The search commences at position start in large so, to test all possibilities, the third argument should be \(1\).

To just ask whether or not small is a subword of large, use IsSubwordNM( small, large);.


gap> m3 := [ 1, 1, 2 ];;                 ## m3 = a^2b
gap> SubwordPosNM( m3, m1, 1 );
3                                        ## m1 = ba(a^b)ba^2
gap> SubwordPosNM( m3, m2, 1 );
1                                        ## m2 = (a^2b)ba^2
gap> SubwordPosNM( m3, m2, 2 );
0
gap> IsSubwordNM( [ 2, 1, 2 ], m1 );
false

4.1-8 LeadVarNM
‣ LeadVarNM( monomial )( operation )
‣ LeadExpNM( monomial )( operation )
‣ TailNM( monomial )( operation )

Given the word \(w = b^4a^3c^2\), represented by \([2,2,2,2,1,1,1,3,3]\), the lead variable is \(b\) or \(2\), and the lead exponent is \(4\). Removing \(b^4\) from \(w\) leaves the tail \(a^3c^2\).


gap> mon4 := [2,2,2,2,1,1,1,3,3];;
gap> LeadVarNM( mon4 );           
2
gap> LeadExpNM( mon4 );           
4
gap> TailNM( mon4 );           
[ 1, 1, 1, 3, 3 ]

4.1-9 DivNM
‣ DivNM( monomial, monomial )( operation )

The operation DivNM(large, small); for two monomials returns all the ways that small divides large in the form of a list of pairs of monomials [left,right] so that large = left*small*right. In the example we search for subwords \(ab\) of \(m = abcababc\), returning \([ [abcab,c], [abc,abc], [1,cababc] ]\).


gap> GBNP.ConfigPrint( "a", "b", "c" );
gap> m := [ 1, 2, 3, 1, 2, 1, 2, 3 ];;
gap> d := [ 1, 2 ];;
gap> PrintNMList( [ m, d ] );
abcababc
ab                
gap> divs := DivNM( m, d ); 
[ [ [ 1, 2, 3, 1, 2 ], [ 3 ] ], [ [ 1, 2, 3 ], [ 1, 2, 3 ] ], 
  [ [  ], [ 3, 1, 2, 1, 2, 3 ] ] ]
gap> PrintNMList( divs[1] );
abcab
c

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

generated by GAPDoc2HTML