2.3.2 Rings and standard bases
In order to compute with objects such as ideals, matrices, modules, and polynomial
vectors, a ring has to be defined first.
The definition of a ring consists of three parts: the first part
determines the ground field, the second part determines the names of the
ring variables, and the third part determines the monomial ordering to
be used. Thus, the above example declares a polynomial ring called
with a ground field of characteristic
(i.e., the rational
numbers) and ring variables called
dp at the end determines that the degree reverse lexicographical
ordering will be used.
Other ring declarations:
- characteristic 32003, variables
- characteristic 32003, variable names
d and lexicographical ordering.
- characteristic 7, variable names
degree reverse lexicographical ordering (
- transcendental extension of
, variable names
nu, lexicographical ordering.
- floating point numbers (single machine precision),
- floating point numbers with precision extended to 50 digits,
- complex floating point numbers with precision extended to 50 digits
and imaginary unit
- the ring of integers (see Coefficient rings),
ring r9=(integer, 60),(a,b),lp;
- the ring of integers modulo 60 (see Coefficient rings),
ring r10=(integer, 2, 10),(a,b),lp;
- the ring of integers modulo 2^10 (see Coefficient rings),
Typing the name of a ring prints its definition. The example below
shows that the default ring in SINGULAR is
degree reverse lexicographical ordering:
==> // coefficients: ZZ/32003
==> // number of vars : 3
==> // block 1 : ordering dp
==> // : names x y z
==> // block 2 : ordering C
Defining a ring makes this ring the current active basering, so each
ring definition above switches to a new basering. The concept of rings
in SINGULAR is discussed in detail in
Rings and orderings.
The basering is now
r11. Since we want to calculate in the ring
r, which we defined first, we need to switch back to it. This can
be done using the function
Once a ring is active, we can define polynomials. A monomial, say
may be entered in two ways: either using the power operator
x^3, or in short-hand notation without operator, writing
x3. Note that the short-hand notation is forbidden if a name
of the ring variable(s) consists of more than one character(see Miscellaneous oddities for details).
Note, that SINGULAR always expands brackets and automatically
sorts the terms with respect to the monomial ordering of the basering.
poly f = x3+y3+(x-y)*x2y2+z2;
size retrieves in general the number of entries in
an object. In particular, for polynomials,
size returns the
number of monomials.
A natural question is to ask if a point, e.g.,
on the variety defined by the polynomials
this we define an ideal generated by both polynomials, substitute the
coordinates of the point for the ring variables, and check if the result
poly g = f^2 *(2x-y);
ideal I = f,g;
ideal J = subst(I,var(1),1);
J = subst(J,var(2),2);
J = subst(J,var(3),0);
Since the result is not zero, the point
not lie on the variety
Another question is to decide whether some function vanishes on a
variety, or in algebraic terms, if a polynomial is contained in a given
ideal. For this we calculate a standard basis using the command
groebner and afterwards reduce the polynomial with respect to
this standard basis.
ideal sI = groebner(f);
As the result is
0 the polynomial
g belongs to the
ideal defined by
groebner, like many other functions in
SINGULAR, prints a protocol during calculations, if desired. The
option(prot); enables protocolling whereas
option(noprot); turns it off.
option, explains the meaning
of the different symbols printed during calculations.
kbase calculates a basis of the polynomial ring
modulo an ideal, if the quotient ring is finite dimensional.
As an example we calculate the Milnor number of a
hypersurface singularity in the global and local case. This is the
vector space dimension of the polynomial ring modulo the Jacobian ideal
in the global case resp. of the power series ring modulo the Jacobian
ideal in the local case. See Critical points, for a detailed
The Jacobian ideal is obtained with the command
ideal J = jacob(f);
==> // ** redefining J **
SINGULAR prints the line
// ** redefining J
**. This indicates that we had previously defined a variable with name
J of type ideal (see above).
To obtain a representing set of the quotient vector space we first
calculate a standard basis, and then apply the function
this standard basis.
J = groebner(J);
ideal K = kbase(J);
gives the desired vector space dimension
.As in SINGULAR the functions may take the input directly from
earlier calculations, the whole sequence of commands may be written
in one single statement.
When we are not interested in a basis of the quotient vector space, but
only in the resulting dimension we may even use the command