An ideal I is represented by its generators, which are stored inside it in a one-rowed matrix.
The ideal generated by a list of ring elements can be constructed with the function ideal.
i1 : R = ZZ/101[a..d]; |
i2 : I = ideal (a^2*b-c^2, a*b^2-d^3, c^5-d) |
If you have a matrix, then ideal will produce the ideal generated by the entries of the matrix.
i3 : f = matrix {{a^2,b^2},{c^2,d^2}} |
i4 : J = ideal f |
An interesting class of ideals can be obtained as the defining ideals in projective space of monomial curves. The twisted cubic is the closure of the set of points (1,t^1,t^2,t^3) in projective space. We use a list of the exponents and monomialCurveIdeal to get the ideal.
i5 : monomialCurveIdeal(R,{1,2,3}) |
The command substitute can be used to transfer an ideal to another ring. You may want to do this because another ring has a monomial ordering more suitable for the computations you are about to do, or it may have additional variables in it, one of which you wish to use for homogenization. Here is an example of the latter. We make another ring with a new variable t in it, transfer the ideal, and then homogenize the ideal.
i6 : S = ZZ/101[a..d,t]; |
i7 : substitute(I,S) |
i8 : homogenize(oo,t) |
In this case, the substitution was done according to the names of the variables in the two rings. There are more explicit ways to specify the substitution to be performed. Here is one where we list the new values for all the variables.
i9 : T = ZZ/101[x,y,z,t]; |
i10 : use ring I |
i11 : substitute(I,{a=>x^10,b=>y^10,c=>z^10,d=>t^10}) |
Now notice that the variable a appears to be an element of S. The creation of the ring S supplanted the earlier value.
i12 : a |
We restore the variables of R to visibility.
i13 : use R |
To recover the generators of an ideal as a matrix, use generators.
i14 : generators J |
Use the operator % to reduce a ring element with respect to a Groebner basis of the ideal.
i15 : (1+a+a^3+a^4) % J |
Membership in the ideal may be tested by comparing the answer to 0 with ==.
i16 : (1+a+a^3+a^4) % J == 0 |
i17 : a^4 % J == 0 |
The usual algebraic operations on ideals are available.
i18 : I+J |
i19 : intersect(I,J) |
i20 : I*J |
i21 : J:I |
i22 : saturate(J,I) |
i23 : radical J |
See also: intersect, Ideal : Ideal, saturate, and radical.
We may ask whether one ideal is contained in another.
i24 : isSubset(I,J) |
i25 : isSubset(I,I+J) |
i26 : isSubset(I+J,J) |
Once you have an ideal, then you may construct the quotient ring or the quotient module (there is a difference). Here is the quotient ring.
i27 : R/I |
Here is the quotient module.
i28 : M = R^1/I |
And if you want the module underlying I itself, you can get it with module.
i29 : module I |
In general, when an ideal is used as an argument to a function that usually would be given a module, we try to make an informed choice about whether the user intends the ideal to be used as a module directly, or whether the quotient module is more suitable. In homological functions such as Ext and Tor the underlying module is used. Here are some examples where the quotient module is used.
A free resolution of R^1/I can be obtained with resolution.
i30 : resolution I |
The Krull dimension or codimension of the support of the quotient module can be obtained.
i31 : dim I |
i32 : dim J |
i33 : codim I |
(Beware that for a homogeneous ideal the dimension of its projective variety is one less than the number provided by dim.)
If the dimension of the quotient module as a vector space is needed, use basis to get a matrix whose columns form a basis, and compute the dimension from it.
i34 : basis (R^1/J) |
i35 : rank source oo |
(Here oo refers to the result on the previous line.
For more information see Ideal.