ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 19 Jul 2012 06:09:25 -0500Homology of chain complexeshttp://ask.sagemath.org/question/9159/homology-of-chain-complexes/I've got the following chain complex:
0->ZZ^2->ZZ^4->ZZ^3->0
With the boundarymaps given by
d0:(z1,z2,z3) |-> 0
d1:(z1,z2,z3,z4) |-> (-2(z1+z3+z4), 2(z1-z2), z2+z3+z4)
d2:(z1,z2)|-> (z1+z2, z1+z2,-z1,-z2)
Now I tried to compute the homology groups (e.g. H0 = ker d0 / im d1) using sage. One time manually via taking the quotients of the respective modules, one time using the ChainComplex() module. However, I don't really understand the output using the first method (e.g. what means: "Finitely generated module V/W over Integer Ring with invariants (2, 0)"), and both methods seem to deliver different results...
I've defined my boundary maps as matrices:
d0 = matrix(ZZ, 1,3,[[0,0,0]]).transpose()
d1 = matrix(ZZ, 3,4,[[-2,0,-2,-2],[2,-2,0,0],[0,1,1,1]]).transpose()
d2 = matrix(ZZ,4,2,[[1,1],[1,1],[-1,0],[0,-1]]).transpose()
Where I've taken the transpose since I'm used to write linear maps as d(x) = D*x, whereas sage seems to use d(x) = x*D, where D is the corresponding matrix.
Calculating the homology groups via
H0 = d0.kernel()/d1.image()
H1 = d1.kernel()/d2.image()
H2 = d2.kernel()
gives the following results:
H0: Finitely generated module V/W over Integer Ring with invariants (2, 0)
H1: Finitely generated module V/W over Integer Ring with invariants ()
H2: Free module of degree 2 and rank 0 over Integer Ring
whereas
ChainComplex([d0,d1,d2]).homology()
yields a different strucure.
{0: Z, 1: Z, 2: C2, 3: 0}
To maximize confusion, calculation by hand gives me H0=C2^2 x ZZ, H1=0, H2=0. I'd might have made some mistakes there, though. So I don't really konw how to interpret the results from Sage.Wed, 18 Jul 2012 02:30:25 -0500http://ask.sagemath.org/question/9159/homology-of-chain-complexes/Comment by kcrisman for <p>I've got the following chain complex:</p>
<p>0->ZZ^2->ZZ^4->ZZ^3->0</p>
<p>With the boundarymaps given by</p>
<p>d0:(z1,z2,z3) |-> 0</p>
<p>d1:(z1,z2,z3,z4) |-> (-2(z1+z3+z4), 2(z1-z2), z2+z3+z4)</p>
<p>d2:(z1,z2)|-> (z1+z2, z1+z2,-z1,-z2)</p>
<p>Now I tried to compute the homology groups (e.g. H0 = ker d0 / im d1) using sage. One time manually via taking the quotients of the respective modules, one time using the ChainComplex() module. However, I don't really understand the output using the first method (e.g. what means: "Finitely generated module V/W over Integer Ring with invariants (2, 0)"), and both methods seem to deliver different results...</p>
<p>I've defined my boundary maps as matrices:</p>
<pre><code>d0 = matrix(ZZ, 1,3,[[0,0,0]]).transpose()
d1 = matrix(ZZ, 3,4,[[-2,0,-2,-2],[2,-2,0,0],[0,1,1,1]]).transpose()
d2 = matrix(ZZ,4,2,[[1,1],[1,1],[-1,0],[0,-1]]).transpose()
</code></pre>
<p>Where I've taken the transpose since I'm used to write linear maps as d(x) = D<em>x, whereas sage seems to use d(x) = x</em>D, where D is the corresponding matrix.
Calculating the homology groups via</p>
<pre><code>H0 = d0.kernel()/d1.image()
H1 = d1.kernel()/d2.image()
H2 = d2.kernel()
</code></pre>
<p>gives the following results:</p>
<p>H0: Finitely generated module V/W over Integer Ring with invariants (2, 0)</p>
<p>H1: Finitely generated module V/W over Integer Ring with invariants ()</p>
<p>H2: Free module of degree 2 and rank 0 over Integer Ring</p>
<p>whereas</p>
<pre><code>ChainComplex([d0,d1,d2]).homology()
</code></pre>
<p>yields a different strucure.</p>
<p>{0: Z, 1: Z, 2: C2, 3: 0}</p>
<p>To maximize confusion, calculation by hand gives me H0=C2^2 x ZZ, H1=0, H2=0. I'd might have made some mistakes there, though. So I don't really konw how to interpret the results from Sage.</p>
http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19391#post-id-19391Just FYI, "Public worksheets are currently disabled."Wed, 18 Jul 2012 03:23:18 -0500http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19391#post-id-19391Comment by John Palmieri for <p>I've got the following chain complex:</p>
<p>0->ZZ^2->ZZ^4->ZZ^3->0</p>
<p>With the boundarymaps given by</p>
<p>d0:(z1,z2,z3) |-> 0</p>
<p>d1:(z1,z2,z3,z4) |-> (-2(z1+z3+z4), 2(z1-z2), z2+z3+z4)</p>
<p>d2:(z1,z2)|-> (z1+z2, z1+z2,-z1,-z2)</p>
<p>Now I tried to compute the homology groups (e.g. H0 = ker d0 / im d1) using sage. One time manually via taking the quotients of the respective modules, one time using the ChainComplex() module. However, I don't really understand the output using the first method (e.g. what means: "Finitely generated module V/W over Integer Ring with invariants (2, 0)"), and both methods seem to deliver different results...</p>
<p>I've defined my boundary maps as matrices:</p>
<pre><code>d0 = matrix(ZZ, 1,3,[[0,0,0]]).transpose()
d1 = matrix(ZZ, 3,4,[[-2,0,-2,-2],[2,-2,0,0],[0,1,1,1]]).transpose()
d2 = matrix(ZZ,4,2,[[1,1],[1,1],[-1,0],[0,-1]]).transpose()
</code></pre>
<p>Where I've taken the transpose since I'm used to write linear maps as d(x) = D<em>x, whereas sage seems to use d(x) = x</em>D, where D is the corresponding matrix.
Calculating the homology groups via</p>
<pre><code>H0 = d0.kernel()/d1.image()
H1 = d1.kernel()/d2.image()
H2 = d2.kernel()
</code></pre>
<p>gives the following results:</p>
<p>H0: Finitely generated module V/W over Integer Ring with invariants (2, 0)</p>
<p>H1: Finitely generated module V/W over Integer Ring with invariants ()</p>
<p>H2: Free module of degree 2 and rank 0 over Integer Ring</p>
<p>whereas</p>
<pre><code>ChainComplex([d0,d1,d2]).homology()
</code></pre>
<p>yields a different strucure.</p>
<p>{0: Z, 1: Z, 2: C2, 3: 0}</p>
<p>To maximize confusion, calculation by hand gives me H0=C2^2 x ZZ, H1=0, H2=0. I'd might have made some mistakes there, though. So I don't really konw how to interpret the results from Sage.</p>
http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19385#post-id-19385The phrase "Finitely generated module V/W over Integer Ring with invariants (2, 0)" means a ZZ-module isomorphic to Z/2Z + Z, by the way.Wed, 18 Jul 2012 05:57:49 -0500http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19385#post-id-19385Comment by John Palmieri for <p>I've got the following chain complex:</p>
<p>0->ZZ^2->ZZ^4->ZZ^3->0</p>
<p>With the boundarymaps given by</p>
<p>d0:(z1,z2,z3) |-> 0</p>
<p>d1:(z1,z2,z3,z4) |-> (-2(z1+z3+z4), 2(z1-z2), z2+z3+z4)</p>
<p>d2:(z1,z2)|-> (z1+z2, z1+z2,-z1,-z2)</p>
<p>Now I tried to compute the homology groups (e.g. H0 = ker d0 / im d1) using sage. One time manually via taking the quotients of the respective modules, one time using the ChainComplex() module. However, I don't really understand the output using the first method (e.g. what means: "Finitely generated module V/W over Integer Ring with invariants (2, 0)"), and both methods seem to deliver different results...</p>
<p>I've defined my boundary maps as matrices:</p>
<pre><code>d0 = matrix(ZZ, 1,3,[[0,0,0]]).transpose()
d1 = matrix(ZZ, 3,4,[[-2,0,-2,-2],[2,-2,0,0],[0,1,1,1]]).transpose()
d2 = matrix(ZZ,4,2,[[1,1],[1,1],[-1,0],[0,-1]]).transpose()
</code></pre>
<p>Where I've taken the transpose since I'm used to write linear maps as d(x) = D<em>x, whereas sage seems to use d(x) = x</em>D, where D is the corresponding matrix.
Calculating the homology groups via</p>
<pre><code>H0 = d0.kernel()/d1.image()
H1 = d1.kernel()/d2.image()
H2 = d2.kernel()
</code></pre>
<p>gives the following results:</p>
<p>H0: Finitely generated module V/W over Integer Ring with invariants (2, 0)</p>
<p>H1: Finitely generated module V/W over Integer Ring with invariants ()</p>
<p>H2: Free module of degree 2 and rank 0 over Integer Ring</p>
<p>whereas</p>
<pre><code>ChainComplex([d0,d1,d2]).homology()
</code></pre>
<p>yields a different strucure.</p>
<p>{0: Z, 1: Z, 2: C2, 3: 0}</p>
<p>To maximize confusion, calculation by hand gives me H0=C2^2 x ZZ, H1=0, H2=0. I'd might have made some mistakes there, though. So I don't really konw how to interpret the results from Sage.</p>
http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19382#post-id-19382Your formula for d2 is wrong: the third component should be -z1, not -z2. The matrices are right, I think.Thu, 19 Jul 2012 06:01:18 -0500http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19382#post-id-19382Comment by roman for <p>I've got the following chain complex:</p>
<p>0->ZZ^2->ZZ^4->ZZ^3->0</p>
<p>With the boundarymaps given by</p>
<p>d0:(z1,z2,z3) |-> 0</p>
<p>d1:(z1,z2,z3,z4) |-> (-2(z1+z3+z4), 2(z1-z2), z2+z3+z4)</p>
<p>d2:(z1,z2)|-> (z1+z2, z1+z2,-z1,-z2)</p>
<p>Now I tried to compute the homology groups (e.g. H0 = ker d0 / im d1) using sage. One time manually via taking the quotients of the respective modules, one time using the ChainComplex() module. However, I don't really understand the output using the first method (e.g. what means: "Finitely generated module V/W over Integer Ring with invariants (2, 0)"), and both methods seem to deliver different results...</p>
<p>I've defined my boundary maps as matrices:</p>
<pre><code>d0 = matrix(ZZ, 1,3,[[0,0,0]]).transpose()
d1 = matrix(ZZ, 3,4,[[-2,0,-2,-2],[2,-2,0,0],[0,1,1,1]]).transpose()
d2 = matrix(ZZ,4,2,[[1,1],[1,1],[-1,0],[0,-1]]).transpose()
</code></pre>
<p>Where I've taken the transpose since I'm used to write linear maps as d(x) = D<em>x, whereas sage seems to use d(x) = x</em>D, where D is the corresponding matrix.
Calculating the homology groups via</p>
<pre><code>H0 = d0.kernel()/d1.image()
H1 = d1.kernel()/d2.image()
H2 = d2.kernel()
</code></pre>
<p>gives the following results:</p>
<p>H0: Finitely generated module V/W over Integer Ring with invariants (2, 0)</p>
<p>H1: Finitely generated module V/W over Integer Ring with invariants ()</p>
<p>H2: Free module of degree 2 and rank 0 over Integer Ring</p>
<p>whereas</p>
<pre><code>ChainComplex([d0,d1,d2]).homology()
</code></pre>
<p>yields a different strucure.</p>
<p>{0: Z, 1: Z, 2: C2, 3: 0}</p>
<p>To maximize confusion, calculation by hand gives me H0=C2^2 x ZZ, H1=0, H2=0. I'd might have made some mistakes there, though. So I don't really konw how to interpret the results from Sage.</p>
http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19383#post-id-19383Considerng the boundary maps: it's
d0:ZZ^3->0
d1:ZZ^4->ZZ^3
d2:ZZ^2->ZZ^4
(and d3:0->ZZ^2, which I omitted)
Considering the worksheet: I edited it in the main questionThu, 19 Jul 2012 00:33:41 -0500http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19383#post-id-19383Comment by John Palmieri for <p>I've got the following chain complex:</p>
<p>0->ZZ^2->ZZ^4->ZZ^3->0</p>
<p>With the boundarymaps given by</p>
<p>d0:(z1,z2,z3) |-> 0</p>
<p>d1:(z1,z2,z3,z4) |-> (-2(z1+z3+z4), 2(z1-z2), z2+z3+z4)</p>
<p>d2:(z1,z2)|-> (z1+z2, z1+z2,-z1,-z2)</p>
<p>Now I tried to compute the homology groups (e.g. H0 = ker d0 / im d1) using sage. One time manually via taking the quotients of the respective modules, one time using the ChainComplex() module. However, I don't really understand the output using the first method (e.g. what means: "Finitely generated module V/W over Integer Ring with invariants (2, 0)"), and both methods seem to deliver different results...</p>
<p>I've defined my boundary maps as matrices:</p>
<pre><code>d0 = matrix(ZZ, 1,3,[[0,0,0]]).transpose()
d1 = matrix(ZZ, 3,4,[[-2,0,-2,-2],[2,-2,0,0],[0,1,1,1]]).transpose()
d2 = matrix(ZZ,4,2,[[1,1],[1,1],[-1,0],[0,-1]]).transpose()
</code></pre>
<p>Where I've taken the transpose since I'm used to write linear maps as d(x) = D<em>x, whereas sage seems to use d(x) = x</em>D, where D is the corresponding matrix.
Calculating the homology groups via</p>
<pre><code>H0 = d0.kernel()/d1.image()
H1 = d1.kernel()/d2.image()
H2 = d2.kernel()
</code></pre>
<p>gives the following results:</p>
<p>H0: Finitely generated module V/W over Integer Ring with invariants (2, 0)</p>
<p>H1: Finitely generated module V/W over Integer Ring with invariants ()</p>
<p>H2: Free module of degree 2 and rank 0 over Integer Ring</p>
<p>whereas</p>
<pre><code>ChainComplex([d0,d1,d2]).homology()
</code></pre>
<p>yields a different strucure.</p>
<p>{0: Z, 1: Z, 2: C2, 3: 0}</p>
<p>To maximize confusion, calculation by hand gives me H0=C2^2 x ZZ, H1=0, H2=0. I'd might have made some mistakes there, though. So I don't really konw how to interpret the results from Sage.</p>
http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19386#post-id-19386I don't understand your boundary maps, in particular d1: its codomain should be ZZ^3, but it is written in terms of z1, z2, z3, z4. Since we can't see the public worksheet, perhaps you could include the matrices here?Wed, 18 Jul 2012 05:57:01 -0500http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?comment=19386#post-id-19386Answer by roman for <p>I've got the following chain complex:</p>
<p>0->ZZ^2->ZZ^4->ZZ^3->0</p>
<p>With the boundarymaps given by</p>
<p>d0:(z1,z2,z3) |-> 0</p>
<p>d1:(z1,z2,z3,z4) |-> (-2(z1+z3+z4), 2(z1-z2), z2+z3+z4)</p>
<p>d2:(z1,z2)|-> (z1+z2, z1+z2,-z1,-z2)</p>
<p>Now I tried to compute the homology groups (e.g. H0 = ker d0 / im d1) using sage. One time manually via taking the quotients of the respective modules, one time using the ChainComplex() module. However, I don't really understand the output using the first method (e.g. what means: "Finitely generated module V/W over Integer Ring with invariants (2, 0)"), and both methods seem to deliver different results...</p>
<p>I've defined my boundary maps as matrices:</p>
<pre><code>d0 = matrix(ZZ, 1,3,[[0,0,0]]).transpose()
d1 = matrix(ZZ, 3,4,[[-2,0,-2,-2],[2,-2,0,0],[0,1,1,1]]).transpose()
d2 = matrix(ZZ,4,2,[[1,1],[1,1],[-1,0],[0,-1]]).transpose()
</code></pre>
<p>Where I've taken the transpose since I'm used to write linear maps as d(x) = D<em>x, whereas sage seems to use d(x) = x</em>D, where D is the corresponding matrix.
Calculating the homology groups via</p>
<pre><code>H0 = d0.kernel()/d1.image()
H1 = d1.kernel()/d2.image()
H2 = d2.kernel()
</code></pre>
<p>gives the following results:</p>
<p>H0: Finitely generated module V/W over Integer Ring with invariants (2, 0)</p>
<p>H1: Finitely generated module V/W over Integer Ring with invariants ()</p>
<p>H2: Free module of degree 2 and rank 0 over Integer Ring</p>
<p>whereas</p>
<pre><code>ChainComplex([d0,d1,d2]).homology()
</code></pre>
<p>yields a different strucure.</p>
<p>{0: Z, 1: Z, 2: C2, 3: 0}</p>
<p>To maximize confusion, calculation by hand gives me H0=C2^2 x ZZ, H1=0, H2=0. I'd might have made some mistakes there, though. So I don't really konw how to interpret the results from Sage.</p>
http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?answer=13832#post-id-13832Considerng the boundary maps: it's
d0:ZZ^3->0
d1:ZZ^4->ZZ^3
d2:ZZ^2->ZZ^4
(and d3:0->ZZ^2, which I omitted)
Considering the worksheet: It says: Worksheet is publicly viewable at http://www.sagenb.org/home/pub/4890 - however, I can't access it via the link either. Don't know if there's any way to fix it. Gonna edit it in the main questionThu, 19 Jul 2012 00:33:00 -0500http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?answer=13832#post-id-13832Answer by John Palmieri for <p>I've got the following chain complex:</p>
<p>0->ZZ^2->ZZ^4->ZZ^3->0</p>
<p>With the boundarymaps given by</p>
<p>d0:(z1,z2,z3) |-> 0</p>
<p>d1:(z1,z2,z3,z4) |-> (-2(z1+z3+z4), 2(z1-z2), z2+z3+z4)</p>
<p>d2:(z1,z2)|-> (z1+z2, z1+z2,-z1,-z2)</p>
<p>Now I tried to compute the homology groups (e.g. H0 = ker d0 / im d1) using sage. One time manually via taking the quotients of the respective modules, one time using the ChainComplex() module. However, I don't really understand the output using the first method (e.g. what means: "Finitely generated module V/W over Integer Ring with invariants (2, 0)"), and both methods seem to deliver different results...</p>
<p>I've defined my boundary maps as matrices:</p>
<pre><code>d0 = matrix(ZZ, 1,3,[[0,0,0]]).transpose()
d1 = matrix(ZZ, 3,4,[[-2,0,-2,-2],[2,-2,0,0],[0,1,1,1]]).transpose()
d2 = matrix(ZZ,4,2,[[1,1],[1,1],[-1,0],[0,-1]]).transpose()
</code></pre>
<p>Where I've taken the transpose since I'm used to write linear maps as d(x) = D<em>x, whereas sage seems to use d(x) = x</em>D, where D is the corresponding matrix.
Calculating the homology groups via</p>
<pre><code>H0 = d0.kernel()/d1.image()
H1 = d1.kernel()/d2.image()
H2 = d2.kernel()
</code></pre>
<p>gives the following results:</p>
<p>H0: Finitely generated module V/W over Integer Ring with invariants (2, 0)</p>
<p>H1: Finitely generated module V/W over Integer Ring with invariants ()</p>
<p>H2: Free module of degree 2 and rank 0 over Integer Ring</p>
<p>whereas</p>
<pre><code>ChainComplex([d0,d1,d2]).homology()
</code></pre>
<p>yields a different strucure.</p>
<p>{0: Z, 1: Z, 2: C2, 3: 0}</p>
<p>To maximize confusion, calculation by hand gives me H0=C2^2 x ZZ, H1=0, H2=0. I'd might have made some mistakes there, though. So I don't really konw how to interpret the results from Sage.</p>
http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?answer=13833#post-id-13833According to the documentation for `ChainComplex`, the default degree for the differential is +1. So when you say `ChainComplex([d0,d1,d2])`, you are defining a chain complex with maps
d_0: ZZ^0 --> ZZ^3,
d_1: ZZ^3 --> ZZ^4,
d_2: ZZ^4 --> ZZ^2.
Instead, you should do
sage: C = ChainComplex([d0.transpose(), d1.transpose(), d2.transpose()], degree=-1)
Then
sage: C.homology()
{0: Z x C2, 1: 0, 2: 0}
Now, regarding kernels, you could instead use `left_kernel` or `right_kernel`, depending on which side the matrix is acting, to make things more explicit. The vectors `v` so that `v*A=0` is the left kernel of A, for example. In your case, the differential d2 is injective, so it has zero kernel, so the homology in that degree is zero. The image of d2 is equal to the kernel of d1, so the homology in degree 1 is zero. I haven't thought about doing the degree zero case by hand, but see no reason not to trust Sage's answer of Z x C2.Thu, 19 Jul 2012 06:09:25 -0500http://ask.sagemath.org/question/9159/homology-of-chain-complexes/?answer=13833#post-id-13833