up previous next
1.1.9 Tutorial: polynomials
If you are new to CoCoA-5, we recommend that you read first the Tutorial: polynomial rings, use command .

A complete list of the functions and commands which operate on or return a polynomial can be obtained by looking up "RINGELEM" in the on-line manual.

In addition to the usual arithmetic operations, CoCoA-5 offers several functions for looking "inside" a polynomial. We give some examples here. Each non-zero polynomial has a leading monomial (see LM ), a leading coefficient (see LC ), and a leading term (see LT and LPP ).

One may also extract all monomials (see monomials ), all coefficients (see coefficients ), and all power-products (see support ). In each case the lists have the same order as in the polynomial itself.

There are more advanced functions for exploring the structure of a polynomial: see for instance CoefficientsWRT , CoeffListWRT , and CoeffOfTerm .

Example
/**/ use P ::= QQ[x,y];  // polys in x,y with coefficients in QQ
/**/ f := (2*x^2+y)^3; f;
8*x^6 +12*x^4*y +6*x^2*y^2 +y^3
/**/ [LM(f), LC(f), LT(f)];
[8*x^6,  8,  x^6]
/**/ monomials(f);
[8*x^6,  12*x^4*y,  6*x^2*y^2,  y^3]
/**/ coefficients(f);
[8,  12,  6,  1]
/**/ support(f);
[x^6,  x^4*y,  x^2*y^2,  y^3]
/**/ CoeffListWRT(f,x);
[y^3,  0,  6*y^2,  0,  12*y,  0,  8]