Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /usr/share/gap/doc/ref/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : //usr/share/gap/doc/ref/chap66.txt

  
  66 Polynomials and Rational Functions
  
  Let  R  be a commutative ring-with-one. We call a free associative algebra A
  over  R  a  polynomial  ring  over  R.  The  free generators of A are called
  indeterminates (to avoid naming conflicts with the word variables which will
  be  used  to  denote  GAP variables only) , they are usually denoted by x_1,
  x_2, .... The number of indeterminates is called the rank of A. The elements
  of   A  are  called  polynomials.  Products  of  indeterminates  are  called
  monomials,  every polynomial can be expressed as a finite sum of products of
  monomials  with ring elements in a form like r_{1,0} x_1 + r_{1,1} x_1 x_2 +
  r_{0,1} x_2 + ⋯ with r_{i,j} ∈ R.
  
  A  polynomial  ring  of  rank 1 is called an univariate polynomial ring, its
  elements are univariate polynomials.
  
  Polynomial rings of smaller rank naturally embed in rings of higher rank; if
  S  is  a  subring  of  R then a polynomial ring over S naturally embeds in a
  polynomial  ring  over  R  of  the same rank. Note however that GAP does not
  consider  R as a subset of a polynomial ring over R; for example the zero of
  R (0) and the zero of the polynomial ring (0x^0) are different objects.
  
  Internally,  indeterminates  are represented by positive integers, but it is
  possible  to give names to them to have them printed in a nicer way. Beware,
  however  that  there  is  not  necessarily  any  relation between the way an
  indeterminate  is  called  and  the  way it is printed. See section 66.1 for
  details.
  
  If  R  is  an  integral  domain, the polynomial ring A over R is an integral
  domain  as  well and one can therefore form its quotient field Q. This field
  is called a field of rational functions. Again A embeds naturally into Q and
  GAP  will perform this embedding implicitly. (In fact it implements the ring
  of  rational functions over R.) To avoid problems with leading coefficients,
  however, R must be a unique factorization domain.
  
  
  66.1 Indeterminates
  
  Internally,  indeterminates are created for a family of objects (for example
  all elements of finite fields in characteristic 3 are in one family). Thus a
  variable  x  over  the  rationals is also an x over the integers, while an x
  over GF(3) is different.
  
  Within  one  family,  every  indeterminate has a number nr and as long as no
  other  names  have  been  assigned,  this indeterminate will be displayed as
  x_nr. Indeterminate numbers can be arbitrary nonnegative integers.
  
  It  is  possible  to assign names to indeterminates; these names are strings
  and  only  provide  a  means  for printing the indeterminates in a nice way.
  Indeterminates that have not been assigned a name will be printed as x_nr.
  
  (Because of this printing convention, the name x_nr is interpreted specially
  to always denote the variable with internal number nr.)
  
  The  indeterminate  names  have  not  necessarily  any relations to variable
  names:  this  means  that  an  indeterminate whose name is, say, x cannot be
  accessed   using   the   variable  x,  unless  x  was  defined  to  be  that
  indeterminate.
  
  When asking for indeterminates with certain names, GAP usually will take the
  first  (with  respect to the internal numbering) indeterminates that are not
  yet  named,  name  these  accordingly  and return them. Thus when asking for
  named  indeterminates,  no  relation between names and indeterminate numbers
  can            be            guaranteed.            The            attribute
  IndeterminateNumberOfLaurentPolynomial(indet)  will return the number of the
  indeterminate indet.
  
  When  asked  to  create an indeterminate with a name that exists already for
  the  family,  GAP will by default return this existing indeterminate. If you
  explicitly  want a new indeterminate, distinct from the already existing one
  with  the  same name, you can add the new option to the function call. (This
  is in most cases not a good idea.)
  
    Example  
    gap> R:=PolynomialRing(GF(3),["x","y","z"]);
    GF(3)[x,y,z]
    gap> List(IndeterminatesOfPolynomialRing(R),
    >   IndeterminateNumberOfLaurentPolynomial);
    [ 1, 2, 3 ]
    gap> R:=PolynomialRing(GF(3),["z"]);
    GF(3)[z]
    gap> List(IndeterminatesOfPolynomialRing(R),
    >   IndeterminateNumberOfLaurentPolynomial);
    [ 3 ]
    gap> R:=PolynomialRing(GF(3),["x","y","z"]:new);
    GF(3)[x,y,z]
    gap> List(IndeterminatesOfPolynomialRing(R),
    >   IndeterminateNumberOfLaurentPolynomial);
    [ 4, 5, 6 ]
    gap> R:=PolynomialRing(GF(3),["z"]);
    GF(3)[z]
    gap> List(IndeterminatesOfPolynomialRing(R),
    >   IndeterminateNumberOfLaurentPolynomial);
    [ 3 ]
  
  
  
  66.1-1 Indeterminate
  
  Indeterminate( R[, nr] )  operation
  Indeterminate( R[, name][, avoid] )  operation
  Indeterminate( fam, nr )  operation
  X( R[, nr] )  operation
  X( R[, name][, avoid] )  operation
  X( fam, nr )  operation
  
  returns  the  indeterminate number nr over the ring R. If nr is not given it
  defaults to 1. If the number is not specified a list avoid of indeterminates
  may  be  given. The function will return an indeterminate that is guaranteed
  to  be  different  from  all the indeterminates in the list avoid. The third
  usage returns an indeterminate called name (also avoiding the indeterminates
  in avoid if given).
  
  X is simply a synonym for Indeterminate.
  
    Example  
    gap> x:=Indeterminate(GF(3),"x");
    x
    gap> y:=X(GF(3),"y");z:=X(GF(3),"X");
    y
    X
    gap> X(GF(3),2);
    y
    gap> X(GF(3),"x_3");
    X
    gap> X(GF(3),[y,z]);
    x
  
  
  66.1-2 IndeterminateNumberOfUnivariateRationalFunction
  
  IndeterminateNumberOfUnivariateRationalFunction( rfun )  attribute
  
  returns  the  number  of  the indeterminate in which the univariate rational
  function  rfun  is expressed. (This also provides a way to obtain the number
  of a given indeterminate.)
  
  A  constant  rational function might not possess an indeterminate number. In
  this  case IndeterminateNumberOfUnivariateRationalFunction will default to a
  value  of 1. Therefore two univariate polynomials may be considered to be in
  the  same  univariate  polynomial ring if their indeterminates have the same
  number  or  one  if  of  them  is  constant.  (see  alsoĀ CIUnivPols (66.1-5)
  andĀ IsLaurentPolynomialDefaultRep (66.21-7)).
  
  66.1-3 IndeterminateOfUnivariateRationalFunction
  
  IndeterminateOfUnivariateRationalFunction( rfun )  attribute
  
  returns  the indeterminate in which the univariate rational function rfun is
  expressed. (cf. IndeterminateNumberOfUnivariateRationalFunction (66.1-2).)
  
    Example  
    gap> IndeterminateNumberOfUnivariateRationalFunction(z);
    3
    gap> IndeterminateOfUnivariateRationalFunction(z^5+z);
    X
  
  
  66.1-4 IndeterminateName
  
  IndeterminateName( fam, nr )  operation
  HasIndeterminateName( fam, nr )  operation
  SetIndeterminateName( fam, nr, name )  operation
  
  SetIndeterminateName  assigns  the  name  name  to  indeterminate  nr in the
  rational  functions  family fam. It issues an error if the indeterminate was
  already named.
  
  IndeterminateName  returns  the name of the nr-th indeterminate (and returns
  fail if no name has been assigned).
  
  HasIndeterminateName   tests  whether  indeterminate  nr  has  already  been
  assigned a name.
  
    Example  
    gap> IndeterminateName(FamilyObj(x),2);
    "y"
    gap> HasIndeterminateName(FamilyObj(x),4);
    false
    gap> SetIndeterminateName(FamilyObj(x),10,"bla");
    gap> Indeterminate(GF(3),10);
    bla
  
  
  As  a  convenience there is a special method installed for SetName that will
  assign a name to an indeterminate.
  
    Example  
    gap> a:=Indeterminate(GF(3),5);
    x_5
    gap> SetName(a,"ah");
    gap> a^5+a;
    ah^5+ah
  
  
  66.1-5 CIUnivPols
  
  CIUnivPols( upol1, upol2 )  function
  
  This  function  (whose  name  stands  for common indeterminate of univariate
  polynomials)   takes  two  univariate  polynomials  as  arguments.  If  both
  polynomials  are given in the same indeterminate number indnum (in this case
  they  are  compatible  as  univariate polynomials) it returns indnum. In all
  other cases it returns fail. CIUnivPols also accepts if either polynomial is
  constant  but formally expressed in another indeterminate, in this situation
  the indeterminate of the other polynomial is selected.
  
  
  66.2 Operations for Rational Functions
  
  The rational functions form a field, therefore all arithmetic operations are
  applicable to rational functions.
  
  f + g
  
  f - g
  
  f * g
  
  f / g
  
    Example  
    gap> x:=Indeterminate(Rationals,1);;y:=Indeterminate(Rationals,2);;
    gap> f:=3+x*y+x^5;;g:=5+x^2*y+x*y^2;;
    gap> a:=g/f;
    (x_1^2*x_2+x_1*x_2^2+5)/(x_1^5+x_1*x_2+3)
  
  
  Note  that  the  quotient  f/g  of two polynomials might be represented as a
  rational  function  again.  If g is known to divide f the call Quotient(f,g)
  (seeĀ Quotient (56.1-9)) should be used instead.
  
  f mod g
  
  For  two  Laurent  polynomials  f  and g, f mod g is the Euclidean remainder
  (seeĀ EuclideanRemainder (56.6-4)) of f modulo g.
  
  As  calculating  a  multivariate  Gcd can be expensive, it is not guaranteed
  that  rational functions will always be represented as a quotient of coprime
  polynomials.  In  certain unfortunate situations this might lead to a degree
  explosion.   To  ensure  cancellation  you  can  use  Gcd  (56.7-1)  on  the
  NumeratorOfRationalFunction   (66.4-2)   and   DenominatorOfRationalFunction
  (66.4-3) values of a given rational function.
  
  All  polynomials  as  well  as  all  the  univariate polynomials in the same
  indeterminate  form  subrings  of  this field. If two rational functions are
  known  to be in the same subring, the result will be expressed as element in
  this subring.
  
  
  66.3 Comparison of Rational Functions
  
  f = g
  
  Two  rational  functions  f  and  g  are equal if the product Numerator(f) *
  Denominator(g) equals Numerator(g) * Denominator(f).
  
    Example  
    gap> x:=Indeterminate(Rationals,"x");;y:=Indeterminate(Rationals,"y");;
    gap> f:=3+x*y+x^5;;g:=5+x^2*y+x*y^2;;
    gap> a:=g/f;
    (x^2*y+x*y^2+5)/(x^5+x*y+3)
    gap> b:=(g*f)/(f^2);
    (x^7*y+x^6*y^2+5*x^5+x^3*y^2+x^2*y^3+3*x^2*y+3*x*y^2+5*x*y+15)/(x^10+2\
    *x^6*y+6*x^5+x^2*y^2+6*x*y+9)
    gap> a=b;
    true
  
  
  f < g
  
  The  ordering  of  rational functions is defined in several steps. Monomials
  (products   of   indeterminates)   are   sorted   first   by   degree,  then
  lexicographically   (with  x_1>x_2)  (seeĀ MonomialGrlexOrdering  (66.17-8)).
  Products of monomials with ring elements (terms) are compared first by their
  monomials and then by their coefficients.
  
    Example  
    gap> x>y;
    true
    gap> x^2*y<x*y^2;
    false
    gap> x*y<x^2*y;
    true
    gap> x^2*y < 5* y*x^2;
    true
  
  
  Polynomials  are  compared by comparing the largest terms in turn until they
  differ.
  
    Example  
    gap> x+y<y;
    false
    gap> x<x+1;
    true
  
  
  Rational  functions  are compared by comparing the polynomial Numerator(f) *
  Denominator(g)  with  the  polynomial Numerator(g) * Denominator(f). (As the
  ordering  of monomials used by GAP is invariant under multiplication this is
  independent of common factors in numerator and denominator.)
  
    Example  
    gap> f/g<g/f;
    false
    gap> f/g<(g*g)/(f*g);
    false
  
  
  For univariate polynomials this reduces to an ordering first by total degree
  and then lexicographically on the coefficients.
  
  
  66.4 Properties and Attributes of Rational Functions
  
  All  these tests are applicable to every rational function. Depending on the
  internal  representation  of  the  rational  function, however some of these
  tests (in particular, univariateness) might be expensive in some cases.
  
  For  reasons  of performance within algorithms it can be useful to use other
  attributes,  which  give  a  slightly  more  technical  representation.  See
  sectionĀ 66.20 for details.
  
  66.4-1 IsPolynomialFunction
  
  IsPolynomialFunction( obj )  Category
  IsRationalFunction( obj )  Category
  
  A rational function is an element of the quotient field of a polynomial ring
  over  an  UFD.  It  is  represented  as  a  quotient of two polynomials, its
  numerator  (seeĀ NumeratorOfRationalFunction  (66.4-2))  and  its denominator
  (seeĀ DenominatorOfRationalFunction (66.4-3))
  
  A polynomial function is an element of a polynomial ring (not necessarily an
  UFD), or a rational function.
  
  GAP considers IsRationalFunction as a subcategory of IsPolynomialFunction.
  
  66.4-2 NumeratorOfRationalFunction
  
  NumeratorOfRationalFunction( ratfun )  attribute
  
  returns the numerator of the rational function ratfun.
  
  As  no  proper  multivariate  gcd  has  been implemented yet, numerators and
  denominators are not guaranteed to be reduced!
  
  66.4-3 DenominatorOfRationalFunction
  
  DenominatorOfRationalFunction( ratfun )  attribute
  
  returns the denominator of the rational function ratfun.
  
  As  no  proper  multivariate  gcd  has  been implemented yet, numerators and
  denominators are not guaranteed to be reduced!
  
    Example  
    gap> x:=Indeterminate(Rationals,1);;y:=Indeterminate(Rationals,2);;
    gap> DenominatorOfRationalFunction((x*y+x^2)/y);
    y
    gap> NumeratorOfRationalFunction((x*y+x^2)/y);
    x^2+x*y
  
  
  66.4-4 IsPolynomial
  
  IsPolynomial( ratfun )  property
  
  A  polynomial  is  a  rational  function  whose  denominator is one. (If the
  coefficients  family  forms  a  field  this is equivalent to the denominator
  being constant.)
  
  If  the  base  family  is not a field, it may be impossible to represent the
  quotient  of  a  polynomial  by a ring element as a polynomial again, but it
  will have to be represented as a rational function.
  
    Example  
    gap> IsPolynomial((x*y+x^2*y^3)/y);
    true
    gap> IsPolynomial((x*y+x^2)/y);
    false
  
  
  66.4-5 AsPolynomial
  
  AsPolynomial( poly )  attribute
  
  If  poly  is a rational function that is a polynomial this attribute returns
  an  equal  rational function p such that p is equal to its numerator and the
  denominator of p is one.
  
    Example  
    gap> AsPolynomial((x*y+x^2*y^3)/y);
    x^2*y^2+x
  
  
  66.4-6 IsUnivariateRationalFunction
  
  IsUnivariateRationalFunction( ratfun )  property
  
  A  rational  function is univariate if its numerator and its denominator are
  both   polynomials   in   the   same   one   indeterminate.   The  attribute
  IndeterminateNumberOfUnivariateRationalFunction  (66.1-2)  can  be  used  to
  obtain the number of this common indeterminate.
  
  66.4-7 CoefficientsOfUnivariateRationalFunction
  
  CoefficientsOfUnivariateRationalFunction( rfun )  attribute
  
  if  rfun  is a univariate rational function, this attribute returns a list [
  ncof,  dcof,  val  ] where ncof and dcof are coefficient lists of univariate
  polynomials n and d and a valuation val such that rfun = x^val ā‹… n / d where
  x      is      the     variable     with     the     number     given     by
  IndeterminateNumberOfUnivariateRationalFunction   (66.1-2).   Numerator  and
  denominator are guaranteed to be cancelled.
  
  66.4-8 IsUnivariatePolynomial
  
  IsUnivariatePolynomial( ratfun )  property
  
  A univariate polynomial is a polynomial in only one indeterminate.
  
  66.4-9 CoefficientsOfUnivariatePolynomial
  
  CoefficientsOfUnivariatePolynomial( pol )  attribute
  
  CoefficientsOfUnivariatePolynomial  returns  the  coefficient  list  of  the
  polynomial pol, sorted in ascending order. (It returns the empty list if pol
  is 0.)
  
  66.4-10 IsLaurentPolynomial
  
  IsLaurentPolynomial( ratfun )  property
  
  A  Laurent polynomial is a univariate rational function whose denominator is
  a monomial. Therefore every univariate polynomial is a Laurent polynomial.
  
  The  attribute  CoefficientsOfLaurentPolynomial  (66.13-2)  gives  a compact
  representation as Laurent polynomial.
  
  66.4-11 IsConstantRationalFunction
  
  IsConstantRationalFunction( ratfun )  property
  
  A  constant  rational function is a function whose numerator and denominator
  are polynomials of degree 0.
  
  66.4-12 IsPrimitivePolynomial
  
  IsPrimitivePolynomial( F, pol )  operation
  
  For  a  univariate  polynomial  pol of degree d in the indeterminate X, with
  coefficients in a finite field F with q elements, say, IsPrimitivePolynomial
  returns true if
  
  1   pol divides X^{q^d-1} - 1, and
  
  2   for each prime divisor p of q^d - 1, pol does not divide X^{(q^d-1)/p}
        - 1,
  
  and false otherwise.
  
  66.4-13 SplittingField
  
  SplittingField( f )  attribute
  
  returns  the  smallest  field  which  contains the coefficients of f and the
  roots of f.
  
  
  66.5 Univariate Polynomials
  
  Some  of the operations are actually defined on the larger domain of Laurent
  polynomials  (see  66.13).  For  this section you can simply ignore the word
  Laurent if it occurs in a description.
  
  66.5-1 UnivariatePolynomial
  
  UnivariatePolynomial( ring, cofs[, ind] )  operation
  
  constructs  an univariate polynomial over the ring ring in the indeterminate
  ind with the coefficients given by coefs.
  
  66.5-2 UnivariatePolynomialByCoefficients
  
  UnivariatePolynomialByCoefficients( fam, cofs, ind )  operation
  
  constructs  an univariate polynomial over the coefficients family fam and in
  the  indeterminate  ind  with the coefficients given by coefs. This function
  should  be  used  in  algorithms to create polynomials as it avoids overhead
  associated with UnivariatePolynomial (66.5-1).
  
  66.5-3 DegreeOfLaurentPolynomial
  
  DegreeOfLaurentPolynomial( pol )  attribute
  
  The  degree of a univariate (Laurent) polynomial pol is the largest exponent
  n of a monomial x^n of pol. The degree of a zero polynomial is defined to be
  -infinity.
  
    Example  
    gap> p:=UnivariatePolynomial(Rationals,[1,2,3,4],1);
    4*x^3+3*x^2+2*x+1
    gap> UnivariatePolynomialByCoefficients(FamilyObj(1),[9,2,3,4],73);
    4*x_73^3+3*x_73^2+2*x_73+9
    gap> CoefficientsOfUnivariatePolynomial(p);
    [ 1, 2, 3, 4 ]
    gap> DegreeOfLaurentPolynomial(p);
    3
    gap> DegreeOfLaurentPolynomial(Zero(p));
    -infinity
    gap> IndeterminateNumberOfLaurentPolynomial(p);
    1
    gap> IndeterminateOfLaurentPolynomial(p);
    x
  
  
  66.5-4 RootsOfPolynomial
  
  RootsOfPolynomial( [R, ]p )  function
  
  For a univariate polynomial p, this function returns all roots of p over the
  ring  R.  If the ring is not specified, it defaults to the ring specified by
  the coefficients of p via DefaultRing (56.1-3)).
  
    Example  
    gap> x:=X(Rationals,"x");;p:=x^4-1;    
    x^4-1
    gap> RootsOfPolynomial(p);
    [ 1, -1 ]
    gap> RootsOfPolynomial(CF(4),p);
    [ 1, -1, E(4), -E(4) ]
  
  
  66.5-5 RootsOfUPol
  
  RootsOfUPol( [field, ]upol )  function
  
  This  function returns a list of all roots of the univariate polynomial upol
  in  its  default  domain. If the optional argument field is a field then the
  roots  in  this  field are computed. If field is the string "split" then the
  splitting field of the polynomial is taken.
  
    Example  
    gap> RootsOfUPol(50-45*x-6*x^2+x^3);
    [ 10, 1, -5 ]
  
  
  66.5-6 QuotRemLaurpols
  
  QuotRemLaurpols( left, right, mode )  function
  
  This  internal  function  for  euclidean  division  of polynomials takes two
  polynomials left and right and computes their quotient. No test is performed
  whether  the  arguments  indeed  are  polynomials.  Depending on the integer
  variable  mode,  which  may  take  values in a range from 1 to 4, it returns
  respectively:
  
  1   the quotient (there might be some remainder),
  
  2   the remainder,
  
  3   a list [q,r] of quotient and remainder,
  
  4   the quotient if there is no remainder and fail otherwise.
  
  66.5-7 UnivariatenessTestRationalFunction
  
  UnivariatenessTestRationalFunction( f )  function
  
  takes  a  rational  function  f  and tests whether it is univariate rational
  function  (or  even  a Laurent polynomial). It returns a list [isunivariate,
  indet, islaurent, cofs].
  
  If  f  is a univariate rational function then isunivariate is true and indet
  is the number of the appropriate indeterminate.
  
  Furthermore,  if  f is a Laurent polynomial, then islaurent is also true. In
  this   case   the  fourth  entry,  cofs,  is  the  value  of  the  attribute
  CoefficientsOfLaurentPolynomial (66.13-2) for f.
  
  If  isunivariate  is  true but islaurent is false, then cofs is the value of
  the attribute CoefficientsOfUnivariateRationalFunction (66.4-7) for f.
  
  Otherwise,  each entry of the returned list is equal to fail. As there is no
  proper  multivariate  gcd,  this  may  also happen for the rational function
  which may be reduced to univariate (see example).
  
    Example  
    gap> UnivariatenessTestRationalFunction( 50-45*x-6*x^2+x^3 );
    [ true, 1, true, [ [ 50, -45, -6, 1 ], 0 ] ]
    gap> UnivariatenessTestRationalFunction( (-6*y^2+y^3) / (y+1) );
    [ true, 2, false, [ [ -6, 1 ], [ 1, 1 ], 2 ] ]
    gap> UnivariatenessTestRationalFunction( (-6*y^2+y^3) / (x+1));
    [ false, fail, false, fail ]
    gap> UnivariatenessTestRationalFunction( ((y+2)*(x+1)) / ((y-1)*(x+1)) );
    [ fail, fail, fail, fail ]
  
  
  66.5-8 InfoPoly
  
  InfoPoly info class
  
  is the info class for univariate polynomials.
  
  We  remark  that  some functions for multivariate polynomials (which will be
  defined  in the following sections) permit a different syntax for univariate
  polynomials  which  drops  the  requirement  to  specify  the indeterminate.
  Examples  are  Value  (66.7-1),  Discriminant (66.6-6), Derivative (66.6-5),
  LeadingCoefficient (66.6-3) and LeadingMonomial (66.6-4):
  
    Example  
    gap> p:=UnivariatePolynomial(Rationals,[1,2,3,4],1);
    4*x^3+3*x^2+2*x+1
    gap> Value(p,Z(5));
    Z(5)^2
    gap> LeadingCoefficient(p);
    4
    gap> Derivative(p);
    12*x^2+6*x+2
  
  
  
  66.6 Polynomials as Univariate Polynomials in one Indeterminate
  
  66.6-1 DegreeIndeterminate
  
  DegreeIndeterminate( pol, ind )  operation
  
  returns   the  degree  of  the  polynomial  pol  in  the  indeterminate  (or
  indeterminate number) ind.
  
    Example  
    gap> f:=x^5+3*x*y+9*y^7+4*y^5*x+3*y+2;
    9*y^7+4*x*y^5+x^5+3*x*y+3*y+2
    gap> DegreeIndeterminate(f,1);
    5
    gap> DegreeIndeterminate(f,y);
    7
  
  
  66.6-2 PolynomialCoefficientsOfPolynomial
  
  PolynomialCoefficientsOfPolynomial( pol, ind )  operation
  
  PolynomialCoefficientsOfPolynomial   returns  the  coefficient  list  (whose
  entries  are polynomials not involving the indeterminate ind) describing the
  polynomial  pol viewed as a polynomial in ind. Instead of the indeterminate,
  ind can also be an indeterminate number.
  
    Example  
    gap> PolynomialCoefficientsOfPolynomial(f,2);
    [ x^5+2, 3*x+3, 0, 0, 0, 4*x, 0, 9 ]
  
  
  66.6-3 LeadingCoefficient
  
  LeadingCoefficient( pol )  operation
  
  returns  the  leading  coefficient  (that  is the coefficient of the leading
  monomial, seeĀ LeadingMonomial (66.6-4)) of the polynomial pol.
  
  66.6-4 LeadingMonomial
  
  LeadingMonomial( pol )  operation
  
  returns  the  leading  monomial  (with  respect  to  the  ordering  given by
  MonomialExtGrlexLess  (66.17-14)) of the polynomial pol as a list containing
  indeterminate numbers and exponents.
  
    Example  
    gap> LeadingCoefficient(f,1);
    1
    gap> LeadingCoefficient(f,2);
    9
    gap> LeadingMonomial(f);
    [ 2, 7 ]
    gap> LeadingCoefficient(f);
    9
  
  
  66.6-5 Derivative
  
  Derivative( ratfun[, ind] )  attribute
  
  If  ratfun  is  a  univariate  rational function then Derivative returns the
  derivative of ufun by its indeterminate. For a rational function ratfun, the
  derivative  by  the  indeterminate  ind  is  returned,  regarding  ratfun as
  univariate  in ind. Instead of the desired indeterminate, also the number of
  this indeterminate can be given as ind.
  
    Example  
    gap> Derivative(f,2);
    63*y^6+20*x*y^4+3*x+3
  
  
  66.6-6 Discriminant
  
  Discriminant( pol[, ind] )  operation
  
  If pol is a univariate polynomial then Discriminant returns the discriminant
  of  pol by its indeterminate. The two-argument form returns the discriminant
  of  a  polynomial  pol  by  the  indeterminate  number ind, regarding pol as
  univariate  in  this indeterminate. Instead of the indeterminate number, the
  indeterminate itself can also be given as ind.
  
    Example  
    gap> Discriminant(f,1);
    20503125*y^28+262144*y^25+27337500*y^22+19208040*y^21+1474560*y^17+136\
    68750*y^16+18225000*y^15+6075000*y^14+1105920*y^13+3037500*y^10+648972\
    0*y^9+4050000*y^8+900000*y^7+62208*y^5+253125*y^4+675000*y^3+675000*y^\
    2+300000*y+50000
    gap> Discriminant(f,1) = Discriminant(f,x);
    true
  
  
  66.6-7 Resultant
  
  Resultant( pol1, pol2, ind )  operation
  
  computes  the resultant of the polynomials pol1 and pol2 with respect to the
  indeterminate ind, or indeterminate number ind. The resultant considers pol1
  and  pol2  as  univariate in ind and returns an element of the corresponding
  base ring (which might be a polynomial ring).
  
    Example  
    gap> Resultant(x^4+y,y^4+x,1);
    y^16+y
    gap> Resultant(x^4+y,y^4+x,2);
    x^16+x
  
  
  
  66.7 Multivariate Polynomials
  
  
  66.7-1 Value
  
  Value( ratfun, indets, vals[, one] )  operation
  Value( upol, value[, one] )  operation
  
  The  first  variant  takes  a  rational  function ratfun and specializes the
  indeterminates  given  in  indets to the values given in vals, replacing the
  i-th  entry  in  indets  by  the  i-th entry in vals. If this specialization
  results  in  a  constant  polynomial,  an element of the coefficient ring is
  returned.  If  the specialization would specialize the denominator of ratfun
  to zero, an error is raised.
  
  A  variation  is  the  evaluation at elements of another ring R, for which a
  multiplication  with elements of the coefficient ring of ratfun are defined.
  In  this  situation  the  identity  element  of  R may be given by a further
  argument one which will be used for x^0 for any specialized indeterminate x.
  
  The second version takes an univariate rational function and specializes the
  value  of  its  indeterminate to val. Again, an optional argument one may be
  given.
  
    Example  
    gap> Value(x*y+y+x^7,[x,y],[5,7]);
    78167
  
  
  Note  that the default values for one can lead to different results than one
  would  expect:  For  example  for  a  matrix M, the values M+M^0 and M+1 are
  different.  As  Value  defaults  to  the  one  of the coefficient ring, when
  evaluating matrices in polynomials always the correct one should be given!
  
  
  66.8 Minimal Polynomials
  
  66.8-1 MinimalPolynomial
  
  MinimalPolynomial( R, elm[, ind] )  operation
  
  returns  the  minimal  polynomial  of  elm over the ring R, expressed in the
  indeterminate number ind. If ind is not given, it defaults to 1.
  
  The  minimal  polynomial  is  the  monic  polynomial of smallest degree with
  coefficients in R that has value zero at elm.
  
    Example  
    gap> MinimalPolynomial(Rationals,[[2,0],[0,2]]);
    x-2
  
  
  
  66.9 Cyclotomic Polynomials
  
  66.9-1 CyclotomicPolynomial
  
  CyclotomicPolynomial( F, n )  function
  
  is the n-th cyclotomic polynomial over the ring F.
  
    Example  
    gap> CyclotomicPolynomial(Rationals,5);
    x^4+x^3+x^2+x+1
  
  
  
  66.10 Polynomial Factorization
  
  At the moment GAP provides only methods to factorize polynomials over finite
  fields   (see   ChapterĀ 59),   over  subfields  of  cyclotomic  fields  (see
  ChapterĀ 60), and over algebraic extensions of these (see ChapterĀ 67).
  
  66.10-1 Factors
  
  Factors( [R, ]poly[, opt] )  method
  
  returns  a  list  of  the  irreducible factors of the polynomial poly in the
  polynomial  ring  R.  (That  is  factors over the CoefficientsRing (66.15-3)
  value of R.)
  
  For  univariate  factorizations,  it  is  possible to pass a record opt as a
  third argument. This record can contain the following components:
  
  onlydegs
        is  a  set  of  positive  integers. The factorization assumes that all
        irreducible factors have a degree in this set.
  
  stopdegs
        is  a  set  of  positive  integers. The factorization will stop once a
        factor  of  degree  in  stopdegs  has  been  found and will return the
        factorization found so far.
  
    Example  
    gap> f:= CyclotomicPolynomial( GF(2), 7 );
    x_1^6+x_1^5+x_1^4+x_1^3+x_1^2+x_1+Z(2)^0
    gap> Factors( f );
    [ x_1^3+x_1+Z(2)^0, x_1^3+x_1^2+Z(2)^0 ]
    gap> Factors( PolynomialRing( GF(8) ), f );
    [ x_1+Z(2^3), x_1+Z(2^3)^2, x_1+Z(2^3)^3, x_1+Z(2^3)^4, x_1+Z(2^3)^5, 
      x_1+Z(2^3)^6 ]
    gap> f:= MinimalPolynomial( Rationals, E(4) );
    x^2+1
    gap> Factors( f );
    [ x^2+1 ]
    gap> Factors( PolynomialRing( Rationals ), f );
    [ x^2+1 ]
    gap> Factors( PolynomialRing( CF(4) ), f );
    [ x+(-E(4)), x+E(4) ]
  
  
  66.10-2 FactorsSquarefree
  
  FactorsSquarefree( pring, upol, opt )  operation
  
  returns a factorization of the squarefree, monic, univariate polynomial upol
  in  the  polynomial  ring  pring;  opt  must be a (possibly empty) record of
  options.  upol  must  not  have zero as a root. This function is used by the
  factoring algorithms.
  
  The  current  method  for  multivariate  factorization reduces to univariate
  factorization  by use of a reduction homomorphism of the form f(x_1,x_2,x_3)
  ↦ f(x,x^p,x^{p^2}). It can be very time intensive for larger degrees.
  
    Example  
    gap> Factors(x^10-y^10);
    [ x-y, x+y, x^4-x^3*y+x^2*y^2-x*y^3+y^4, x^4+x^3*y+x^2*y^2+x*y^3+y^4 ]
  
  
  
  66.11 Polynomials over the Rationals
  
  The  following  functions  are  only  available to polynomials with rational
  coefficients:
  
  66.11-1 PrimitivePolynomial
  
  PrimitivePolynomial( f )  operation
  
  takes  a  polynomial  f  with  rational  coefficients  and  computes  a  new
  polynomial  with integral coefficients, obtained by multiplying with the Lcm
  of the denominators of the coefficients and casting out the content (the Gcd
  of  the  coefficients).  The  operation  returns  a list [newpol,coeff] with
  rational coeff such that coeff*newpol=f.
  
  66.11-2 PolynomialModP
  
  PolynomialModP( pol, p )  function
  
  for  a  rational  polynomial pol this function returns a polynomial over the
  field with p elements, obtained by reducing the coefficients modulo p.
  
  66.11-3 GaloisType
  
  GaloisType( f )  attribute
  
  Let f be an irreducible polynomial with rational coefficients. This function
  returns  the type of Gal(f) (considered as a transitive permutation group of
  the  roots  of f). It returns a number i if Gal(f) is permutation isomorphic
  to TransitiveGroup(n,i) where n is the degree of f.
  
  Identification  is  performed  by factoring appropriate Galois resolvents as
  proposed  in  [SM85].  This function is provided for rational polynomials of
  degree  up  to  15.  However, in some cases the required calculations become
  unfeasibly large.
  
  For  a  few  polynomials  of degree 14, a complete discrimination is not yet
  possible,  as  it  would  require  computations,  that are not feasible with
  current factoring methods.
  
  This  function  requires  the transitive groups library to be installed (see
  'transgrp: Transitive Permutation Groups').
  
  66.11-4 ProbabilityShapes
  
  ProbabilityShapes( f )  function
  
  Let f be an irreducible polynomial with rational coefficients. This function
  returns  a  list  of  the  most  likely  type(s)  of  Gal(f) (see GaloisType
  (66.11-3)),  based on factorization modulo a set of primes. It is very fast,
  but the result is only probabilistic.
  
  This  function  requires  the transitive groups library to be installed (see
  'transgrp: Transitive Permutation Groups').
  
    Example  
    gap> f:=x^9-9*x^7+27*x^5-39*x^3+36*x-8;;
    gap> GaloisType(f);
    25
    gap> TransitiveGroup(9,25);
    [1/2.S(3)^3]3
    gap> ProbabilityShapes(f);
    [ 25 ]
  
  
  
  66.12 Factorization of Polynomials over the Rationals
  
  The  following operations are used by GAP inside the factorization algorithm
  but might be of interest also in other contexts.
  
  66.12-1 BombieriNorm
  
  BombieriNorm( pol )  function
  
  computes  weighted  Norm  [pol]_2  of pol which is a good measure for factor
  coefficients (see [BTW93]).
  
  66.12-2 MinimizedBombieriNorm
  
  MinimizedBombieriNorm( f )  attribute
  
  This  function applies linear Tschirnhaus transformations (x ↦ x + i) to the
  polynomial  f, trying to get the Bombieri norm of f small. It returns a list
  [new_polynomial, i_of_transformation].
  
  66.12-3 HenselBound
  
  HenselBound( pol[, minpol, den] )  function
  
  returns  the  Hensel  bound  of the polynomial pol. If the computation takes
  place  over  an  algebraic extension, then the minimal polynomial minpol and
  denominator den must be given.
  
  66.12-4 OneFactorBound
  
  OneFactorBound( pol )  function
  
  returns the coefficient bound for a single factor of the rational polynomial
  pol.
  
  
  66.13 Laurent Polynomials
  
  A  univariate  polynomial  can  be written in the form r_0 + r_1 x + ⋯ + r_n
  x^n,  with r_i ∈ R. Formally, there is no reason to start with 0, if m is an
  integer, we can consider objects of the form r_m x^m + r_{m+1} x^{m+1} + ⋯ +
  r_n  x^n. We call these Laurent polynomials. Laurent polynomials also can be
  considered  as  quotients  of  a  univariate  polynomial  by  a power of the
  indeterminate.  The  addition  and  multiplication of univariate polynomials
  extends to Laurent polynomials (though it might be impossible to interpret a
  Laurent  polynomial  as  a  function)  and  many  functions  for  univariate
  polynomials  extend to Laurent polynomials (or extended versions for Laurent
  polynomials exist).
  
  66.13-1 LaurentPolynomialByCoefficients
  
  LaurentPolynomialByCoefficients( fam, cofs, val[, ind] )  operation
  
  constructs  a Laurent polynomial over the coefficients family fam and in the
  indeterminate ind (defaulting to 1) with the coefficients given by coefs and
  valuation val.
  
  66.13-2 CoefficientsOfLaurentPolynomial
  
  CoefficientsOfLaurentPolynomial( laurent )  attribute
  
  For  a  Laurent polynomial laurent, this function returns a pair [cof, val],
  consisting  of  the  coefficient  list  (in  ascending  order)  cof  and the
  valuation val of laurent.
  
    Example  
    gap> p:=LaurentPolynomialByCoefficients(FamilyObj(1),
    > [1,2,3,4,5],-2);
    5*x^2+4*x+3+2*x^-1+x^-2
    gap> NumeratorOfRationalFunction(p);DenominatorOfRationalFunction(p);
    5*x^4+4*x^3+3*x^2+2*x+1
    x^2
    gap> CoefficientsOfLaurentPolynomial(p*p);
    [ [ 1, 4, 10, 20, 35, 44, 46, 40, 25 ], -4 ]
  
  
  66.13-3 IndeterminateNumberOfLaurentPolynomial
  
  IndeterminateNumberOfLaurentPolynomial( pol )  attribute
  
  Is a synonym for IndeterminateNumberOfUnivariateRationalFunction (66.1-2).
  
  
  66.14 Univariate Rational Functions
  
  66.14-1 UnivariateRationalFunctionByCoefficients
  
  UnivariateRationalFunctionByCoefficients( fam, ncof, dcof, val[, ind] )  operation
  
  constructs  a  univariate rational function over the coefficients family fam
  and   in  the  indeterminate  ind  (defaulting  to  1)  with  numerator  and
  denominator coefficients given by ncof and dcof and valuation val.
  
  
  66.15 Polynomial Rings and Function Fields
  
  While  polynomials depend only on the family of the coefficients, polynomial
  rings  A  are defined over a base ring R. A polynomial is an element of A if
  and  only  if  all  its  coefficients  are contained in R. Besides providing
  domains  and  an easy way to create polynomials, polynomial rings can affect
  the behavior of operations like factorization into irreducibles.
  
  If  you  need  to  work  with  a  polynomial ring and its indeterminates the
  following  two  approaches will produce a ring that contains given variables
  (see  sectionĀ 66.1  for details about the internal numbering): Either, first
  create    the    ring    and    then    get    the    indeterminates    with
  IndeterminatesOfPolynomialRing (66.15-2).
  
    Example  
    gap> r := PolynomialRing(Rationals,["a","b"]);;
    gap> indets := IndeterminatesOfPolynomialRing(r);;
    gap> a := indets[1]; a := indets[2];
    a
    b
  
  
  Alternatively,  first  create  the  indeterminates  and then create the ring
  including these indeterminates.
  
    Example  
    gap> a:=Indeterminate(Rationals,"a":old);;
    gap> b:=Indeterminate(Rationals,"b":old);;
    gap> PolynomialRing(Rationals,[a,b]);;
  
  
  As  a convenient shortcut, intended mainly for interactive working, the i-th
  indeterminate  of  a  polynomial  ring  R  can  be  accessed  as  R.i, which
  corresponds  exactly to IndeterminatesOfPolynomialRing( R )[i] or, if it has
  the  name  nam,  as  R.nam.  Note  that  the  number i is in general not the
  indeterminate number, but simply an index into the indeterminates list of R.
  
    Example  
    gap> r := PolynomialRing(Rationals, ["a", "b"]:old );;
    gap> r.1; r.2; r.a; r.b;
    a
    b
    a
    b
    gap> IndeterminateNumberOfLaurentPolynomial(r.1);
    3
  
  
  Polynomials as GAP objects can exist without a polynomial ring being defined
  and  polynomials  cannot be associated to a particular polynomial ring. (For
  example  dividing  a  polynomial  which  is  in  a  polynomial ring over the
  integers  by another integer will result in a polynomial over the rationals,
  not in a rational function over the integers.)
  
  
  66.15-1 PolynomialRing
  
  PolynomialRing( R, rank[, avoid] )  operation
  PolynomialRing( R, names[, avoid] )  operation
  PolynomialRing( R, indets )  operation
  PolynomialRing( R, indetnums )  operation
  
  creates  a  polynomial  ring  over the ring R. If a positive integer rank is
  given,  this  creates  the  polynomial  ring  in  rank indeterminates. These
  indeterminates  will  have  the internal index numbers 1 to rank. The second
  usage  takes  a  list  names  of  strings  and  returns a polynomial ring in
  indeterminates  labelled  by  names.  These indeterminates have new internal
  index  numbers  as  if  they  had  been  created  by  calls to Indeterminate
  (66.1-1).  (If  the  argument avoid is given it contains indeterminates that
  should  be  avoided,  in this case internal index numbers are incremented to
  skip these variables.) In the third version, a list of indeterminates indets
  is  given.  This  creates  the polynomial ring in the indeterminates indets.
  Finally, the fourth version specifies indeterminates by their index numbers.
  
  To     get     the    indeterminates    of    a    polynomial    ring    use
  IndeterminatesOfPolynomialRing     (66.15-2).     (Indeterminates    created
  independently  with  Indeterminate (66.1-1) will usually differ, though they
  might be given the same name and display identically, see SectionĀ 66.1.)
  
  66.15-2 IndeterminatesOfPolynomialRing
  
  IndeterminatesOfPolynomialRing( pring )  attribute
  IndeterminatesOfFunctionField( ffield )  attribute
  
  returns  a  list  of  the  indeterminates  of  the  polynomial  ring  pring,
  respectively the function field ffield.
  
  66.15-3 CoefficientsRing
  
  CoefficientsRing( pring )  attribute
  
  returns  the  ring of coefficients of the polynomial ring pring, that is the
  ring over which pring was defined.
  
    Example  
    gap> r:=PolynomialRing(GF(7));
    GF(7)[x_1]
    gap> r:=PolynomialRing(GF(7),3);
    GF(7)[x_1,x_2,x_3]
    gap> IndeterminatesOfPolynomialRing(r);
    [ x_1, x_2, x_3 ]
    gap> r2:=PolynomialRing(GF(7),[5,7,12]);
    GF(7)[x_5,x_7,x_12]
    gap> CoefficientsRing(r);
    GF(7)
    gap> r:=PolynomialRing(GF(7),3);
    GF(7)[x_1,x_2,x_3]
    gap> r2:=PolynomialRing(GF(7),3,IndeterminatesOfPolynomialRing(r));
    GF(7)[x_4,x_5,x_6]
    gap> r:=PolynomialRing(GF(7),["x","y","z","z2"]);
    GF(7)[x,y,z,z2]
  
  
  66.15-4 IsPolynomialRing
  
  IsPolynomialRing( pring )  Category
  
  is the category of polynomial rings
  
  66.15-5 IsFiniteFieldPolynomialRing
  
  IsFiniteFieldPolynomialRing( pring )  Category
  
  is the category of polynomial rings over a finite field (see ChapterĀ 59).
  
  66.15-6 IsAbelianNumberFieldPolynomialRing
  
  IsAbelianNumberFieldPolynomialRing( pring )  Category
  
  is  the  category  of  polynomial rings over a field of cyclotomics (see the
  chaptersĀ 18 and 60).
  
  66.15-7 IsRationalsPolynomialRing
  
  IsRationalsPolynomialRing( pring )  Category
  
  is the category of polynomial rings over the rationals (see ChapterĀ 17).
  
    Example  
    gap> r := PolynomialRing(Rationals, ["a", "b"] );;
    gap> IsPolynomialRing(r);
    true
    gap> IsFiniteFieldPolynomialRing(r);
    false
    gap> IsRationalsPolynomialRing(r);
    true
  
  
  
  66.15-8 FunctionField
  
  FunctionField( R, rank[, avoid] )  operation
  FunctionField( R, names[, avoid] )  operation
  FunctionField( R, indets )  operation
  FunctionField( R, indetnums )  operation
  
  creates  a  function  field  over the integral ring R. If a positive integer
  rank is given, this creates the function field in rank indeterminates. These
  indeterminates  will  have  the internal index numbers 1 to rank. The second
  usage  takes  a  list  names  of  strings  and  returns  a function field in
  indeterminates  labelled  by  names.  These indeterminates have new internal
  index  numbers  as  if  they  had  been  created  by  calls to Indeterminate
  (66.1-1).  (If  the  argument avoid is given it contains indeterminates that
  should  be  avoided,  in this case internal index numbers are incremented to
  skip these variables.) In the third version, a list of indeterminates indets
  is  given.  This  creates  the  function field in the indeterminates indets.
  Finally, the fourth version specifies indeterminates by their index number.
  
  To     get     the     indeterminates    of    a    function    field    use
  IndeterminatesOfFunctionField     (66.15-2).     (Indeterminates     created
  independently  with  Indeterminate (66.1-1) will usually differ, though they
  might be given the same name and display identically, see SectionĀ 66.1.)
  
  66.15-9 IsFunctionField
  
  IsFunctionField( ffield )  Category
  
  is the category of function fields
  
  
  66.16 Univariate Polynomial Rings
  
  
  66.16-1 UnivariatePolynomialRing
  
  UnivariatePolynomialRing( R[, nr] )  operation
  UnivariatePolynomialRing( R[, name][, avoid] )  operation
  
  returns  a  univariate polynomial ring in the indeterminate nr over the base
  ring R. If nr is not given it defaults to 1.
  
  If  the number is not specified a list avoid of indeterminates may be given.
  Then  the function will return a ring in an indeterminate that is guaranteed
  to be different from all the indeterminates in avoid.
  
  Also a string name can be prescribed as the name of the indeterminate chosen
  (also avoiding the indeterminates in the list avoid if given).
  
  66.16-2 IsUnivariatePolynomialRing
  
  IsUnivariatePolynomialRing( pring )  Category
  
  is the category of polynomial rings with one indeterminate.
  
    Example  
    gap> r:=UnivariatePolynomialRing(Rationals,"p");
    Rationals[p]
    gap> r2:=PolynomialRing(Rationals,["q"]);
    Rationals[q]
    gap> IsUnivariatePolynomialRing(r);
    true
    gap> IsUnivariatePolynomialRing(r2);
    true
  
  
  
  66.17 Monomial Orderings
  
  It  is  often  desirable to consider the monomials within a polynomial to be
  arranged  with  respect  to a certain ordering. Such an ordering is called a
  monomial  ordering if it is total, invariant under multiplication with other
  monomials  and admits no infinite descending chains. For details on monomial
  orderings see [CLO97].
  
  In  GAP, monomial orderings are represented by objects that provide a way to
  compare monomials (as polynomials as well as –for efficiency purposes within
  algorithms– in the internal representation as lists).
  
  Normally  the  ordering  chosen  should  be  admissible,  i.e.  it  must  be
  compatible  with  products: If a < b then ca < cb for all monomials a, b and
  c.
  
  Each monomial ordering provides the two functions MonomialComparisonFunction
  (66.17-5)  and  MonomialExtrepComparisonFun  (66.17-6) to compare monomials.
  These  functions  work as is less than, i.e. they return true if and only if
  the left argument is smaller.
  
  66.17-1 IsMonomialOrdering
  
  IsMonomialOrdering( obj )  Category
  
  A  monomial  ordering  is  an  object  representing a monomial ordering. Its
  attributes          MonomialComparisonFunction         (66.17-5)         and
  MonomialExtrepComparisonFun (66.17-6) are actual comparison functions.
  
  66.17-2 LeadingMonomialOfPolynomial
  
  LeadingMonomialOfPolynomial( pol, ord )  operation
  
  returns  the  leading  monomial  (with  respect  to the ordering ord) of the
  polynomial pol.
  
    Example  
    gap> x:=Indeterminate(Rationals,"x");;
    gap> y:=Indeterminate(Rationals,"y");;
    gap> z:=Indeterminate(Rationals,"z");;
    gap> lexord:=MonomialLexOrdering();grlexord:=MonomialGrlexOrdering();
    MonomialLexOrdering()
    MonomialGrlexOrdering()
    gap> f:=2*x+3*y+4*z+5*x^2-6*z^2+7*y^3;          
    7*y^3+5*x^2-6*z^2+2*x+3*y+4*z
    gap> LeadingMonomialOfPolynomial(f,lexord);
    x^2
    gap> LeadingMonomialOfPolynomial(f,grlexord);
    y^3
  
  
  66.17-3 LeadingTermOfPolynomial
  
  LeadingTermOfPolynomial( pol, ord )  operation
  
  returns  the  leading  term  (with  respect  to  the  ordering  ord)  of the
  polynomial  pol,  i.e.  the  product  of  leading  coefficient  and  leading
  monomial.
  
  66.17-4 LeadingCoefficientOfPolynomial
  
  LeadingCoefficientOfPolynomial( pol, ord )  operation
  
  returns  the  leading  coefficient  (that  is the coefficient of the leading
  monomial, seeĀ LeadingMonomialOfPolynomial (66.17-2)) of the polynomial pol.
  
    Example  
    gap> LeadingTermOfPolynomial(f,lexord);
    5*x^2
    gap> LeadingTermOfPolynomial(f,grlexord);
    7*y^3
    gap> LeadingCoefficientOfPolynomial(f,lexord);
    5
  
  
  66.17-5 MonomialComparisonFunction
  
  MonomialComparisonFunction( O )  attribute
  
  If O is an object representing a monomial ordering, this attribute returns a
  function  that  can  be  used  to compare or sort monomials (and polynomials
  which  will  be  compared  by  their  monomials in decreasing order) in this
  order.
  
    Example  
    gap> MonomialComparisonFunction(lexord);
    function( a, b ) ... end
    gap> l:=[f,Derivative(f,x),Derivative(f,y),Derivative(f,z)];;
    gap> Sort(l,MonomialComparisonFunction(lexord));l;
    [ -12*z+4, 21*y^2+3, 10*x+2, 7*y^3+5*x^2-6*z^2+2*x+3*y+4*z ]
  
  
  66.17-6 MonomialExtrepComparisonFun
  
  MonomialExtrepComparisonFun( O )  attribute
  
  If O is an object representing a monomial ordering, this attribute returns a
  function  that  can  be  used to compare or sort monomials in their external
  representation (as lists). This comparison variant is used inside algorithms
  that manipulate the external representation.
  
  66.17-7 MonomialLexOrdering
  
  MonomialLexOrdering( [vari] )  function
  
  This  function creates a lexicographic ordering for monomials. Monomials are
  compared  first by the exponents of the largest variable, then the exponents
  of the second largest variable and so on.
  
  The  variables are ordered according to their (internal) index, i.e., x_1 is
  larger  than  x_2 and so on. If vari is given, and is a list of variables or
  variable  indices,  instead  this  arrangement  of  variables (in descending
  order;  i.e.  the  first  variable is larger than the second) is used as the
  underlying order of variables.
  
    Example  
    gap> l:=List(Tuples([1..3],3),i->x^(i[1]-1)*y^(i[2]-1)*z^(i[3]-1));
    [ 1, z, z^2, y, y*z, y*z^2, y^2, y^2*z, y^2*z^2, x, x*z, x*z^2, x*y, 
      x*y*z, x*y*z^2, x*y^2, x*y^2*z, x*y^2*z^2, x^2, x^2*z, x^2*z^2, 
      x^2*y, x^2*y*z, x^2*y*z^2, x^2*y^2, x^2*y^2*z, x^2*y^2*z^2 ]
    gap> Sort(l,MonomialComparisonFunction(MonomialLexOrdering()));l;
    [ 1, z, z^2, y, y*z, y*z^2, y^2, y^2*z, y^2*z^2, x, x*z, x*z^2, x*y, 
      x*y*z, x*y*z^2, x*y^2, x*y^2*z, x*y^2*z^2, x^2, x^2*z, x^2*z^2, 
      x^2*y, x^2*y*z, x^2*y*z^2, x^2*y^2, x^2*y^2*z, x^2*y^2*z^2 ]
    gap> Sort(l,MonomialComparisonFunction(MonomialLexOrdering([y,z,x])));l;
    [ 1, x, x^2, z, x*z, x^2*z, z^2, x*z^2, x^2*z^2, y, x*y, x^2*y, y*z, 
      x*y*z, x^2*y*z, y*z^2, x*y*z^2, x^2*y*z^2, y^2, x*y^2, x^2*y^2, 
      y^2*z, x*y^2*z, x^2*y^2*z, y^2*z^2, x*y^2*z^2, x^2*y^2*z^2 ]
    gap> Sort(l,MonomialComparisonFunction(MonomialLexOrdering([z,x,y])));l;
    [ 1, y, y^2, x, x*y, x*y^2, x^2, x^2*y, x^2*y^2, z, y*z, y^2*z, x*z, 
      x*y*z, x*y^2*z, x^2*z, x^2*y*z, x^2*y^2*z, z^2, y*z^2, y^2*z^2, 
      x*z^2, x*y*z^2, x*y^2*z^2, x^2*z^2, x^2*y*z^2, x^2*y^2*z^2 ]
  
  
  66.17-8 MonomialGrlexOrdering
  
  MonomialGrlexOrdering( [vari] )  function
  
  This  function  creates  a  degree/lexicographic  ordering. In this ordering
  monomials  are  compared first by their total degree, then lexicographically
  (see MonomialLexOrdering (66.17-7)).
  
  The  variables are ordered according to their (internal) index, i.e., x_1 is
  larger  than  x_2 and so on. If vari is given, and is a list of variables or
  variable  indices,  instead  this  arrangement  of  variables (in descending
  order;  i.e.  the  first  variable is larger than the second) is used as the
  underlying order of variables.
  
  66.17-9 MonomialGrevlexOrdering
  
  MonomialGrevlexOrdering( [vari] )  function
  
  This  function  creates  a  grevlex ordering. In this ordering monomials are
  compared  first  by total degree and then backwards lexicographically. (This
  is different than grlex ordering with variables reversed.)
  
  The  variables are ordered according to their (internal) index, i.e., x_1 is
  larger  than  x_2 and so on. If vari is given, and is a list of variables or
  variable  indices,  instead  this  arrangement  of  variables (in descending
  order;  i.e.  the  first  variable is larger than the second) is used as the
  underlying order of variables.
  
    Example  
    gap> Sort(l,MonomialComparisonFunction(MonomialGrlexOrdering()));l;
    [ 1, z, y, x, z^2, y*z, y^2, x*z, x*y, x^2, y*z^2, y^2*z, x*z^2, 
      x*y*z, x*y^2, x^2*z, x^2*y, y^2*z^2, x*y*z^2, x*y^2*z, x^2*z^2, 
      x^2*y*z, x^2*y^2, x*y^2*z^2, x^2*y*z^2, x^2*y^2*z, x^2*y^2*z^2 ]
    gap> Sort(l,MonomialComparisonFunction(MonomialGrevlexOrdering()));l;
    [ 1, z, y, x, z^2, y*z, x*z, y^2, x*y, x^2, y*z^2, x*z^2, y^2*z, 
      x*y*z, x^2*z, x*y^2, x^2*y, y^2*z^2, x*y*z^2, x^2*z^2, x*y^2*z, 
      x^2*y*z, x^2*y^2, x*y^2*z^2, x^2*y*z^2, x^2*y^2*z, x^2*y^2*z^2 ]
    gap> Sort(l,MonomialComparisonFunction(MonomialGrlexOrdering([z,y,x])));l;
    [ 1, x, y, z, x^2, x*y, y^2, x*z, y*z, z^2, x^2*y, x*y^2, x^2*z, 
      x*y*z, y^2*z, x*z^2, y*z^2, x^2*y^2, x^2*y*z, x*y^2*z, x^2*z^2, 
      x*y*z^2, y^2*z^2, x^2*y^2*z, x^2*y*z^2, x*y^2*z^2, x^2*y^2*z^2 ]
  
  
  66.17-10 EliminationOrdering
  
  EliminationOrdering( elim[, rest] )  function
  
  This  function creates an elimination ordering for eliminating the variables
  in  elim.  Two  monomials are compared first by the exponent vectors for the
  variables  listed  in  elim  (a lexicographic comparison with respect to the
  ordering   indicated   in   elim).  If  these  submonomial  are  equal,  the
  submonomials  given  by  the  other  variables  are  compared  by  a  graded
  lexicographic ordering (with respect to the variable order given in rest, if
  called with two parameters).
  
  Both elim and rest may be a list of variables or a list of variable indices.
  
  66.17-11 PolynomialReduction
  
  PolynomialReduction( poly, gens, order )  function
  
  reduces  the  polynomial  poly  by the ideal generated by the polynomials in
  gens, using the order order of monomials. Unless gens is a Grƶbner basis the
  result is not guaranteed to be unique.
  
  The operation returns a list of length two, the first entry is the remainder
  after  the  reduction. The second entry is a list of quotients corresponding
  to gens.
  
  Note that the strategy used by PolynomialReduction differs from the standard
  textbook      reduction      algorithm,     which     is     provided     by
  PolynomialDivisionAlgorithm (66.17-13).
  
  66.17-12 PolynomialReducedRemainder
  
  PolynomialReducedRemainder( poly, gens, order )  function
  
  this  operation does the same way as PolynomialReduction (66.17-11) but does
  not keep track of the actual quotients and returns only the remainder (it is
  therefore slightly faster).
  
  66.17-13 PolynomialDivisionAlgorithm
  
  PolynomialDivisionAlgorithm( poly, gens, order )  function
  
  This function implements the division algorithm for multivariate polynomials
  as  given  in  [CLO97,  Theorem  3  in  Chapter 2]. (It might be slower than
  PolynomialReduction  (66.17-11)  but  the remainders are guaranteed to agree
  with the textbook.)
  
  The operation returns a list of length two, the first entry is the remainder
  after  the  reduction. The second entry is a list of quotients corresponding
  to gens.
  
    Example  
    gap> bas:=[x^3*y*z,x*y^2*z,z*y*z^3+x];;
    gap> pol:=x^7*z*bas[1]+y^5*bas[3]+x*z;;
    gap> PolynomialReduction(pol,bas,MonomialLexOrdering()); 
    [ -y*z^5, [ x^7*z, 0, y^5+z ] ]
    gap> PolynomialReducedRemainder(pol,bas,MonomialLexOrdering());
    -y*z^5
    gap> PolynomialDivisionAlgorithm(pol,bas,MonomialLexOrdering());
    [ -y*z^5, [ x^7*z, 0, y^5+z ] ]
  
  
  66.17-14 MonomialExtGrlexLess
  
  MonomialExtGrlexLess( a, b )  function
  
  implements  comparison  of  monomial  in  their external representation by a
  grlex  order  with  x_1>x_2  (This  is  exactly  the same as the ordering by
  MonomialGrlexOrdering   (66.17-8),  seeĀ   66.17).  The  function  takes  two
  monomials  a and b in expanded form and returns whether the first is smaller
  than  the  second.  (This  ordering  is  also  used  by  GAP  internally for
  representing polynomials as a linear combination of monomials.)
  
  See sectionĀ 66.21 for details on the expanded form of monomials.
  
  
  66.18 Groebner Bases
  
  A  Groebner  Basis of an ideal Ii, in a polynomial ring R, with respect to a
  monomial  ordering,  is  a  set  of  ideal  generators G such that the ideal
  generated  by  the leading monomials of all polynomials in G is equal to the
  ideal generated by the leading monomials of all polynomials in I.
  
  For more details on Groebner bases see [CLO97].
  
  
  66.18-1 GroebnerBasis
  
  GroebnerBasis( L, O )  operation
  GroebnerBasis( I, O )  operation
  GroebnerBasisNC( L, O )  function
  
  Let O be a monomial ordering and L be a list of polynomials that generate an
  ideal  I.  This  operation returns a Groebner basis of I with respect to the
  ordering O.
  
  GroebnerBasisNC  works like GroebnerBasis with the only distinction that the
  first argument has to be a list of polynomials and that no test is performed
  to check whether the ordering is defined for all occuring variables.
  
  Note  that  GAP  at  the  moment  only  includes  a  naĆÆve implementation of
  Buchberger's  algorithm  (which  is  mainly intended as a teaching tool). It
  might not be sufficient for serious problems.
  
    Example  
    gap> l:=[x^2+y^2+z^2-1,x^2+z^2-y,x-y];;
    gap> GroebnerBasis(l,MonomialLexOrdering());
    [ x^2+y^2+z^2-1, x^2+z^2-y, x-y, -y^2-y+1, -z^2+2*y-1, 
      1/2*z^4+2*z^2-1/2 ]
    gap> GroebnerBasis(l,MonomialLexOrdering([z,x,y]));
    [ x^2+y^2+z^2-1, x^2+z^2-y, x-y, -y^2-y+1 ]
    gap> GroebnerBasis(l,MonomialGrlexOrdering());
    [ x^2+y^2+z^2-1, x^2+z^2-y, x-y, -y^2-y+1, -z^2+2*y-1 ]
  
  
  
  66.18-2 ReducedGroebnerBasis
  
  ReducedGroebnerBasis( L, O )  operation
  ReducedGroebnerBasis( I, O )  operation
  
  a  Groebner  basis B (seeĀ GroebnerBasis (66.18-1)) is reduced if no monomial
  in  a  polynomial  in  B  is  divisible  by  the leading monomial of another
  polynomial  in  B.  This operation computes a Groebner basis with respect to
  the monomial ordering O and then reduces it.
  
    Example  
    gap> ReducedGroebnerBasis(l,MonomialGrlexOrdering());
    [ x-y, z^2-2*y+1, y^2+y-1 ]
    gap> ReducedGroebnerBasis(l,MonomialLexOrdering());    
    [ z^4+4*z^2-1, -1/2*z^2+y-1/2, -1/2*z^2+x-1/2 ]
    gap> ReducedGroebnerBasis(l,MonomialLexOrdering([y,z,x]));
    [ x^2+x-1, z^2-2*x+1, -x+y ]
  
  
  For  performance reasons it can be advantageous to define monomial orderings
  once and then to reuse them:
  
    Example  
    gap> ord:=MonomialGrlexOrdering();;
    gap> GroebnerBasis(l,ord);
    [ x^2+y^2+z^2-1, x^2+z^2-y, x-y, -y^2-y+1, -z^2+2*y-1 ]
    gap> ReducedGroebnerBasis(l,ord);
    [ x-y, z^2-2*y+1, y^2+y-1 ]
  
  
  66.18-3 StoredGroebnerBasis
  
  StoredGroebnerBasis( I )  attribute
  
  For  an  ideal  I in a polynomial ring, this attribute holds a list [ B, O ]
  where B is a Groebner basis for the monomial ordering O. this can be used to
  test membership or canonical coset representatives.
  
  66.18-4 InfoGroebner
  
  InfoGroebner info class
  
  This info class gives information about Groebner basis calculations.
  
  
  66.19 Rational Function Families
  
  All  rational  functions  defined  over  a  ring lie in the same family, the
  rational functions family over this ring.
  
  In  GAP  therefore  the family of a polynomial depends only on the family of
  the  coefficients, all polynomials whose coefficients lie in the same family
  are compatible.
  
  66.19-1 RationalFunctionsFamily
  
  RationalFunctionsFamily( fam )  attribute
  
  creates a family containing rational functions with coefficients in fam. All
  elements    of    the   RationalFunctionsFamily   are   rational   functions
  (seeĀ IsRationalFunction (66.4-1)).
  
  66.19-2 IsPolynomialFunctionsFamily
  
  IsPolynomialFunctionsFamily( obj )  Category
  IsRationalFunctionsFamily( obj )  Category
  
  IsPolynomialFunctionsFamily  is the category of a family of polynomials. For
  families  over  an  UFD,  the category becomes IsRationalFunctionsFamily (as
  rational  functions  and  quotients  are  only provided for families over an
  UFD.)
  
    Example  
    gap> fam:=RationalFunctionsFamily(FamilyObj(1));
    NewFamily( "RationalFunctionsFamily(...)", [ 618, 620 ],
    [ 82, 85, 89, 93, 97, 100, 103, 107, 111, 618, 620 ] )
  
  
  66.19-3 CoefficientsFamily
  
  CoefficientsFamily( rffam )  attribute
  
  If  rffam  has  been created as RationalFunctionsFamily(cfam) this attribute
  holds the coefficients family cfam.
  
  GAP   does   not   embed  the  base  ring  in  the  polynomial  ring.  While
  multiplication  and  addition  of  base  ring elements to rational functions
  return  the  expected  results,  polynomials  and rational functions are not
  equal.
  
    Example  
    gap> 1=Indeterminate(Rationals)^0;
    false
  
  
  
  66.20 The Representations of Rational Functions
  
  GAP  uses  four  representations  of  rational functions: Rational functions
  given   by  numerator  and  denominator,  polynomials,  univariate  rational
  functions  (given  by  coefficient  lists  for numerator and denominator and
  valuation)   and   Laurent   polynomials  (given  by  coefficient  list  and
  valuation).
  
  These  representations  do  not necessarily reflect mathematical properties:
  While  an object in the Laurent polynomials representation must be a Laurent
  polynomial it might turn out that a rational function given by numerator and
  denominator  is  actually  a  Laurent  polynomial  and the property tests in
  sectionĀ 66.4 will find this out.
  
  Each  representation  is  associated one or several defining attributes that
  give  an  external  representation  (seeĀ 66.21) of the representation in the
  form  of  lists  and  are  the  defining  information  that tells a rational
  function what it is.
  
  GAP  also  implements  methods  to  compute  these  attributes  for rational
  functions in other representations, provided it would be possible to express
  an  mathematically  equal rational function in the representation associated
  with  the  attribute.  (That  is  one can always get a numerator/denominator
  representation  of  a  polynomial  while an arbitrary function of course can
  compute a polynomial representation only if it is a polynomial.)
  
  Therefore  these  attributes can be thought of as conceptual representations
  that  allow  us  –as  far  as  possible– to consider an object as a rational
  function,  a polynomial or a Laurent polynomial, regardless of the way it is
  represented in the computer.
  
  Functions  thus  usually  do  not need to care about the representation of a
  rational  function.  Depending  on  its (known in the context or determined)
  properties, they can access the attribute representing the rational function
  in the desired way.
  
  Consequentially, methods for rational functions are installed for properties
  and not for representations.
  
  When  creating new rational functions however they must be created in one of
  the three representations. In most cases this will be the representation for
  which the conceptual representation in which the calculation was done is the
  defining attribute.
  
  Iterated  operations  (like  forming the product over a list) therefore will
  tend  to  stay  in  the  most suitable representation and the calculation of
  another  conceptual  representation (which may be comparatively expensive in
  certain circumstances) is not necessary.
  
  
  66.21 The Defining Attributes of Rational Functions
  
  In  general,  rational  functions  are given in terms of monomials. They are
  represented by lists, using numbers (seeĀ 66.1) for the indeterminates.
  
  A monomial is a product of powers of indeterminates. A monomial is stored as
  a  list  (we  call  this  the  expanded  form  of  the monomial) of the form
  [inum,exp,inum,exp,...]  where  each  inum is the number of an indeterminate
  and exp the corresponding exponent. The list must be sorted according to the
  numbers of the indeterminates. Thus for example, if x, y and z are the first
  three indeterminates, the expanded form of the monomial x^5 z^8 = z^8 x^5 is
  [  1,  5,  3, 8 ]. The representation of a polynomials is a list of the form
  [mon,coeff,mon,coeff,...]  where mon is a monomial in expanded form (that is
  given  as  list)  and  coeff  its  coefficient. The monomials must be sorted
  according to the total degree/lexicographic order (This is the same as given
  by  the  grlex  monomial  ordering, seeĀ MonomialGrlexOrdering (66.17-8)). We
  call  this  the  external  representation  of  a polynomial. (The reason for
  ordering  is  that  addition  of polynomials becomes linear in the number of
  monomials instead of quadratic; the reason for the particular ordering chose
  is  that  it  is  compatible  with  multiplication and thus gives acceptable
  performance for quotient calculations.)
  
  The  attributes  that  give  a  representation of a a rational function as a
  Laurent   polynomial   are   CoefficientsOfLaurentPolynomial  (66.13-2)  and
  IndeterminateNumberOfUnivariateRationalFunction (66.1-2).
  
  Algorithms  should  use only the attributes ExtRepNumeratorRatFun (66.21-2),
  ExtRepDenominatorRatFun    (66.21-3),    ExtRepPolynomialRatFun   (66.21-6),
  CoefficientsOfLaurentPolynomial (66.13-2) and –if the univariate function is
  not  constant–  IndeterminateNumberOfUnivariateRationalFunction  (66.1-2) as
  the  low-level interface to work with a polynomial. They should not refer to
  the actual representation used.
  
  66.21-1 IsRationalFunctionDefaultRep
  
  IsRationalFunctionDefaultRep( obj )  Representation
  
  is  the default representation of rational functions. A rational function in
  this  representation  is  defined  by  the  attributes ExtRepNumeratorRatFun
  (66.21-2)  and  ExtRepDenominatorRatFun  (66.21-3),  the values of which are
  external representations of polynomials.
  
  66.21-2 ExtRepNumeratorRatFun
  
  ExtRepNumeratorRatFun( ratfun )  attribute
  
  returns  the  external  representation  of  the  numerator polynomial of the
  rational function ratfun. Numerator and denominator are not guaranteed to be
  cancelled against each other.
  
  66.21-3 ExtRepDenominatorRatFun
  
  ExtRepDenominatorRatFun( ratfun )  attribute
  
  returns  the  external  representation  of the denominator polynomial of the
  rational function ratfun. Numerator and denominator are not guaranteed to be
  cancelled against each other.
  
  66.21-4 ZeroCoefficientRatFun
  
  ZeroCoefficientRatFun( ratfun )  operation
  
  returns  the zero of the coefficient ring. This might be needed to represent
  the  zero  polynomial for which the external representation of the numerator
  is the empty list.
  
  66.21-5 IsPolynomialDefaultRep
  
  IsPolynomialDefaultRep( obj )  Representation
  
  is   the  default  representation  of  polynomials.  A  polynomial  in  this
  representation  is  defined  by  the  components  and  ExtRepNumeratorRatFun
  (66.21-2)    where   ExtRepNumeratorRatFun   (66.21-2)   is   the   external
  representation of the polynomial.
  
  66.21-6 ExtRepPolynomialRatFun
  
  ExtRepPolynomialRatFun( polynomial )  attribute
  
  returns  the  external  representation  of  a  polynomial. The difference to
  ExtRepNumeratorRatFun  (66.21-2) is that rational functions might know to be
  a  polynomial  but  can still have a non-vanishing denominator. In this case
  ExtRepPolynomialRatFun has to call a quotient routine.
  
  66.21-7 IsLaurentPolynomialDefaultRep
  
  IsLaurentPolynomialDefaultRep( obj )  Representation
  
  This   representation   is  used  for  Laurent  polynomials  and  univariate
  polynomials.   It   represents  a  Laurent  polynomial  via  the  attributes
  CoefficientsOfLaurentPolynomial                 (66.13-2)                and
  IndeterminateNumberOfLaurentPolynomial (66.13-3).
  
  
  66.22 Creation of Rational Functions
  
  The operations LaurentPolynomialByCoefficients (66.13-1), PolynomialByExtRep
  (66.22-2)  and  RationalFunctionByExtRep  (66.22-1)  are  used  to construct
  objects in the three basic representations for rational functions.
  
  66.22-1 RationalFunctionByExtRep
  
  RationalFunctionByExtRep( rfam, num, den )  function
  RationalFunctionByExtRepNC( rfam, num, den )  function
  
  constructs     a     rational     function     (in     the    representation
  IsRationalFunctionDefaultRep  (66.21-1))  in  the  rational  function family
  rfam,  the rational function itself is given by the external representations
  num and den for numerator and denominator. No cancellation takes place.
  
  The  variant  RationalFunctionByExtRepNC  does  not  perform any test of the
  arguments and thus potentially can create illegal objects. It only should be
  used if speed is required and the arguments are known to be in correct form.
  
  66.22-2 PolynomialByExtRep
  
  PolynomialByExtRep( rfam, extrep )  function
  PolynomialByExtRepNC( rfam, extrep )  function
  
  constructs   a  polynomial  (in  the  representation  IsPolynomialDefaultRep
  (66.21-5))  in  the  rational function family rfam, the polynomial itself is
  given by the external representation extrep.
  
  The  variant PolynomialByExtRepNC does not perform any test of the arguments
  and  thus  potentially can create invalid objects. It only should be used if
  speed is required and the arguments are known to be in correct form.
  
    Example  
    gap> fam:=RationalFunctionsFamily(FamilyObj(1));;
    gap> p:=PolynomialByExtRep(fam,[[1,2],1,[2,1,15,7],3]);
    3*y*x_15^7+x^2
    gap> q:=p/(p+1);
    (3*y*x_15^7+x^2)/(3*y*x_15^7+x^2+1)
    gap> ExtRepNumeratorRatFun(q);
    [ [ 1, 2 ], 1, [ 2, 1, 15, 7 ], 3 ]
    gap> ExtRepDenominatorRatFun(q);
    [ [  ], 1, [ 1, 2 ], 1, [ 2, 1, 15, 7 ], 3 ]
  
  
  66.22-3 LaurentPolynomialByExtRep
  
  LaurentPolynomialByExtRep( fam, cofs, val, ind )  function
  LaurentPolynomialByExtRepNC( fam, cofs, val, ind )  function
  
  creates  a  Laurent polynomial in the family fam with [cofs,val] as value of
  CoefficientsOfLaurentPolynomial   (66.13-2).   No  coefficient  shifting  is
  performed.  This is the lowest level function to create a Laurent polynomial
  but  will  rely  on  the  coefficients  being  shifted properly and will not
  perform   any   tests.   Unless  this  is  guaranteed  for  the  parameters,
  LaurentPolynomialByCoefficients (66.13-1) should be used.
  
  
  66.23 Arithmetic for External Representations of Polynomials
  
  The  following  operations are used internally to perform the arithmetic for
  polynomials in their external representation (seeĀ 66.21) as lists.
  
  Functions  to  perform  arithmetic  with  the  coefficient  lists of Laurent
  polynomials are described in SectionĀ 23.4.
  
  66.23-1 ZippedSum
  
  ZippedSum( z1, z2, czero, funcs )  operation
  
  computes  the  sum of two external representations of polynomials z1 and z2.
  czero  is the appropriate coefficient zero and funcs a list [ monomial_less,
  coefficient_sum  ]  containing  a  monomial  comparison  and  a  coefficient
  addition function. This list can be found in the component fam!.zippedSum of
  the rational functions family.
  
  Note  that  coefficient_sum  must  be  a  proper  summation  function, not a
  function computing differences.
  
  66.23-2 ZippedProduct
  
  ZippedProduct( z1, z2, czero, funcs )  operation
  
  computes  the  product of two external representations of polynomials z1 and
  z2.   czero  is  the  appropriate  coefficient  zero  and  funcs  a  list  [
  monomial_prod,  monomial_less, coefficient_sum, coefficient_prod] containing
  functions  to  multiply  and  compare  monomials,  to  add  and  to multiply
  coefficients.  This list can be found in the component fam!.zippedProduct of
  the rational functions family.
  
  66.23-3 QuotientPolynomialsExtRep
  
  QuotientPolynomialsExtRep( fam, a, b )  function
  
  Let  a and b the external representations of two polynomials in the rational
  functions  family fam. This function computes the external representation of
  the  quotient  of  both  polynomials,  it  returns  fail  if  the polynomial
  described by b does not divide the polynomial described by a.
  
  
  66.24 Cancellation Tests for Rational Functions
  
  The  operation  Gcd  (56.7-1)  can be used to test for common factors of two
  polynomials.  This  however  would  be  too  expensive  to  be  done  in the
  arithmetic, thus uses the following operations internally to try to keep the
  denominators as small as possible
  
  66.24-1 RationalFunctionByExtRepWithCancellation
  
  RationalFunctionByExtRepWithCancellation( rfam, num, den )  function
  
  constructs  a  rational  function as RationalFunctionByExtRep (66.22-1) does
  but tries to cancel out common factors of numerator and denominator, calling
  TryGcdCancelExtRepPolynomials (66.24-2).
  
  66.24-2 TryGcdCancelExtRepPolynomials
  
  TryGcdCancelExtRepPolynomials( fam, a, b )  function
  
  Let  a  and  b  be  the  external  representations  of two polynomials. This
  function   tries   to   cancel  common  factors  between  the  corresponding
  polynomials  and  returns  a  list [ a', b' ] of external representations of
  cancelled  polynomials.  As there is no proper multivariate GCD cancellation
  is not guaranteed to be optimal.
  
  66.24-3 HeuristicCancelPolynomialsExtRep
  
  HeuristicCancelPolynomialsExtRep( fam, ext1, ext2 )  operation
  
  is  called  by TryGcdCancelExtRepPolynomials (66.24-2) to perform the actual
  work.   It   will   return  either  fail  or  a  new  list  of  of  external
  representations  of cancelled polynomials. The cancellation performed is not
  necessarily optimal.
  

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net