Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/gbnp/doc/examples/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 29.7.2024 mit Größe 45 kB image not shown  

Quellcode-Bibliothek functions.xml   Sprache: XML

 
gap> ######################### BEGIN COPYRIGHT MESSAGE #########################
GBNP - computing Gröbner bases of noncommutative polynomials
Copyright 2001-2010 by Arjeh M. Cohen, Dié A.H. Gijsbers, Jan Willem
Knopper, Chris Krook. Address: Discrete Algebra and Geometry (DAM) group
at the Department of Mathematics and Computer Science of Eindhoven
University of Technology.

For acknowledgements see the manual. The manual can be found in several
formats in the doc subdirectory of the GBNP distribution. The
acknowledgements formatted as text can be found in the file chap0.txt.

GBNP is free software; you can redistribute it and/or modify it under
the terms of the Lesser GNU General Public License as published by the
Free Software Foundation (FSF); either version 2.1 of the License, or
(at your option) any later version. For details, see the file 'LGPL' in
the doc subdirectory of the GBNP distribution or see the FSF's own site:
https://www.gnu.org/licenses/lgpl.html
gap> ########################## END COPYRIGHT MESSAGE ##########################

First load the gap package (before the example)

gap> LoadPackage("gbnp", false);
true

<#GAPDoc Label="example-GP2NP">

<E>Example:</E>
Let <C>A</C> be the free associative algebra with one over the rationals on the
generators <C>a</C> and <C>b</C>. Let <C>e</C> be the one of the algebra.

<Listing><![CDATA[
gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
gap> a:=A.a;;
gap> b:=A.b;;
gap> e:=One(A);;
gap> z:=Zero(A);;
]]></Listing>

Now let <C>gp</C> be the polynomial <M>ba-ab-e</M>.

<Listing><![CDATA[
gap> gp:=b*a-a*b-e;
(-1)*<identity ...>+(-1)*a*b+(1)*b*a
]]></Listing>

The polynomial in NP format, corresponding to <C>gp</C> can now be obtained
with GP2NP:

<Listing><![CDATA[
gap> GP2NP(gp);
[ [ [ 2, 1 ], [ 1, 2 ], [  ] ], [ 1, -1, -1 ] ]
]]></Listing>



Let <C>D</C> be the free associative algebra over <C>A</C>
of rank 2.

<Listing><![CDATA[
gap> D := A^2;;
]]></Listing>

Take the following list <C>R</C> of two elements of <C>D</C>.

<Listing><![CDATA[
gap> R := [ [b-e, z], [e+a*(e+a+b), -e-a*(e+a+b)] ];;
]]></Listing>

Convert the list <C>R</C> to a list of vectors in NPM format.

<Listing><![CDATA[
gap> List(R,GP2NP);
[ [ [ [ -1, 2 ], [ -1 ] ], [ 1, -1 ] ],
  [ [ [ -1, 1, 2 ], [ -1, 1, 1 ], [ -2, 1, 2 ], [ -2, 1, 1 ], [ -1, 1 ],
          [ -2, 1 ], [ -1 ], [ -2 ] ], [ 1, 1, -1, -1, 1, -1, 1, -1 ] ] ]
]]></Listing>

<#/GAPDoc>

<#GAPDoc Label="example-GP2NPList">

<E>Example:</E>
Let <C>A</C> be the free associative algebra with one over the rationals on the
generators <C>a</C> and <C>b</C>. Let <C>e</C> be the one of the algebra.

<Listing><![CDATA[
gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
gap> a:=A.a;;
gap> b:=A.b;;
gap> e:=One(A);;
]]></Listing>

Let <C>Lgp</C> be the list of polynomials <M>[a^2-e,b^2-e,ba-ab-e]</M>.

<Listing><![CDATA[
gap> Lgp:=[a^2-e,b^2-e,b*a-a*b-e];
[ (-1)*<identity ...>+(1)*a^2, (-1)*<identity ...>+(1)*b^2,
  (-1)*<identity ...>+(-1)*a*b+(1)*b*a ]
]]></Listing>

The polynomial in NP format corresponding to <C>gp</C> can be obtained
with GP2NP:

<Listing><![CDATA[
gap> GP2NPList(Lgp);
[ [ [ [ 1, 1 ], [  ] ], [ 1, -1 ] ], [ [ [ 2, 2 ], [  ] ], [ 1, -1 ] ],
  [ [ [ 2, 1 ], [ 1, 2 ], [  ] ], [ 1, -1, -1 ] ] ]
]]></Listing>

The same result is obtained by a simple application of the standard List
function in GAP:

<Listing><![CDATA[
gap> List(Lgp,GP2NP) = GP2NPList(Lgp);
true
]]></Listing>


<#/GAPDoc>

<#GAPDoc Label="example-NP2GP">

<E>Example:</E>
Let <C>A</C> be the free associative algebra with one over the rationals on
the generators <C>a</C> and <C>b</C>.

<Listing><![CDATA[
gap> A:=FreeAssociativeAlgebraWithOne(GF(3),"a","b");;
]]></Listing>

Let <C>np</C> be a polynomial in NP format.

<Listing><![CDATA[
gap> np:=[ [ [ 2, 1 ], [ 1, 2 ], [  ] ], [ Z(3)^0, Z(3), Z(3) ] ];;
]]></Listing>

The polynomial can be converted to the corresponding element of <A>A</A>
with NP2GP:

<Listing><![CDATA[
gap> NP2GP(np,A);
(Z(3)^0)*b*a+(Z(3))*a*b+(Z(3))*<identity ...>
]]></Listing>

Note that some information of the coefficient field of
a polynomial
<C>np</C> in NP format can be obtained from the second list of <C>np</C>.

<Listing><![CDATA[
gap> One(np[2][1]);
Z(3)^0
]]></Listing>


Now let <C>M</C> be the module <C>A^2</C> and let <C>npm</C> be a polynomial
over that module in NPM form.

<Listing><![CDATA[
gap> M:=A^2;;
gap> npm:=[ [ [ -1, 1 ], [ -2, 2 ] ], [ Z(3)^0, Z(3)^0 ] ];;
]]></Listing>



The element of <A>M</A> corresponding to <C>npm</C> is

<Listing><![CDATA[
gap> NP2GP(npm,M);
[ (Z(3)^0)*a, (Z(3)^0)*b ]
]]></Listing>


If <C>M</C> is a module of dimension 2 over <C>A</C> and <C>Lnp</C> a list
of polynomials in NPM format, then the polynomials can be converted to the
corresponding polynomials of <C>M</C> as follows:

<Listing><![CDATA[
gap> M:=A^2;;
gap> Lnp:=[ [ [ [ -2, 1, 1 ], [ -2, 1 ] ], [ 1, -1 ] ],
>   [ [ [ -1, 2, 2], [-2, 1 ] ], [ 1, -1 ]*Z(3)^0 ] ];;
gap> List(Lnp, m -> NP2GP(m,M));
[ [ <zero> of ..., (Z(3))*a+(Z(3)^0)*a^2 ], [ (Z(3)^0)*b^2, (Z(3))*a ] ]
]]></Listing>





<#/GAPDoc>

<#GAPDoc Label="example-NP2GPList">

<E>Example:</E>
Let <C>A</C> be the free associative algebra with one over the rationals on
the generators <C>a</C> and <C>b</C>.

<Listing><![CDATA[
gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
]]></Listing>

Let <C>Lnp</C> be a list of polynomials in NP format.
Then <C>Lnp</C> can be converted to a list of polynomials of <C>A</C>
with NP2GPList:

