<?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>making chain complexes by hand</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_manipulating_spchain_spcomplexes.html">next</a> | <a href="_extracting_spinformation_spfrom_spchain_spcomplexes.html">previous</a> | <a href="_manipulating_spchain_spcomplexes.html">forward</a> | <a href="_extracting_spinformation_spfrom_spchain_spcomplexes.html">backward</a> | <a href="_chain_spcomplexes.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="_chain_spcomplexes.html" title="">chain complexes</a> > <a href="_making_spchain_spcomplexes_spby_sphand.html" title="">making chain complexes by hand</a></div> <hr/> <div><h1>making chain complexes by hand</h1> <div>A new chain complex can be made with <tt>C = new ChainComplex</tt>. This will automatically initialize <tt>C.dd</tt>, in which the differentials are stored. The modules can be installed with statements like <tt>C#i=M</tt> and the differentials can be installed with statements like <tt>C.dd#i=d</tt>. The ring is installed with <tt>C.ring = R</tt>. It's up to the user to ensure that the composite of consecutive differential maps is zero.<table class="examples"><tr><td><pre>i1 : R = QQ[x,y,z];</pre> </td></tr> <tr><td><pre>i2 : d1 = matrix {{x,y}}; 1 2 o2 : Matrix R <--- R</pre> </td></tr> </table> We take care to use <a href="_map.html" title="make a map">map</a> to ensure that the target of <tt>d2</tt> is exactly the same as the source of <tt>d1</tt>.<table class="examples"><tr><td><pre>i3 : d2 = map(source d1, ,{{y*z},{-x*z}}); 2 1 o3 : Matrix R <--- R</pre> </td></tr> <tr><td><pre>i4 : d1 * d2 == 0 o4 = true</pre> </td></tr> </table> Now we make the chain complex, as explained above.<table class="examples"><tr><td><pre>i5 : C = new ChainComplex; C.ring = R;</pre> </td></tr> <tr><td><pre>i7 : C#0 = target d1; C#1 = source d1; C#2 = source d2;</pre> </td></tr> <tr><td><pre>i10 : C.dd#1 = d1; C.dd#2 = d2; 1 2 o10 : Matrix R <--- R 2 1 o11 : Matrix R <--- R</pre> </td></tr> </table> Our complex is ready to use.<table class="examples"><tr><td><pre>i12 : C 1 2 1 o12 = R <-- R <-- R 0 1 2 o12 : ChainComplex</pre> </td></tr> <tr><td><pre>i13 : HH_0 C o13 = cokernel | x y | 1 o13 : R-module, quotient of R</pre> </td></tr> <tr><td><pre>i14 : prune HH_1 C o14 = cokernel {2} | z | 1 o14 : R-module, quotient of R</pre> </td></tr> </table> The chain complex we've just made is simple, in the sense that it's a homological chain complex with nonzero modules in degrees 0, 1, ..., n. Such a chain complex can be made also with <a href="_chain__Complex.html" title="make a chain complex">chainComplex</a>. It goes to a bit of extra trouble to adjust the differentials to match the degrees of the basis elements.<table class="examples"><tr><td><pre>i15 : D = chainComplex(matrix{{x,y}}, matrix {{y*z},{-x*z}}) 1 2 1 o15 = R <-- R <-- R 0 1 2 o15 : ChainComplex</pre> </td></tr> <tr><td><pre>i16 : degrees source D.dd_2 o16 = {{3}} o16 : List</pre> </td></tr> </table> </div> </div> </body> </html>