up previous next
2.9.2 Polynomial Rings
CoCoA starts with the default (polynomial) ring R = QQ[x,y,z] . There is a simplyfied syntax for defining a polynomial ring; it must be preceded by the command use or by the symbol ::=
     R ::= C[X:INDETS];           use C[X:INDETS];  
     R ::= C[X:INDETS], O;        use C[X:INDETS], O;
where R is the identifier of a CoCoALanguage variable, C is a RING is an expression defining a coefficient ring (ZZ, QQ or ZZ/(N)), X is an expression that defines the indeterminates, and the O is a pre-defined ordering ( lex , deglex , degrevlex ).

The modifiers are used to modify the default settings of the base ring. The modifiers are of three classes: term-orderings, weights, term orderings for modules. These classes are discussed in separate sections below. It is possible to have no modifiers. The default values are: DegRevLex for the term-ordering, 1 for the weight of each indeterminate, and ToPos for the module term-ordering.

After the ring is defined using the above syntax, it can be made to be the current ring with the command use .

Example
  Use R ::= QQ[x,y,z];  -- define and use the ring R
  S ::= ZZ/(103)[x,y], Lex; -- define the ring S with Lex term-ordering
  CurrentRing();  -- the current ring is still R
QQ[x,y,z]
-------------------------------
  Use S; -- now the ring S is the current ring
ZZ/(103)[x,y]
-------------------------------
  Using R Do X := z^2-3 EndUsing;  -- define a variable in R (not the current
                                   -- ring)
  Y := R::x^2+y^2+z^2;  -- another way of defining a variable in R while
                        -- S is the current ring
  T ::= QQ[x[1..4],y[1..5,1..5]], Elim(y[1..5,1]), ToPos; -- a more
                                                          -- complicated ring