<Listing><![CDATA[
gap> Lnp:=[ [ [ [ 1, 1, 1 ], [ 1 ] ], [ 1, -1 ] ],
>   [ [ [ 2, 2 ], [ ] ], [ 1, -1 ] ] ];;
gap> NP2GPList(Lnp,A);
[ (1)*a^3+(-1)*a, (1)*b^2+(-1)*<identity ...> ]
]]></Listing>


It has the same effect as the function <C>List</C> applied as follows.

<Listing><![CDATA[
gap> List(Lnp, p -> NP2GP(p,A));
[ (1)*a^3+(-1)*a, (1)*b^2+(-1)*<identity ...> ]
]]></Listing>

Now let <C>M</C> be a module of dimension 2 over <C>A</C> and <C>Lnp</C>
a list of vectors in NPM format. Then polynomials <C>Lnp</C>
can be converted to the
corresponding vectors of <C>M</C> with NP2GPList:

<Listing><![CDATA[
gap> M:=A^2;;
gap> Lnp:=[ [ [ [ -2, 1, 1 ], [ -2, 1 ] ], [ 1, -1 ] ],
>   [ [ [ -1, 1 ], [ -2 ] ], [ 1, -1 ] ] ];;
gap> NP2GPList(Lnp,M);
[ [ <zero> of ..., (-1)*a+(1)*a^2 ], [ (1)*a, (-1)*<identity ...> ] ]
]]></Listing>

The same result can be obtained by application of the standard
List function:

<Listing><![CDATA[
gap> List(Lnp, m -> NP2GP(m,M)) = NP2GPList(Lnp,M) ;
true
]]></Listing>


<#/GAPDoc>




<#GAPDoc Label="example-PrintNP">
<E>Example:</E>
Consider the following polynomial in NP format.
<Listing><![CDATA[
gap> p := [[[1,1,2],[1,2,2],[]],[1,-2,3]];;
]]></Listing>


It can be printed in the guise of a polynomial in <C>a</C> and <C>b</C>
by the function <C>PrintNP</C>:
<Listing><![CDATA[
gap> PrintNP(p);
 a^2b - 2ab^2 + 3
]]></Listing>

<#/GAPDoc>



<#GAPDoc Label="example-ConfigPrint">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
]]></Listing>


They can be printed by the function <C>PrintNP</C>.
<Listing><![CDATA[
gap> PrintNP(p1);
 a^2b - 1
gap> PrintNP(p2);
 ab^2 - 1
]]></Listing>

We can let the variables be printed as <C>x</C> and <C>y</C>
instead of <C>a</C> and <C>b</C> by means of
<Ref Func="GBNP.ConfigPrint" Style="Text"/>.
<Listing><![CDATA[
gap> GBNP.ConfigPrint("x","y");
gap> PrintNP(p1);
 x^2y - 1
gap> PrintNP(p2);
 xy^2 - 1
]]></Listing>


We can also let the variables be printed as <C>x.1</C> and <C>x.2</C>
instead of <C>a</C> and <C>b</C> by means of
<Ref Func="GBNP.ConfigPrint" Style="Text"/>.
<Listing><![CDATA[
gap> GBNP.ConfigPrint(2,"x");
gap> PrintNP(p1);
 x.1^2x.2 - 1
gap> PrintNP(p2);
 x.1x.2^2 - 1
]]></Listing>


We can even assign strings to the variables to
be printed like <C>alice</C> and <C>bob</C>
instead of <C>a</C> and <C>b</C> by means of
<Ref Func="GBNP.ConfigPrint" Style="Text"/>.
<Listing><![CDATA[
gap> GBNP.ConfigPrint("alice","bob");
gap> PrintNP(p1);
 alice^2bob - 1
gap> PrintNP(p2);
 alicebob^2 - 1
]]></Listing>


Alternatively, we can introduce the free algebra <A>A</A>
with two generators,
and print the polynomials as members of <A>A</A>:

<Listing><![CDATA[
gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
gap> GBNP.ConfigPrint(A);
gap> PrintNP(p1);
 a^2b - 1
gap> PrintNP(p2);
 ab^2 - 1
]]></Listing>


<#/GAPDoc>




<#GAPDoc Label="example-PrintNPList">
<E>Example:</E>
We put two polynomials in NP format into the list <C>Lnp</C>.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
gap> Lnp := [p1,p2];;
]]></Listing>

We can print the list with
<Ref Func="PrintNPList" Style="Text"/>.
<Listing><![CDATA[
gap> PrintNPList(Lnp);
 a^2b - 1
 ab^2 - 1
]]></Listing>

Alternatively, using the function
<Ref Func="GBNP.ConfigPrint" Style="Text"/>,
we can introduce the free algebra <A>A</A>
with two generators,
and print the polynomials of the list as members of <A>A</A>:

<Listing><![CDATA[
gap> A:=FreeAssociativeAlgebraWithOne(Rationals,"a","b");;
gap> GBNP.ConfigPrint(A);
gap> PrintNPList(Lnp);
 a^2b - 1
 ab^2 - 1
]]></Listing>


<#/GAPDoc>




<#GAPDoc Label="example-AddNP">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-3]];;
gap> p2 := [[[1,2,2],[]],[1,-4]];;
]]></Listing>


The second can be subtracted from the first by the function <C>AddNP</C>.
<Listing><![CDATA[
gap> PrintNP(AddNP(p1,p2,1,-1));
 - ab^2 + a^2b + 1
]]></Listing>

<#/GAPDoc>



<#GAPDoc Label="example-BimulNP">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-3]];;
gap> p2 := [[[1,2,2],[]],[1,-4]];;
]]></Listing>

Multiplying <C>p1</C> from the right by <C>b</C> and
multiplying <C>p2</C> from the left by <C>a</C>
is possible with the function <C>BimulNP</C>:
<Listing><![CDATA[
gap> PrintNP(BimulNP([],p1,[2]));
 a^2b^2 - 3b
gap> PrintNP(BimulNP([1],p2,[]));
 a^2b^2 - 4a
]]></Listing>

<#/GAPDoc>




<#GAPDoc Label="example-CleanNP">
<E>Example:</E>
Consider the following polynomial in NP format.
<Listing><![CDATA[
gap> p := [[[1,1,2],[],[1,1,2],[]],[1,-3,-2,3]];;
gap> PrintNP(p);
 a^2b - 3 - 2a^2b + 3
]]></Listing>

The monomials <C>[1,1,2]</C> and <C>[]</C>  occur twice each.
For many functions this representation of a polynomial in NP format
is not allowed. It needs to be cleaned, as by <Ref Func="CleanNP" Style="Text"/>:
<Listing><![CDATA[
gap> PrintNP(CleanNP(p));
 - a^2b
]]></Listing>


In order to define a polynomial over <M>GF(2)</M>,
the coefficients need to be defined over this field.
Such a list of coefficients can be obtained in  GAP
from a list of integers by multiplying with the identity element
of the field.
The resulting polynomial need not be clean, and so should be made clean again
with <C>CleanNP</C>.
<Listing><![CDATA[
gap> p := [[[1,1,2],[]],One(GF(2))*[1,-2]];;
gap> CleanNP(p);
[ [ [ 1, 1, 2 ] ], [ Z(2)^0 ] ]
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-GtNP">
<E>Example:</E>
Consider the following two monomials.
<Listing><![CDATA[
gap> u := [1,1,2];
[ 1, 1, 2 ]
gap> v := [2,2,1];
[ 2, 2, 1 ]
]]></Listing>

We test whether <C>u</C> is greater than <C>v</C>.

<Listing><![CDATA[
gap> GtNP(u,v);
false
]]></Listing>

<#/GAPDoc>




<#GAPDoc Label="example-LtNP">
<E>Example:</E>
Consider the following two monomials.
<Listing><![CDATA[
gap> u := [1,1,2];
[ 1, 1, 2 ]
gap> v := [2,2,1];
[ 2, 2, 1 ]
]]></Listing>

We test whether <C>u</C> is less than <C>v</C>.

<Listing><![CDATA[
gap> LtNP(u,v);
true
]]></Listing>

<#/GAPDoc>



<#GAPDoc Label="example-LMonsNP">
<E>Example:</E>
We put two polynomials in NP format into the list <C>Lnp</C>.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
gap> Lnp := [p1,p2];;
]]></Listing>

