Macaulay2 » Documentation
Packages » Macaulay2Doc » A first course in commutative algebra » M2SingularBook » Singular Book 2.1.7
next | previous | forward | backward | up | index | toc

# Singular Book 2.1.7 -- maps induced by Hom

    i1 : A = QQ[x,y,z]

    o1 = A

    o1 : PolynomialRing

    i2 : M = matrix(A, {{1,2,3},{4,5,6},{7,8,9}})

    o2 = | 1 2 3 |
         | 4 5 6 |
         | 7 8 9 |

                 3      3
    o2 : Matrix A  <-- A

    i3 : Hom(M,A^2)

    o3 = | 1 0 4 0 7 0 |
         | 0 1 0 4 0 7 |
         | 2 0 5 0 8 0 |
         | 0 2 0 5 0 8 |
         | 3 0 6 0 9 0 |
         | 0 3 0 6 0 9 |

                 6      6
    o3 : Matrix A  <-- A

    i4 : Hom(A^2,M)

    o4 = | 1 2 3 0 0 0 |
         | 4 5 6 0 0 0 |
         | 7 8 9 0 0 0 |
         | 0 0 0 1 2 3 |
         | 0 0 0 4 5 6 |
         | 0 0 0 7 8 9 |

                 6      6
    o4 : Matrix A  <-- A

Notice that the basis that Macaulay2 uses for Hom(A^3,A^2) is different than the basis used by Singular.

The function contraHom of the Singular book in example 2.1.7 could be coded in the following way.

    i5 : contraHom = (M, s) -> (
             (n,m) := (numgens target M, numgens source M);
             R := mutableMatrix(ring M, s*n, s*m);
             for b from 0 to m-1 do
               for a from 0 to s-1 do
                 for c from 0 to n-1 do
                   R_(a*n+c,a*m+b) = M_(b,c);
             matrix R
             )

    o5 = contraHom

    o5 : FunctionClosure

Let's try an example.

    i6 : contraHom(M,2)

    o6 = | 1 4 7 0 0 0 |
         | 2 5 8 0 0 0 |
         | 3 6 9 0 0 0 |
         | 0 0 0 1 4 7 |
         | 0 0 0 2 5 8 |
         | 0 0 0 3 6 9 |

                 6      6
    o6 : Matrix A  <-- A

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