next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: numgens(Ring)

numgens(Ring) -- number of generators of a polynomial ring

Synopsis

Description

If the ring R is a fraction ring or a (quotient of a) polynomial ring, the number returned is the number of generators of R over the coefficient ring. In all other cases, the number of generators is zero.
i1 : numgens ZZ

o1 = 0
i2 : A = ZZ[a,b,c];
i3 : numgens A

o3 = 3
i4 : KA = frac A

o4 = KA

o4 : FractionField
i5 : numgens KA

o5 = 3
If the ring is polynomial ring over another polynomial ring, then only the outermost variables are counted.
i6 : B = A[x,y];
i7 : numgens B

o7 = 2
i8 : C = KA[x,y];
i9 : numgens C

o9 = 2
In this case, use the CoefficientRing option to generators to obtain the complete set of generators.
i10 : g = generators(B, CoefficientRing=>ZZ)

o10 = {x, y, a, b, c}

o10 : List
i11 : #g

o11 = 5
Galois fields created using GF have zero generators, but their underlying polynomial ring has one generators.
i12 : K = GF(9,Variable=>a)

o12 = K

o12 : GaloisField
i13 : numgens K

o13 = 1
i14 : R = ambient K

o14 = R

o14 : QuotientRing
i15 : numgens R

o15 = 1

See also