The list of leading monomials is computed by <C>LMonsNP</C>:

<Listing><![CDATA[
gap> LMonsNP(Lnp);
[ [ 1, 1, 2 ], [ 1, 2, 2 ] ]
]]></Listing>


For a nicer printing, the monomials can be converted into polynomials in NP format,
and then submitted to PrintNPList:

<Listing><![CDATA[
gap> PrintNPList(List(LMonsNP(Lnp), q -> [[q],[1]]));
 a^2b
 ab^2
]]></Listing>

<#/GAPDoc>

<#GAPDoc Label="example-LTermNP">
<E>Example:</E>
We put two polynomials in NP format into the list <C>Lnp</C>.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[1]],[6,-7]];;
gap> p2 := [[[1,2,2],[2]],[8,-9]];;
gap> Lnp := [p1,p2];;
]]></Listing>

The leading term of a polynomial is returned by <C>LTermNP</C>,
and the list of leading terms is computed by <C>LTermsNP</C>:

<Listing><![CDATA[
gap> LTermNP(p1);
[ [ 1, 1, 2 ], [ 6 ] ]
gap> LTnp := LTermsNP( Lnp );
[ [ [ [ 1, 1, 2 ] ], [ 6 ] ], [ [ [ 1, 2, 2 ] ], [ 8 ] ] ]
gap> PrintNPList( LTnp );
6a^2b
8ab^2
]]></Listing>

<#/GAPDoc>

<#GAPDoc Label="example-MkMonicNP">
<E>Example:</E>
Consider the following polynomial in NP format.
<Listing><![CDATA[
gap> p := [[[1,1,2],[]],[2,-1]];;
gap> PrintNP(p);
 2a^2b - 1
]]></Listing>

The coefficient of the leading term is <M>2</M>.
The function <C>MkMonicNP</C> finds this coefficient
and divides every term by it:

<Listing><![CDATA[
gap> PrintNP(MkMonicNP(p));
 a^2b - 1/2
]]></Listing>

<#/GAPDoc>

<#GAPDoc Label="example-FactorOutGcdNP">
<E>Example:</E>
Consider the following polynomial in NP format.
<Listing><![CDATA[
gap> p := [[[1,1,2],[1,2],[1]],[30,70,105]];;
gap> PrintNP(p);
 30a^2b + 70ab + 105a
]]></Listing>

The <C>Gcd</C> of the coefficients <M>[30,70,105]</M> is <M>5</M>.
The function <C>FactorOutGcdNP</C> divides the polynomial by <M>5</M>:

<Listing><![CDATA[
gap> PrintNP(FactorOutGcdNP(p));
 6a^2b + 14ab + 21a
gap> m := MkMonicNP(p);
[ [ [ 1, 1, 2 ], [ 1, 2 ], [ 1 ] ], [ 1, 7/3, 7/2 ] ]
gap> fm := FactorOutGcdNP(m);
fail
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-MulNP">
<E>Example:</E>

Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
]]></Listing>

The function <C>MulNP</C> multiplies the two polynomials.
<Listing><![CDATA[
gap> PrintNP(MulNP(p1,p2));
 a^2bab^2 - ab^2 - a^2b + 1
]]></Listing>


The fact that this multiplication is not commutative is illustrated by
the following comparison, using <C>MulNP</C> twice and <C>AddNP</C> once.
<Listing><![CDATA[
gap> PrintNP(AddNP(MulNP(p1,p2),MulNP(p2,p1),1,-1));
 - ab^2a^2b + a^2bab^2
]]></Listing>

<#/GAPDoc>



<#GAPDoc Label="example-StrongNormalFormNP">
<E>Example:</E>

Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
]]></Listing>
The strong normal form of the polynomial
<Listing><![CDATA[
gap> p := [[[1,1,1,2],[2,1],[]],[1,-1,3]];;
]]></Listing>
with respect to the list <C>[p1,p2]</C>
is computed by use of the function <C>StrongNormalFormNP</C>:
<Listing><![CDATA[
gap> PrintNP(StrongNormalFormNP(p,[p1,p2]));
 - ba + a + 3
]]></Listing>
<#/GAPDoc>


<#GAPDoc Label="example-Grobner">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
gap> PrintNPList([p1,p2]);
 a^2b - 1
 ab^2 - 1
]]></Listing>


Their Gröbner basis can be computed by the function <C>Grobner</C>.
<Listing><![CDATA[
gap> G := Grobner([p1,p2]);;
gap> PrintNPList(G);
 b - a
 a^3 - 1
]]></Listing>

One iteration of the Gröbner computations is invoked by use of the parameter
<C>max</C>:
<Listing><![CDATA[
gap> R := Grobner([p1,p2],1);;
gap> PrintNPList(R.G);
 b - a
gap> PrintNPList(R.todo);
 a^3 - 1
gap> R.iterations;
1
gap> R.completed;
false
]]></Listing>

The above list <C>R.todo</C> can be used to resume the computation
of the Gröbner basis computation with the  Gröbner pair
<C>R.G</C>, <C>R.todo</C>:
<Listing><![CDATA[
gap> PrintNPList(Grobner(R.G,R.todo));
 b - a
 a^3 - 1
]]></Listing>

In order to perform
the Gröbner basis computation with polynomials in
a free algebra over the field <M>GF(2)</M>, the coefficients
of the polynomials need to be defined over that field.

<Listing><![CDATA[
gap> PrintNPList(Grobner([[p1[1],One(GF(2))*p1[2]],[p2[1],One(GF(2))*p1[2]]]));
 b + a
 a^3 + Z(2)^0
]]></Listing>


<#/GAPDoc>


<#GAPDoc Label="example-SGrobner">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
gap> PrintNPList([p1,p2]);
 a^2b - 1
 ab^2 - 1
]]></Listing>


Their Gröbner basis can be computed by the function <C>Grobner</C>.
<Listing><![CDATA[
gap> G := SGrobner([p1,p2]);;
gap> PrintNPList(G);
 b - a
 a^3 - 1
]]></Listing>

One iteration of the Gröbner computations is invoked by use of the parameter
<C>max</C>:
<Listing><![CDATA[
gap> R := SGrobner([p1,p2],1);;
gap> PrintNPList(R.G);
 b - a
gap> PrintNPList(R.todo);
 a^3 - 1
gap> R.iterations;
1
gap> R.completed;
false
]]></Listing>

The above list <C>R.todo</C> can be used to resume the computation
of the Gröbner basis computation with the  Gröbner pair
<C>R.G</C>, <C>R.todo</C>:
<Listing><![CDATA[
gap> PrintNPList(SGrobner(R.G,R.todo));
 b - a
 a^3 - 1
]]></Listing>
<#/GAPDoc>


