next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: manipulating modules

manipulating modules

Suppose we have a module that is represented as an image of a matrix, and we want to represent it as a cokernel of a matrix. This task may be accomplished with prune.
i1 : R = QQ[x,y];
i2 : I = ideal vars R

o2 = ideal (x, y)

o2 : Ideal of R
i3 : M = image vars R

o3 = image | x y |

                             1
o3 : R-module, submodule of R
i4 : N = prune M

o4 = cokernel {1} | -y |
              {1} | x  |

                            2
o4 : R-module, quotient of R
The isomorphism between them may be found under the key pruningMap.
i5 : f = N.cache.pruningMap

o5 = {1} | 1 0 |
     {1} | 0 1 |

o5 : Matrix
i6 : isIsomorphism f

o6 = true
i7 : f^-1

o7 = {1} | 1 0 |
     {1} | 0 1 |

o7 : Matrix
The matrix form of f looks nondescript, but the map knows its source and target
i8 : source f

o8 = cokernel {1} | -y |
              {1} | x  |

                            2
o8 : R-module, quotient of R
i9 : target f

o9 = image | x y |

                             1
o9 : R-module, submodule of R
It's a 2 by 2 matrix because M and N are both represented as modules with two generators.

Functions for finding related modules:

i10 : super M

       1
o10 = R

o10 : R-module, free
i11 : cover N

       2
o11 = R

o11 : R-module, free, degrees {2:1}
Some simple operations on modules:
i12 : M ++ N

o12 = subquotient ({0} | x y 0 0 |, {0} | 0  |)
                   {1} | 0 0 1 0 |  {1} | -y |
                   {1} | 0 0 0 1 |  {1} | x  |

                                3
o12 : R-module, subquotient of R
i13 : M ** N

o13 = cokernel {2} | -y 0  -y 0  |
               {2} | x  0  0  -y |
               {2} | 0  -y x  0  |
               {2} | 0  x  0  x  |

                             4
o13 : R-module, quotient of R
Ideals and modules behave differently when making powers:
i14 : M^3

o14 = image | x y 0 0 0 0 |
            | 0 0 x y 0 0 |
            | 0 0 0 0 x y |

                              3
o14 : R-module, submodule of R
i15 : I^3

              3   2      2   3
o15 = ideal (x , x y, x*y , y )

o15 : Ideal of R