up previous next
1.1.8 Tutorial: polynomial rings, use command

When you want to do a computation in CoCoA5, the first thing you
need to do is tell CoCoA5 in which ring to compute. The
use
command informs CoCoA5 about this. The most convenient method does
two things at once: it creates the polynomial ring, and then chooses
that ring as the "current ring".
Once the correct current ring has been selected, you may type in
polynomials using a natural syntax; note that you must use
*
to
denote all products (e.g. between coefficients and indeterminates,
or even between powers of indeterminates).
The most common coefficient fields are the rationals (denoted by
QQ
)
and small prime finite fields (denoted by
ZZ/(p)
).
/**/ use P ::= QQ[x,y]; // polys in x,y with coefficients in QQ
/**/ (x+y)^2;
x^2 + 2*x*y + y^2
/**/ use ZZ/(2)[a,b]; // polys in a,b with coefficients in ZZ/(2)
/**/ (a+b)^2;
a^2 + b^2
/**/ use QQ[x,y,z],lex; // polys in x,y,z, coeffs in QQ, term order "lex"
/**/ x+y^2;
x + y^2