<#GAPDoc Label="example-BaseQA">
<E>Example:</E>
Consider the following Gröbner basis.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
gap> G := Grobner([p1,p2]);;
gap> PrintNPList(G);
 b - a
 a^3 - 1
]]></Listing>
The function <C>BaseQA</C> computes a basis for the
quotient algebra of the free algebra over the rationals
with generators <M>a</M> and <M>b</M>
by the two-sided ideal generated by <C>G</C>.
<Listing><![CDATA[
gap> PrintNPList(G);
 b - a
 a^3 - 1
gap> BaseQA(G,2,0);
[ [ [ [  ] ], [ 1 ] ], [ [ [ 1 ] ], [ 1 ] ], [ [ [ 1, 1 ] ], [ 1 ] ] ]
gap> PrintNPList(BaseQA(G,2,0));
 1
 a
 a^2
]]></Listing>

It is necessary for a correct result that the first argument
be a Gröbner basis, as will be clear from the following invocation
of <C>BaseQA</C>.
<Listing><![CDATA[
gap> PrintNPList(BaseQA([p1,p2],2,10));
 1
 a
 b
 a^2
 ab
 ba
 b^2
 a^3
 aba
 ba^2
 bab
 b^2a
 b^3
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-DimQA">
<E>Example:</E>
Consider the following Gröbner basis.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-2]];;
gap> p2 := [[[1,2,2],[]],[1,-2]];;
gap> G := Grobner([p1,p2]);;
gap> PrintNPList(G);
 b - a
 a^3 - 2
]]></Listing>
The function <C>DimQA</C> computes the dimension of the
quotient algebra of the free algebra over the rationals
with generators <M>a</M> and <M>b</M>
by the two-sided ideal generated by <C>G</C>.
<Listing><![CDATA[
gap> DimQA(G,2);
3
]]></Listing>
<#/GAPDoc>


<#GAPDoc Label="example-MulQA">
<E>Example:</E>
Consider the following Gröbner basis.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
gap> G := Grobner([p1,p2]);;
gap> PrintNPList(G);
 b - a
 a^3 - 1
]]></Listing>

Print the product in the quotient algebra of the polynomials
<M>a-2</M> and <M>b-3</M> by use of <C>MulQA</C>:
<Listing><![CDATA[
gap> s1 := [[[1],[]],[1,-2]];;
gap> s2 := [[[2],[]],[1,-3]];;
gap> PrintNP(MulQA(s1,s2,G));
 a^2 - 5a + 6
]]></Listing>

The result should be equal to the strong normal form of
the product of <M>a-2</M> and <M>b-3</M> with respect to
<C>G</C>:
<Listing><![CDATA[
gap> MulQA(s1,s2,G) = StrongNormalFormNP(MulNP(s1,s2),G);
true
]]></Listing>


<#/GAPDoc>

<#GAPDoc Label="example-IsStrongGrobnerBasis">
<E>Example:</E>
Consider the following list of two polynomials in NP format.
<Listing><![CDATA[
gap> Lnp := [[[[1,1,2],[]],[1,-1]], [[[1,2,2],[]],[1,-1]]];;
gap> PrintNPList(Lnp);
 a^2b - 1
 ab^2 - 1
]]></Listing>
The function <C>IsStrongGrobner</C> checks whether the list is a
strong Gröbner basis.
<Listing><![CDATA[
gap> IsStrongGrobnerBasis(Lnp);
false
]]></Listing>

But the answer should be <C>true</C> for the result of a
strong Gröbner computation:
<Listing><![CDATA[
gap> IsStrongGrobnerBasis(SGrobner(Lnp));
true
]]></Listing>

A Gröbner basis that is not a strong Gröbner basis:
<Listing><![CDATA[
gap> B := SGrobner(Lnp);;
gap> Add(B,AddNP(Lnp[1],B[1],1,-1));;
gap> PrintNPList(B);
 b - a
 a^3 - 1
 a^2b - b + a - 1
gap> IsGrobnerBasis(B);
true
gap> IsStrongGrobnerBasis(B);
false
]]></Listing>
<#/GAPDoc>


<#GAPDoc Label="example-IsGrobnerBasis">
<E>Example:</E>
Consider the following list of two polynomials in NP format.
<Listing><![CDATA[
gap> Lnp := [[[[1,1,2],[]],[1,-1]], [[[1,2,2],[]],[1,-1]]];;
gap> PrintNPList(Lnp);
 a^2b - 1
 ab^2 - 1
]]></Listing>
The function <C>IsGrobner</C> checks whether the list is a
 Gröbner basis.
<Listing><![CDATA[
gap> IsGrobnerBasis(Lnp);
false
]]></Listing>

So the answer should be <C>true</C> for the result of a
Gröbner computation:
<Listing><![CDATA[
gap> IsGrobnerBasis(Grobner(Lnp));
true
]]></Listing>

<#/GAPDoc>

<#GAPDoc Label="example-IsGrobnerPair">
<E>Example:</E>
Consider the following four polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
gap> q1 := [[[2],[1]],[1,-1]];;
gap> q2 := [[[1,1,1],[]],[1,-1]];;
]]></Listing>
The function <C>IsGrobnerPair</C> is used to check whether
some combinations of these polynomials in two lists provide
 Gröbner pairs.
<Listing><![CDATA[
gap> IsGrobnerPair([p1,p2,q1],[q2]);
true
gap> IsGrobnerPair([q1,q2],[p1,p2]);
false
]]></Listing>

The function <C>IsGrobnerPair</C> applied with an empty list
as second argument is a check whether the first argument is a
 Gröbner basis.
<Listing><![CDATA[
gap> IsGrobnerPair([p1,p2],[]) = IsGrobnerBasis([p1,p2]);
true
]]></Listing>

<#/GAPDoc>

<#GAPDoc Label="example-MakeGrobnerPair">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
]]></Listing>

The function <C>MakeGrobnerPair</C> turns the list with these
two polynomials into a Gröbner pair, once the empty list is added as a
second argument.
The result is a record whose fields <C>G</C> and <C>todo</C>
<Listing><![CDATA[
gap> GP := MakeGrobnerPair([p1,p2],[]);;
gap> PrintNPList(GP.G);
 a^2b - 1
 ab^2 - 1
gap> PrintNPList(GP.todo);
 b - a
]]></Listing>

These fields are ready for use in <C>Grobner</C>
<Listing><![CDATA[
gap> GB := Grobner(GP.G,GP.todo);;
gap> PrintNPList(GB);
 b - a
 a^3 - 1
]]></Listing>



<#/GAPDoc>


<#GAPDoc Label="example-StrongNormalFormNPM">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
gap> PrintNPList([p1,p2]);
 a^2b - 1
 ab^2 - 1
]]></Listing>

Consider also the following two vectors in NPM format.
<Listing><![CDATA[
gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
gap> PrintNPList([v1,v2]);
[ ab - 1 , 0]
[ 0, b^2 - 2 ]
]]></Listing>

The Gröbner basis record for this data is found by
<Ref Func="SGrobnerModule" Style="Text"/>:
<Listing><![CDATA[
gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
gap> PrintNPList(GBR.ts);
 b - a
 a^3 - 1
gap> PrintNPList(GBR.p);
[ 0, 1 ]
[ a - 1 , 0]
]]></Listing>

The vector <C>w</C> is brought into strong normal form
with respect to <C>GBR</C>:
<Listing><![CDATA[
gap> w := [[[-1,2],[-2,1]],[1,-4]];;
gap> PrintNP(w);
[ b , - 4a ]
gap> v := StrongNormalFormNPM(w,GBR);;
gap> PrintNP(v);
[ 1 , 0]
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-SGrobnerModule">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-2]];;
gap> p2 := [[[1,2,2],[]],[1,-3]];;
]]></Listing>

