Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 4552

Macaulay2-1.3.1-8.fc15.i686.rpm

<?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>inputting a matrix</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_projections_cm_spinclusions_cm_spand_sppermutations.html">next</a> | <a href="_matrices.html">previous</a> | <a href="_projections_cm_spinclusions_cm_spand_sppermutations.html">forward</a> | backward | <a href="_matrices.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="_matrices.html" title="">matrices</a> > <a href="_inputting_spa_spmatrix.html" title="">inputting a matrix</a></div>
<hr/>
<div><h1>inputting a matrix</h1>
<div><h2>by its entries</h2>
Using the function <a href="_matrix.html" title="make a matrix">matrix</a> is the most basic method for inputting a matrix.  The entries are typed in by rows.<table class="examples"><tr><td><pre>i1 : R = ZZ/5[s..z];</pre>
</td></tr>
<tr><td><pre>i2 : M = matrix {{ x^2+y, z^3}, {y^3-z,3*z-6*x-5*y}}

o2 = | x2+y z3    |
     | y3-z -x-2z |

             2       2
o2 : Matrix R  &lt;--- R</pre>
</td></tr>
</table>
<h2>by a function</h2>
The function <a href="_map.html" title="make a map">map</a> can be used to construct matrices. <table class="examples"><tr><td><pre>i3 : G = map(R^3,3,(i,j)->R_i^j)

o3 = | 1 s s2 |
     | 1 t t2 |
     | 1 u u2 |

             3       3
o3 : Matrix R  &lt;--- R</pre>
</td></tr>
<tr><td><pre>i4 : f = 3*s^2*v-t*u*v+s*t^2

        2     2
o4 = s*t  - 2s v - t*u*v

o4 : R</pre>
</td></tr>
<tr><td><pre>i5 : H = map(R^4,R^4,(i,j)->diff(R_j*R_i,f))

o5 = | v  2t 0  s  |
     | 2t 2s -v -u |
     | 0  -v 0  -t |
     | s  -u -t 0  |

             4       4
o5 : Matrix R  &lt;--- R</pre>
</td></tr>
</table>
<h2>identity matrix</h2>
The function <a href="_id.html" title="identity map">id</a> is used to form the identity matrix as a map from a module to itself.  <table class="examples"><tr><td><pre>i6 : id_(R^3)

o6 = | 1 0 0 |
     | 0 1 0 |
     | 0 0 1 |

             3       3
o6 : Matrix R  &lt;--- R</pre>
</td></tr>
<tr><td><pre>i7 : id_(source M)

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

             2       2
o7 : Matrix R  &lt;--- R</pre>
</td></tr>
</table>
The first example gives a 3x3 identity matrix with entries in the ring R.  The second gives a 2x2 identity matrix whose source and target are the (graded) source of the matrix <tt>M</tt>.</div>
</div>
</body>
</html>