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

5 Functions for Noncommutative Polynomials
 5.1 Basic functions for polynomials

5 Functions for Noncommutative Polynomials

5.1 Basic functions for polynomials

5.1-1 MaxDegreeNP
‣ MaxDegreeNP( polylist )( operation )

Given an FAlgList, this function calculates the degree of the lead term for each element of the list and returns the largest value found. In the example this is \(v\) with degree \(4\)


gap> A2 := AlgebraIBNP;
<algebra-with-one over Rationals, with 2 generators>
gap> a := A2.1;; b := A2.2;;
gap> ord := NCMonomialLeftLengthLexicographicOrdering( A2 );;
gap> u := [ [ [1,1,2], [2,1], [1] ], [3,2,-1] ];;
gap> v := [ [ [1,1,2,1], [1,2,2], [2,1] ], [4,-2,1] ];;
gap> w := [ [ [2,1,2], [1,2], [2] ], [2,-1,3] ];; 
gap> L3 := [ u, v, w ];; 
gap> PrintNPList( L3 ); 
 3a^2b + 2ba - a 
 4a^2ba - 2ab^2 + ba 
 2bab - ab + 3b 
gap> MaxDegreeNP( L3 );
4

5.1-2 ScalarMulNP
‣ ScalarMulNP( pol, const )( operation )

Arithmetic with polynomials is performed using the GBNP functions AddNP, MulNP and BimulNP. We find it convenient to add here a function which multiplies a polynomial by an element of the underlying field of the algebra.


gap> u2 := ScalarMulNP( u, 2 );;  PrintNP( u2 );
 6a^2b + 4ba - 2a
gap> x := [ [ [2,1] ], [5] ];;  PrintNP( x );
 5ba 
gap> v2 := AddNP( v, x, 1, -2 );;  PrintNP( v2 );
 4a^2ba - 2ab^2 - 9ba 
gap> w2 := MulNP( w, x );;  PrintNP( w2 );
 10bab^2a - 5ab^2a + 15b^2a 
gap> u3 := BimulNP( [2,2], u, [1,1] );;  PrintNP( u3 );               
 3b^2a^2ba^2 + 2b^3a^3 - b^2a^3 

5.1-3 LtNPoly
‣ LtNPoly( pol1, pol2 )( operation )
‣ GtNPoly( pol1, pol2 )( operation )

These two functions generalise the GBNP functions LtNP and GtNP which (confusingly) apply only to monomials. They compare a pair of polynomials with respect to the monomial ordering currently being used. In the example we check that \(w > u\), that \(u < 2u\) and \(v > v-10ba\).


gap> [ LtNPoly( w, u ), LtNPoly( u, u2 ) ];     
[ false, true ]
gap> GtNPoly( v, v2 );
true
gap> ## LtNPoly and GtNPoly may be used within the Sort command:
gap> L4 := [u,v,u2,v2];
[ [ [ [ 1, 1, 2 ], [ 2, 1 ], [ 1 ] ], [ 3, 2, -1 ] ], 
  [ [ [ 1, 1, 2, 1 ], [ 1, 2, 2 ], [ 2, 1 ] ], [ 4, -2, 1 ] ], 
  [ [ [ 1, 1, 2 ], [ 2, 1 ], [ 1 ] ], [ 6, 4, -2 ] ], 
  [ [ [ 1, 1, 2, 1 ], [ 1, 2, 2 ], [ 2, 1 ] ], [ 4, -2, -9 ] ] ]
gap> Sort( L4, GtNPoly );
gap> L4;
[ [ [ [ 1, 1, 2, 1 ], [ 1, 2, 2 ], [ 2, 1 ] ], [ 4, -2, 1 ] ], 
  [ [ [ 1, 1, 2, 1 ], [ 1, 2, 2 ], [ 2, 1 ] ], [ 4, -2, -9 ] ], 
  [ [ [ 1, 1, 2 ], [ 2, 1 ], [ 1 ] ], [ 6, 4, -2 ] ], 
  [ [ [ 1, 1, 2 ], [ 2, 1 ], [ 1 ] ], [ 3, 2, -1 ] ] ]

5.1-4 LowestLeadMonomialPosNP
‣ LowestLeadMonomialPosNP( polylist )( operation )

Given a list of polynomials, this function looks at all the leading monomials and returns the position of the smallest lead monomial with respect to the monomial ordering currently being used. In the example, since L4 is sorted, the fourth polynomial is the least.


gap> LowestLeadMonomialPosNP( L4 );
4

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

generated by GAPDoc2HTML