Consider also the following two vectors in NPM format.
<Listing><![CDATA[
gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
]]></Listing>

The Gröbner basis record for this data is found by
<Ref Func="SGrobnerModule" Style="Text"/>:
<Listing><![CDATA[
gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
]]></Listing>

The record <C>GBR</C> has two fields, <C>p</C> for prefix relations (vectors
in the module)
and <C>ts</C> for two-sided relations (polynomials in the algebra):
<Listing><![CDATA[
gap> PrintNPList(GBR.p);
[ 0, 1 ]
[ 1 , 0]
gap> PrintNPList(GBR.ts);
 b - 3/2a
 a^3 - 4/3
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-MulQM">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[1,2,2],[]],[1,-1]];;
gap> PrintNPList([p1,p2]);
 a^2b - 1
 ab^2 - 1
]]></Listing>

Consider also the following two vectors in NPM format.
<Listing><![CDATA[
gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
gap> PrintNPList([v1,v2]);
[ ab - 1 , 0]
[ 0, b^2 - 2 ]
]]></Listing>

The Gröbner basis record for this data is found by
<Ref Func="SGrobnerModule" Style="Text"/>:
<Listing><![CDATA[
gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
gap> PrintNPList(GBR.ts);
 b - a
 a^3 - 1
gap> PrintNPList(GBR.p);
[ 0, 1 ]
[ a - 1 , 0]
]]></Listing>


The function <C>MulQM</C> computes the product of the
vector <C>w</C> with the polynomial <C>q</C>.
<Listing><![CDATA[
gap> w := [[[-1,2],[-2,1]],[1,-4]];;
gap> PrintNP(w);
[ b , - 4a ]
gap> q := [[[2,2,1],[1]],[2,3]];;
gap> PrintNP(q);
 2b^2a + 3a
gap> wq := MulQM(w,q,GBR);;
gap> PrintNP(wq);
[ 5 , 0]
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-BaseQM">
<E>Example:</E>
Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,2,1],[]],[1,-1]];;
]]></Listing>



Consider also the following two vectors in NPM format.
<Listing><![CDATA[
gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
]]></Listing>

The Gröbner basis record for this data is found by
<Ref Func="SGrobnerModule" Style="Text"/>:
<Listing><![CDATA[
gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
gap> PrintNPList(GBR.ts);
 ba - ab
 b^2 - a^2
 a^3b - 1
 a^5 - b
gap> PrintNPList(GBR.p);
[ 0, 1 ]
[ b - a , 0]
[ a^2 - 1 , 0]
[ ab - 1 , 0]
]]></Listing>



The function <C>BaseQM</C> computes a basis.
<Listing><![CDATA[
gap> B := BaseQM(GBR,2,2,0);;
gap> PrintNPList(B);
[ 1 , 0]
[ a , 0]
]]></Listing>

The function <C>BaseQM</C> with arguments so as to let the
number of dimensions of the module and the number of variables be chosen minimal.
<Listing><![CDATA[
gap> B := BaseQM(GBR,0,0,0);;
gap> PrintNPList(B);
[ 1 , 0]
[ a , 0]
]]></Listing>

The function <C>BaseQM</C> can also be used to ompute the first three elements of a basis.
<Listing><![CDATA[
gap> B := BaseQM(GBR,2,2,3);;
gap> PrintNPList(B);
[ 1 , 0]
[ a , 0]
]]></Listing>


<#/GAPDoc>

<#GAPDoc Label="example-DimQM">
<E>Example:</E>


Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,2,1],[]],[1,-1]];;
]]></Listing>



Consider also the following two vectors in NPM format.
<Listing><![CDATA[
gap> v1 := [[[-1,1,2],[-2]],[1,-1]];;
gap> v2 := [[[-2,2,2],[-1]],[1,-2]];;
]]></Listing>

The Gröbner basis record for this data is found by
<Ref Func="SGrobnerModule" Style="Text"/>:
<Listing><![CDATA[
gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
]]></Listing>


The function <C>DimQM</C> computes the dimension over the rationals
of the quotient of the free module over the free algebra on two generators
by the submodule generated by the vectors <C>v1</C>, <C>v2</C>,
<M>[p,q]</M>, where <M>p</M> and <M>q</M> run over all elements of
the two-sided ideal in the free algebra generated by <C>p1</C> and <C>p2</C>.
<Listing><![CDATA[
gap> SetInfoLevel(InfoGBNP,2);
gap> DimQM(GBR,2,2);
0
]]></Listing>

The answer should be equal to the size of <C>BaseQM(GBR,t,mt,0)</C>.

<Listing><![CDATA[
gap> DimQM(GBR,2,2) = Length(BaseQM(GBR,2,2,0));
true
gap> SetInfoLevel(InfoGBNP,0);
]]></Listing>
<#/GAPDoc>



<#GAPDoc Label="example-MatrixQA">
<E>Example:</E>

Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,2,1],[]],[1,-1]];;
]]></Listing>

The matrix of right multiplication by the first indeterminate <M>a</M>
on the quotient algebra with respect to the ideal generated by
<C>p1</C> and <C>p2</C> is obtained by applying <C>MatrixQA</C>
to the Gröbner basis of these generators and a basis of the quotient
algebra as found in
<Ref Func="BaseQA" Style="Text"/>:
<Listing><![CDATA[
gap> GB := Grobner([p1,p2]);;
gap> B := BaseQA(GB,2,0);;
gap> PrintNPList(B);
 1
 a
 b
 a^2
 ab
 a^3
 a^2b
 a^4
gap> Display(MatrixQA(1, B,GB));
[ [  0,  1,  0,  0,  0,  0,  0,  0 ],
  [  0,  0,  0,  1,  0,  0,  0,  0 ],
  [  0,  0,  0,  0,  1,  0,  0,  0 ],
  [  0,  0,  0,  0,  0,  1,  0,  0 ],
  [  0,  0,  0,  0,  0,  0,  1,  0 ],
  [  0,  0,  0,  0,  0,  0,  0,  1 ],
  [  1,  0,  0,  0,  0,  0,  0,  0 ],
  [  0,  0,  1,  0,  0,  0,  0,  0 ] ]
]]></Listing>

The function is also applicable to Gröbner basis records for
modules. Consider the following two vectors.
<Listing><![CDATA[
gap> v1 := [[[-1,1,2],[-1]],[1,-1]];;
gap> v2 := [[[-2,2,2],[-2]],[1,-2]];;
]]></Listing>

The Gröbner basis record for this data is found by
<Ref Func="SGrobnerModule" Style="Text"/> and a quotient module basis
by <Ref Func="BaseQM" Style="Text"/>:
<Listing><![CDATA[
gap> GBR := SGrobnerModule([v1,v2],[p1,p2]);;
gap> B := BaseQM(GBR,2,2,0);;
]]></Listing>

The matrix of right multiplication by <M>a</M>, the first generator
of the free algebra, is
<Listing><![CDATA[
gap> Display(MatrixQA(1,B,GBR));
[ [  0,  1 ],
  [  1,  0 ] ]
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-MatricesQA">
<E>Example:</E>

Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,2,1],[]],[1,-1]];;
]]></Listing>

The function <C>MatricesQA</C> gives the list of matrices
found by <Ref Func="MatrixQA" Style="Text"/>
when the first argument takes the integer values
between 1 and the number of all algebra generators.

