Macaulay2 » Documentation
Packages » Macaulay2Doc » ideals » extracting generators of an ideal » generators of rings, ideals, and modules
next | previous | forward | backward | up | index | toc

# generators of rings, ideals, and modules

## get a single generator of a ring, ideal, or module

- Usage:
    `L_i`
- Inputs:
  - L, a ring, an ideal, a module, or a matrix
  - i, an integer
- Outputs:
  - a ring element or a vector the i-th generator or column of L

## get the list of generators of a ring, ideal, or module

- Usage:
    `M_*`
- Inputs:
  - M, a ring, an ideal, or a module
- Outputs:
  - a list

As usual in Macaulay2, the first generator has index zero.

    i1 : R = QQ[a..d];

    i2 : numgens R

    o2 = 4

    i3 : R_2

    o3 = c

    o3 : R

    i4 : R_*

    o4 = {a, b, c, d}

    o4 : List

    i5 : I = ideal(a^3, b^3-c^3, a^4, a*c);

    o5 : Ideal of R

    i6 : numgens I

    o6 = 4

    i7 : I_0, I_2

           3   4
    o7 = (a , a )

    o7 : Sequence

    i8 : I_*

           3   3    3   4
    o8 = {a , b  - c , a , a*c}

    o8 : List

Notice that the generators are the ones provided. Alternatively we can minimalize the set of generators.

    i9 : J = trim I

                      3    3   3
    o9 = ideal (a*c, b  - c , a )

    o9 : Ideal of R

    i10 : J_0

    o10 = a*c

    o10 : R

Elements of modules are useful for producing submodules or quotients.

    i11 : M = cokernel matrix{{a,b},{c,d}}

    o11 = cokernel | a b |
                   | c d |

                                 2
    o11 : R-module, quotient of R

    i12 : M_0

    o12 = | 1 |
          | 0 |

    o12 : M

    i13 : M_*

    o13 = {| 1 |, | 0 |}
           | 0 |  | 1 |

    o13 : List

    i14 : M/M_0

    o14 = cokernel | 1 a b |
                   | 0 c d |

                                 2
    o14 : R-module, quotient of R

    i15 : N = M/(a*M + R*M_0)

    o15 = cokernel | a 0 1 a b |
                   | 0 a 0 c d |

                                 2
    o15 : R-module, quotient of R

    i16 : N_0 == 0_N

    o16 = true

Columns of matrices may also be used as vectors in the target module.

    i17 : M = matrix{{a,b,c},{c,d,a},{a-1,b-3,c-13}}

    o17 = | a   b   c    |
          | c   d   a    |
          | a-1 b-3 c-13 |

                  3      3
    o17 : Matrix R  <-- R

    i18 : M_0

    o18 = |  a  |
          |  c  |
          | a-1 |

           3
    o18 : R

    i19 : prune((image M_{1,2})/(R*M_1))

           1
    o19 = R

    o19 : R-module, free

## Caveat

Fewer methods exist for manipulating vectors than other types, such as modules and matrices

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/operators/underscore.m2:329:0.