GAP implements a polynomial ring with countably many indeterminates.
These indeterminates can be referred to by positive integers. If only a
number num of indeterminates is required they default to [1..num].
It is possible to assign names to indeterminates. These names only
provide a means for printing the indeterminates in a nice way, but have
not necessary any relations to variable names. Indeterminates that have
not been assigned a name will be printed as ``x_nr''.
It is possible to assign the same name to different indeterminates (though it is probably not a good idea to do so). Asking twice for an indeterminate with the name nam will produce two different indeterminates!
When asking for indeterminates with certain
names, GAP usually will take the first 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.
Indeterminate( R, [nr] ) O
Indeterminate( R, [avoid] ) O
Indeterminate( R, name[, avoid] ) O
returns 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 avoid. The third usage returns an indeterminate called name (also avoiding the indeterminates in avoid if given).
gap> a:=Indeterminate(GF(3)); x_1 gap> x:=Indeterminate(GF(3),"x"); x gap> Indeterminate(GF(3),"x")=x; false gap> y:=Indeterminate(GF(3),"y");z:=Indeterminate(GF(3),"X"); y X gap> Indeterminate(GF(3),3); y gap> Indeterminate(GF(3),[y,z]); x
IndeterminateNumberOfUnivariateRationalFunction( rfun ) A
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
and IsLaurentPolynomialDefaultRep).
IndeterminateOfUnivariateRationalFunction( rfun ) A
returns the indeterminate in which the univariate rational function rfun is expressed. (cf. IndeterminateNumberOfUnivariateRationalFunction.)
gap> IndeterminateNumberOfUnivariateRationalFunction(z); 4 gap> IndeterminateOfUnivariateRationalFunction(z^5+z); X
IndeterminateName( fam, nr ) O
HasIndeterminateName( fam, nr ) O
SetIndeterminateName( fam, nr, name ) O
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
gap> IndeterminateName(FamilyObj(x),3); "y" gap> HasIndeterminateName(FamilyObj(x),5); 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.
gap> a:=Indeterminate(GF(3),5); x_5 gap> SetName(a,"ah"); gap> a^5+a; ah+ah^5
CIUnivPols( upol, upol ) F
This function (whose name stands for
``CommonIndeterminateOfUnivariatePolynomials'') 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.
GAP 4 manual