<Listing><![CDATA[
gap> GB := Grobner([p1,p2]);;
gap> B := BaseQA(GB,2,0);;
gap> mats := MatricesQA(2,B,GB);;
gap> for mat in mats do Display(mat); Print("\n"); od;
[ [  0,  1,  0,  0,  0,  0,  0,  0 ],
  [  0,  0,  0,  1,  0,  0,  0,  0 ],
  [  0,  0,  0,  0,  1,  0,  0,  0 ],
  [  0,  0,  0,  0,  0,  1,  0,  0 ],
  [  0,  0,  0,  0,  0,  0,  1,  0 ],
  [  0,  0,  0,  0,  0,  0,  0,  1 ],
  [  1,  0,  0,  0,  0,  0,  0,  0 ],
  [  0,  0,  1,  0,  0,  0,  0,  0 ] ]

[ [  0,  0,  1,  0,  0,  0,  0,  0 ],
  [  0,  0,  0,  0,  1,  0,  0,  0 ],
  [  0,  0,  0,  1,  0,  0,  0,  0 ],
  [  0,  0,  0,  0,  0,  0,  1,  0 ],
  [  0,  0,  0,  0,  0,  1,  0,  0 ],
  [  1,  0,  0,  0,  0,  0,  0,  0 ],
  [  0,  0,  0,  0,  0,  0,  0,  1 ],
  [  0,  1,  0,  0,  0,  0,  0,  0 ] ]

]]></Listing>

The result is also obtainable by use of the List function:
<Listing><![CDATA[
gap> MatricesQA(2,B,GB) = List([1,2], q -> MatrixQA(q,B,GB));
true
]]></Listing>

<#/GAPDoc>



<#GAPDoc Label="example-MatrixQAC">
<E>Example:</E>

Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> F := GF(256);
GF(2^8)
gap> z := GeneratorsOfField(F)[1];
Z(2^8)
gap> p1 := [[[1,1,1,2],[]],[z,1]];;
gap> p2 := [[[2,2,2,1],[]],[1,z]];;
]]></Listing>

The polynomials <C>p1</C> and  <C>p2</C> have coefficients in
the field <C>F</C> of order 256.
The matrix of right multiplication by the first indeterminate <M>a</M>
on the quotient algebra is obtained by applying <C>MatrixQAC</C>
just like <Ref Func="MatrixQA" Style="Text"/>. The difference is
that the result is in another format.
<Listing><![CDATA[
gap> GB := Grobner([p1,p2]);
[ [ [ [ 1, 1, 1, 2 ], [  ] ], [ Z(2)^0, Z(2^8)^254 ] ],
  [ [ [ 2, 2 ], [ 1, 1 ] ], [ Z(2)^0, Z(2^8)^2 ] ],
  [ [ [ 2, 1 ], [ 1, 2 ] ], [ Z(2)^0, Z(2)^0 ] ],
  [ [ [ 1, 1, 1, 1, 1 ], [ 2 ] ], [ Z(2)^0, Z(2^8)^252 ] ] ]
gap> B := BaseQA(GB,2,0);
[ [ [ [  ] ], [ Z(2)^0 ] ], [ [ [ 1 ] ], [ Z(2)^0 ] ],
  [ [ [ 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1 ] ], [ Z(2)^0 ] ],
  [ [ [ 1, 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 1 ] ], [ Z(2)^0 ] ],
  [ [ [ 1, 1, 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 1, 1 ] ], [ Z(2)^0 ] ] ]
gap> MatrixQAC(1, B,GB);
< mutable compressed matrix 8x8 over GF(256) >
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-MatricesQAC">
<E>Example:</E>

Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> F := GF(256);
GF(2^8)
gap> z := GeneratorsOfField(F)[1];
Z(2^8)
gap> p1 := [[[1,1,1,2],[]],[z,1]];;
gap> p2 := [[[2,2,2,1],[]],[1,z]];;
]]></Listing>

The polynomials <C>p1</C> and  <C>p2</C> have coefficients in
the field <C>F</C> of order 256.
The matrices of right multiplication by the indeterminates
on the quotient algebra  are just like for
<Ref Func="MatricesQA" Style="Text"/> except for the format of the result.
<Listing><![CDATA[
gap> GB := Grobner([p1,p2]);
[ [ [ [ 1, 1, 1, 2 ], [  ] ], [ Z(2)^0, Z(2^8)^254 ] ],
  [ [ [ 2, 2 ], [ 1, 1 ] ], [ Z(2)^0, Z(2^8)^2 ] ],
  [ [ [ 2, 1 ], [ 1, 2 ] ], [ Z(2)^0, Z(2)^0 ] ],
  [ [ [ 1, 1, 1, 1, 1 ], [ 2 ] ], [ Z(2)^0, Z(2^8)^252 ] ] ]
gap> B := BaseQA(GB,2,0);
[ [ [ [  ] ], [ Z(2)^0 ] ], [ [ [ 1 ] ], [ Z(2)^0 ] ],
  [ [ [ 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1 ] ], [ Z(2)^0 ] ],
  [ [ [ 1, 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 1 ] ], [ Z(2)^0 ] ],
  [ [ [ 1, 1, 2 ] ], [ Z(2)^0 ] ], [ [ [ 1, 1, 1, 1 ] ], [ Z(2)^0 ] ] ]
gap> MatricesQAC(2,B,GB);
[ < mutable compressed matrix 8x8 over GF(256) >,
  < mutable compressed matrix 8x8 over GF(256) > ]
]]></Listing>

<#/GAPDoc>



<#GAPDoc Label="example-PreprocessAnalysisQA">
<E>Example:</E>

Consider the following two polynomials in NP format of which a Gröbner
basis is computed.
<Listing><![CDATA[
F := GF(256);
z := GeneratorsOfField(F)[1];
gap> p1 := [[[1,1,1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,2,1,1,1],[]],[1,-1]];;
gap> GB := Grobner([p1,p2]);;
gap> PrintNPList(GB);
 a^4b - 1
 ba - ab
 b^2 - a
 a^5 - b
]]></Listing>

Application of <C>PreprocessAnalysisQA</C> is carried out on the leading terms of
<C>GB</C>, with 2, 4, 8, recursions, respectively.
<Listing><![CDATA[
gap> L := LMonsNP(GB);
[ [ 1, 1, 1, 1, 2 ], [ 2, 1 ], [ 2, 2 ], [ 1, 1, 1, 1, 1 ] ]
gap> L1 := PreprocessAnalysisQA(L,2,2);
[ [ 1, 1, 1 ], [ 2, 1 ], [ 1, 1, 2 ], [ 2, 2 ] ]
gap> L2 := PreprocessAnalysisQA(L1,2,4);
[ [ 1 ], [ 2 ] ]
]]></Listing>

<#/GAPDoc>




<#GAPDoc Label="example-EvalTrace">
<E>Example:</E>


First we compute the
traced Gröbner basis
of the list of the
following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,1],[]],[1,-1]];;
gap> Lnp := [p1,p2];;
gap> GBT := SGrobnerTrace(Lnp);;
]]></Listing>

In order to check that the polynomials in <C>GBT</C> belong to the ideal
generated by <C>p1</C> and <C>p2</C>, we evaluate the trace.
For each traced polynomial <C>p</C> in <C>GBT</C>,
the polynomial <C>p.pol</C> is equated to the evaluated expression
<C>p.trace</C>,
in which each occurrence of <C>G(i)</C> is replaced by <C>Lnp[i]</C>
by  use of <Ref Func="EvalTrace" Style="Text"/>.

<Listing><![CDATA[
gap> ForAll(GBT,q -> EvalTrace(q,Lnp) = q.pol);
true
]]></Listing>

