up previous next
4.8.3 Coefficient Rings
As mentioned above, the coefficient ring for a CoCoA polynomial ring may be:
 1. ZZ: (arbitrarily large) integer numbers;
 2. QQ: (arbitrarily large) rational numbers;
 3. ZZ/(N): (see 
    CocoaLimits
  ) integers modulo N,
You may also use Q and Z, but from version 4.7.4 QQ and ZZ are strongly recommended for compatibility with the forthcoming version 5. The first two types of coefficients are based on the GNU-gmp library. When integers modulo N are used, the system checks whether N is a prime number and, if it is not, a warning message is given. However non-prime integers are accepted. Hence it is possible to do some work with polynomials whose coefficients are not in a field, but it is up to the user to ensure that no illegal operation will be attempted. To find the upper limit for the characteristic in the third case, see the field MaxChar returned by the function CocoaLimits ; N <= 32767 is typical. (Note: 32003 is prime)

IMPORTANT NOTE: Presently the implementation of the Buchberger algorithm for computing Groebner bases operates correctly only if polynomials have coefficients in a field. So the high level operations on ideals and modules (and the polynomial GCD) involving Groebner bases computations work only if polynomials have coefficients in a field. Otherwise it is very likely that the user will run into trouble.

CoeffRing: When creating a new ring, the word CoeffRing may be used to refer to the current coefficient ring. Examples below illustrate its use.

Example
  Use R ::= QQ[x,y];  -- coefficient ring is Q
  S ::= ZZ/(5)[t]; -- coefficient ring is the field with 5 elements
  T ::= ZZ[u,v]; -- A warning is issued if the coefficient ring
                 -- is not a field.
-- WARNING: Coeffs are not in a field
-- GBasis-related computations could fail to terminate or be wrong
-------------------------------
  Use R ::= ZZ/(2)[x,y,z]; CurrentRing();  -- these examples show the usage
                                           -- of "CoeffRing"
ZZ/(2)[x,y,z]
-------------------------------
  Use S ::= CoeffRing[a,b]; CurrentRing();
ZZ/(2)[a,b]
-------------------------------