<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>Singular Book 2.1.7 -- maps induced by Hom</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="___Singular_sp__Book_sp2.1.10.html">next</a> | <a href="___Singular_sp__Book_sp2.1.6.html">previous</a> | <a href="___Singular_sp__Book_sp2.1.10.html">forward</a> | <a href="___Singular_sp__Book_sp2.1.6.html">backward</a> | <a href="___M2__Singular__Book.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="_basic_spcommutative_spalgebra.html" title="">basic commutative algebra</a> > <a href="___M2__Singular__Book.html" title="Macaulay2 examples for the Singular book">M2SingularBook</a> > <a href="___Singular_sp__Book_sp2.1.7.html" title="maps induced by Hom">Singular Book 2.1.7</a></div> <hr/> <div><h1>Singular Book 2.1.7 -- maps induced by Hom</h1> <div><table class="examples"><tr><td><pre>i1 : A = QQ[x,y,z] o1 = A o1 : PolynomialRing</pre> </td></tr> <tr><td><pre>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</pre> </td></tr> <tr><td><pre>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</pre> </td></tr> <tr><td><pre>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</pre> </td></tr> </table> Notice that the basis that Macaulay2 uses for Hom(A^3,A^2) is different than the basis used by Singular.<p/> The function contraHom of the Singular book in example 2.1.7 could be coded in the following way.<table class="examples"><tr><td><pre>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</pre> </td></tr> </table> Let's try an example.<table class="examples"><tr><td><pre>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</pre> </td></tr> </table> </div> </div> </body> </html>