<#/GAPDoc>



<#GAPDoc Label="example-SGrobnerTrace">
<E>Example:</E>

For the list of the
following two polynomials in NP format, a traced Gröbner
basis is computed.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,1],[]],[1,-1]];;
gap> GBT := SGrobnerTrace([p1,p2]);
[ rec( pol := [ [ [ 2 ], [ 1 ] ], [ 1, -1 ] ],
      trace := [ [ [  ], 1, [ 2, 1, 1, 2 ], -1 ], [ [ 2 ], 1, [  ], -1 ],
          [ [ 1 ], 1, [  ], 1 ], [ [ 1, 1 ], 2, [ 1, 2 ], 1 ] ] ),
  rec( pol := [ [ [ 1, 1, 1 ], [  ] ], [ 1, -1 ] ],
      trace := [ [ [ 2 ], 1, [ 2, 1 ], 1 ], [ [  ], 1, [ 2, 1, 1 ], 1 ],
          [ [  ], 2, [  ], 1 ], [ [ 2, 1, 1 ], 2, [  ], -1 ],
          [ [ 1, 1 ], 2, [ 1 ], -1 ] ] ) ]
]]></Listing>

<#/GAPDoc>



<#GAPDoc Label="example-StrongNormalFormTraceDiff">
<E>Example:</E>

First we compute the
traced Gröbner basis
of the list of the
following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,1],[]],[1,-1]];;
gap> GBT := SGrobnerTrace([p1,p2]);;
]]></Listing>


Of the polynomial <M>a^6</M> we compute its
difference with the normal form.
The result is printed by used of <Ref Func="PrintNP" Style="Text"/>
and  <Ref Func="PrintTraceList" Style="Text"/>.
<Listing><![CDATA[
gap> f := [[[1,1,1,1,1,1]],[1]];;
gap> sf := StrongNormalFormTraceDiff(f,GBT);;
gap> PrintNP(sf.pol);
 a^6 - 1
gap> PrintTraceList([sf]);
 G(1)ba^2 + bG(1)ba + G(1)ba^5 + bG(1)ba^4 + G(2) + G(2)a^3 - a^2G(
2)a - ba^2G(2) - a^2G(2)a^4 - ba^2G(2)a^3
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-SGrobnerTrunc">
<E>Example:</E>

Consider the
following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
gap> PrintNPList([p1,p2]);
 ab^2a - ba^2b
 b^3 - a^2
]]></Listing>


These are homogeneous with respect to weights <M>[3,2]</M>.
The degrees are <M>10</M> and <M>6</M>, respectively.
The Gröbner basis truncated above degree 12 of the list <C>[p1,p2]</C>
is computed and subsequently printed as follows.

<Listing><![CDATA[
gap> PrintNPList(SGrobnerTrunc([p1,p2],12,[3,2]));
 ba^2 - a^2b
 b^3 - a^2
 ab^2a - a^2b^2
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-CheckHomogeneousNPs">
<E>Example:</E>

Consider the
following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
gap> PrintNPList([p1,p2]);
 ab^2a - ba^2b
 b^3 - a^2
]]></Listing>


These are homogeneous with respect to weights <M>[3,2]</M>.
The degrees are <M>10</M> and <M>6</M>, respectively.
This is checked as follows.

<Listing><![CDATA[
gap> CheckHomogeneousNPs([p1,p2],[3,2]);
[ 10, 6 ]
]]></Listing>

<#/GAPDoc>



<#GAPDoc Label="example-BaseQATrunc">
<E>Example:</E>

Consider the truncated Gröbner basis
of the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
gap> wtv := [3,2];;
gap> GB := SGrobnerTrunc([p1,p2],12,wtv);;
gap> GBNP.ConfigPrint("a","b");
gap> PrintNPList(GB);
 ba^2 - a^2b
 b^3 - a^2
 ab^2a - a^2b^2
]]></Listing>


A basis of standard monomials is found and printed as follows.

<Listing><![CDATA[
gap> BT := BaseQATrunc(GB,12,wtv);;
gap> for degpart in BT do
>   for mon in degpart do PrintNP([[mon],[1]]); od;
> od;
 1
 b
 a
 b^2
 ba
 ab
 a^2
 b^3
 b^2a
 bab
 ab^2
 aba
 a^2b
 b^4
 a^3
 b^3a
 b^2ab
 bab^2
 ab^3
 baba
 abab
 a^2b^2
 b^5
 a^2ba
 b^4a
 a^3b
 b^3ab
 b^2ab^2
 bab^3
 ab^4
 a^4
 b^2aba
 ab^3a
 babab
 abab^2
 a^2b^3
 b^6
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-DimsQATrunc">
<E>Example:</E>

Consider the truncated Gröbner basis
of the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
gap> wtv := [3,2];;
gap> GB := SGrobnerTrunc([p1,p2],12,wtv);;
]]></Listing>


Information on the dimensions of the homogeneous parts
of the quotient algebra is found as follows,

<Listing><![CDATA[
gap> DimsQATrunc(GB,12,wtv);
[ 1, 0, 1, 1, 1, 2, 2, 3, 3, 5, 4, 7, 7 ]
]]></Listing>

<#/GAPDoc>


<#GAPDoc Label="example-FreqsQATrunc">
<E>Example:</E>

Consider the truncated Gröbner basis
of the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,2,2,1],[2,1,1,2]],[1,-1]];;
gap> p2 := [[[2,2,2],[1,1]],[1,-1]];;
gap> wtv := [3,2];;
gap> GB := SGrobnerTrunc([p1,p2],12,wtv);;
gap> PrintNPList(GB);
 ba^2 - a^2b
 b^3 - a^2
 ab^2a - a^2b^2
]]></Listing>


The multiplicities of the frequencies of
of monomials in a standard basis
of the quotient algebra with respect to the ideal generated by
<C>GB</C> is found as follows, for weights up to and including 8.

<Listing><![CDATA[
gap> F := FreqsQATrunc(GB,8,wtv);
[ [ [ [  ], 1 ] ], [ [ [ 0, 1 ], 1 ] ], [ [ [ 1, 0 ], 1 ] ],
  [ [ [ 0, 2 ], 1 ] ], [ [ [ 1, 1 ], 2 ] ],
  [ [ [ 2, 0 ], 1 ], [ [ 0, 3 ], 1 ] ], [ [ [ 1, 2 ], 3 ] ],
  [ [ [ 2, 1 ], 2 ], [ [ 0, 4 ], 1 ] ] ]
]]></Listing>

The interpretation of this data is given by the following lines of code.

<Listing><![CDATA[
gap> for f in F do
>   if f[1][1] <> [] then
>     Print("At level ", wtv * (f[1][1]), " the multiplicities are\n");
>     for x in f do
>       Print(" for ",x[1],": ",x[2],"\n");
>     od;
>   else
>     Print("At level ", 0 , " the multiplicity of [] is ",f[1][2],"\n");
>   fi;
>   Print("\n");
> od;
At level 0 the multiplicity of [] is 1

At level 2 the multiplicities are
  for [ 0, 1 ]: 1

At level 3 the multiplicities are
  for [ 1, 0 ]: 1

At level 4 the multiplicities are
  for [ 0, 2 ]: 1

At level 5 the multiplicities are
  for [ 1, 1 ]: 2

At level 6 the multiplicities are
  for [ 2, 0 ]: 1
  for [ 0, 3 ]: 1

At level 7 the multiplicities are
  for [ 1, 2 ]: 3

At level 8 the multiplicities are
  for [ 2, 1 ]: 2
  for [ 0, 4 ]: 1

]]></Listing>


