from ideals to modules
An ideal
I is also an
Rsubmodule. In Macaulay2 we distinguish between when we are thinking of
I as as ideal or a module. If it is first defined as an ideal, it is easily turned into a module using the function
module and for any submodule of the rank one free module
R we can obtain an ideal of the generators using the function
ideal.
i1 : R = ZZ/32003[x,y,z];

i2 : I = ideal(x^2,y*zx);
o2 : Ideal of R

i3 : module I
o3 = image  x2 yzx 
1
o3 : Rmodule, submodule of R

from modules to ideals
For any submodule of the rank one free module
R we can obtain an ideal of the generators using the function
ideal.
i4 : A = matrix{{x*yz,z^3}};
1 2
o4 : Matrix R < R

i5 : M = image A
o5 = image  xyz z3 
1
o5 : Rmodule, submodule of R

i6 : ideal M
3
o6 = ideal (x*y  z, z )
o6 : Ideal of R

getting the quotient module corresponding to an ideal
We also often work with
R/I as an
Rmodule. Simply typing
R/I at a prompt in Macaulay2 constructs the quotient ring (see
quotient rings). There are two ways to tell Macaulay2 that we want to work with this as a module.
i7 : coker generators I
o7 = cokernel  x2 yzx 
1
o7 : Rmodule, quotient of R

i8 : R^1/I
o8 = cokernel  x2 yzx 
1
o8 : Rmodule, quotient of R

modules versus ideals for computations
Some functions in Macaulay2 try to make an informed decision about ideal and modules. For example, if
resolution is given an ideal
I, it will compute a resolution of the module
R^1/I, as in the following example.
i9 : resolution I
1 2 1
o9 = R < R < R < 0
0 1 2 3
o9 : ChainComplex

The functions
dim and
degree also operate on
R^1/I if the input is
I or
R^1/I. However, the function
hilbertPolynomial computes the Hilbert polynomial of the module
I if the input is
hilbertPolynomial I.
For basic information about working with modules see
modules.