<#/GAPDoc>




<#GAPDoc Label="example-PrintTraceList">
<E>Example:</E>

First we compute the
traced Gröbner basis
of the list of two polynomials in NP format and next we print it
by use of <C>PrintTraceList</C>.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,1],[]],[1,-1]];;
gap> GBT := SGrobnerTrace([p1,p2]);;
gap> PrintTraceList(GBT);
 aG(1) - bG(1) - G(1)ba^2b + a^2G(2)ab

 G(1)ba^2 + bG(1)ba + G(2) - a^2G(2)a - ba^2G(2)
]]></Listing>
<#/GAPDoc>





<#GAPDoc Label="example-PrintTracePol">
<E>Example:</E>

First we compute the
traced Gröbner basis
of the list of two polynomials in NP format. Next we print
the trace polynomial of the members of the list
by use of <C>PrintTracePol</C>.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,1],[]],[1,-1]];;
gap> GBT := SGrobnerTrace([p1,p2]);;
gap> for np in GBT do PrintTracePol(np); Print("\n"); od;
 aG(1) - bG(1) - G(1)ba^2b + a^2G(2)ab

 G(1)ba^2 + bG(1)ba + G(2) - a^2G(2)a - ba^2G(2)

]]></Listing>
<#/GAPDoc>


<#GAPDoc Label="example-PrintNPListTrace">
<E>Example:</E>

First we compute the
traced Gröbner basis
of the list of two polynomials in NP format.
Next we print the polynomials found
by use of <C>PrintNPListTrace</C>.
<Listing><![CDATA[
gap> p1 := [[[1,1,2],[]],[1,-1]];;
gap> p2 := [[[2,2,1],[]],[1,-1]];;
gap> GBT := SGrobnerTrace([p1,p2]);;
gap> PrintNPListTrace(GBT);
 b - a
 a^3 - 1
]]></Listing>
<#/GAPDoc>





<#GAPDoc Label="example-DetermineGrowthQA">
<E>Example:</E>

For the list of monomials consisting of a single variable in a free algebra
generated by two variables the growth is clearly polynomial of degree 1.
This is verified by invoking <C>DetermineGrowthQA</C> with arguments
<C>[[1]]</C>
(the list of the single monomial consisting of the first variable),
the number of generators of the free algebra to which the monomials belong
(which is 2 here),
and the boolean <C>true</C> indicating that we wish a precise degree
in case of polynomial growth.


<Listing><![CDATA[
gap> DetermineGrowthQA([[1]],2,true);
1
]]></Listing>

Here is an example of polynomial growth of degree 2:


<Listing><![CDATA[
gap> L := [[1,2,1],[2,2,1]];
[ [ 1, 2, 1 ], [ 2, 2, 1 ] ]
gap> DetermineGrowthQA(L,2,true);
2
]]></Listing>


In order to show how to apply the function
to arbitrary polynomials, consider
the following two polynomials in NP format.

<Listing><![CDATA[
gap> F := GF(256);
GF(2^8)
gap> z := GeneratorsOfField(F)[1];
Z(2^8)
gap> p1 := [[[1,1,1,2],[]],[z,1]];;
gap> p2 := [[[2,2,2,1],[]],[1,z]];;
]]></Listing>

The polynomials <C>p1</C> and  <C>p2</C> have coefficients in
the field <C>F</C> of order 256.

In order to study the growth of the quotient algebra
we first compute the list of leading monomials of
the Gröbner basis elements and next apply
<C>DetermineGrowthQA</C>.

<Listing><![CDATA[
gap> GB := Grobner([p1,p2]);;
gap> L := LMonsNP(GB);;
gap> for lm  in L  do PrintNP( [ [ lm ], [ 1 ] ] ); od;
 a^3b
 b^2
 ba
 a^5
gap> DetermineGrowthQA(L,2,true);
0
]]></Listing>


<#/GAPDoc>



<#GAPDoc Label="example-FinCheckQA">
<E>Example:</E>

Consider the following list <C>L</C> of two monomials.
<Listing><![CDATA[
gap> L := [[1,2,1],[2,2,1]];;
]]></Listing>

Finiteness of the dimension of the quotient algebra of the free algebra
by the ideal generated by these two monomials can be
decided by means of <C>FinCheckQA</C>.
Its arguments are <C>L</C> and the number of generators of the free algebra
in which the monomials reside.

<Listing><![CDATA[
gap> FinCheckQA(L,2);
false
]]></Listing>

This example turns out to be infinite dimensional.
Here is a finite-dimensional example.

<Listing><![CDATA[
gap> FinCheckQA([[1],[2,2]],2);
true
]]></Listing>



<#/GAPDoc>


<#GAPDoc Label="example-HilbertSeriesQA">
<E>Example:</E>

Consider the following list <C>L</C> of two monomials.
<Listing><![CDATA[
gap> L := [[1,2,1],[2,2,1]];;
]]></Listing>

Finiteness of the dimension of the quotient algebra of the free algebra
by the ideal generated by these two monomials can be
decided by means of <C>FinCheckQA</C>.
Its arguments are <C>L</C> and the number of generators of the free algebra
in which the monomials reside.

<Listing><![CDATA[
gap> HilbertSeriesQA(L,2,10);
[ 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 ]
]]></Listing>


This indicates that the growth may be polynomial.
<Ref Func="DetermineGrowthQA" Style="Text"/> can be used to check this.

<#/GAPDoc>

reset printing; note not inside a GAPDoc part here
<Listing><![CDATA[
gap> GBNP.ConfigPrint();
]]></Listing>

<#GAPDoc Label="example-NumAlgGensNP">
<E>Example:</E>

Consider the following polynomial in NP format.
<Listing><![CDATA[
gap> np := [[[2,2,2,1,1,1],[4],[3,2,3]],[1,-3,2]];;
gap> PrintNP(np);
 b^3a^3 - 3d + 2cbc
gap> NumAlgGensNP(np);
4
]]></Listing>
<#/GAPDoc>

<#GAPDoc Label="example-NumAlgGensNPList">
<E>Example:</E>

Consider the following two polynomials in NP format.
<Listing><![CDATA[
gap> p1 := [[[1,1,2,3,1],[2],[1]],[1,-2,1]];;
gap> p2 := [[[2,2,1,4,3],[]],[1,-1]];;
gap> PrintNPList([p1,p2]);
 a^2bca - 2b + a
 b^2adc - 1
gap> NumAlgGensNPList([p1,p2]);
4
]]></Listing>
<#/GAPDoc>


<#GAPDoc Label="example-NumModGensNP">
<E>Example:</E>

Consider the following polynomial in NPM format.
<Listing><![CDATA[
gap> np := [[[-1,1,2,3,1],[-2],[-1]],[1,-2,1]];;
gap> PrintNP(np);
[ abca + 1 , - 2 ]
gap> NumModGensNP(np);
2
]]></Listing>
<#/GAPDoc>


<#GAPDoc Label="example-NumModGensNPList">
<E>Example:</E>

Consider the following two polynomials in NPM format.
<Listing><![CDATA[
gap> v1 := [[[-1,1,2,3,1],[-2],[-1]],[1,-2,1]];;
gap> v2 := [[[-2,2,1,4,3],[-3]],[1,-1]];;
gap> PrintNPList([v1,v2]);
[ abca + 1 , - 2 ]
[ 0, badc , - 1 ]
gap> NumModGensNPList([v1,v2]);
3
]]></Listing>
<#/GAPDoc>

100%


¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.17Bemerkung:  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.