Opened 10 years ago
Closed 6 years ago
#6100 closed enhancement (fixed)
give a basis for homology and cohomology of chain complexes in terms of given generators
Reported by: | bantieau | Owned by: | jhpalmieri |
---|---|---|---|
Priority: | minor | Milestone: | sage-5.11 |
Component: | algebraic topology | Keywords: | |
Cc: | jhpalmieri, bantieau | Merged in: | sage-5.11.beta0 |
Authors: | Shaun Ault, Travis Scrimshaw | Reviewers: | John Palmieri, Volker Braun |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #5882 | Stopgaps: |
Description (last modified by )
Add functionality so that we can compute a basis for (co)homology in dimension n of a chain complex C_* in terms of a given basis for C_n.
Attachments (3)
Change History (12)
comment:1 Changed 10 years ago by
- Cc bantieau added
Changed 9 years ago by
comment:2 follow-up: ↓ 3 Changed 9 years ago by
- Report Upstream set to N/A
- Status changed from new to needs_review
Generators of homology now computable via generators=true option in the homology() method of chain_complex.
Known issues: If S is a simplicial complex, S.homology(generators=true) has not been directly implemented. Furthermore, S.chain_complex().homology(generators=true) computes the generators based on the order in which simplices are chosen for computing S.chain_complex() -- which is not guaranteed to be the same order in which simplices are listed in S.
comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4 Changed 9 years ago by
- Reviewers set to John Palmieri
- Status changed from needs_review to needs_work
Replying to sault:
Thanks for working on this; I hope we can get it into shape soon, and then into Sage.
Known issues: If S is a simplicial complex, S.homology(generators=true) has not been directly implemented.
I know a good way to deal with this, and I'll eventually submit a patch on another ticket that takes care of it (as part of an implementation of cubical complexes and Delta-complexes, among other things).
Furthermore, S.chain_complex().homology(generators=true) computes the generators based on the order in which simplices are chosen for computing S.chain_complex() -- which is not guaranteed to be the same order in which simplices are listed in S.
I wonder what we can do to fix this. It might be a lot of work; I'm not sure. Maybe when we build the chain complex, modify the cached list of simplices of S? This is something to think about for another ticket, not this one.
There are three problems with this patch: the main one is that it doesn't work with field coefficients:
sage: T = simplicial_complexes.Torus() sage: C = T.chain_complex() sage: C.homology(base_ring=QQ, generators=True) {0: Vector space of dimension 1 over Rational Field, 1: Vector space of dimension 2 over Rational Field, 2: (Vector space of dimension 1 over Rational Field, [ 1 -1 -1 -1 1 -1 -1 1 1 1 1 1 -1 -1])}
It only returns generators in dimensions where there is no incoming differential. When you fix this, add a doctest like
sage: T = simplicial_complexes.Torus() sage: C = T.chain_complex() sage: C.homology(1, base_ring=QQ, generators=True) ???
The second problem is the documentation: you should explain (briefly) the format of the output when "generators" is True: it's giving a matrix, and you should say exactly what this matrix represents.
The third issue is minor: the indentation in the docstrings is important, but you changed it, so it gives errors when producing the reference manual. The docstring itself also looks bad: from the notebook, define a chain complex C and evaluate "C.homology?" to see what the formatted docstring looks like. Or do browse_sage_doc(C.homology)
from the command line.
comment:4 in reply to: ↑ 3 Changed 9 years ago by
Replying to jhpalmieri:
Thanks John, for reviewing this patch and for spotting the bugs/omissions. I'll be working on this today and I hope to get it up to speed soon.
-S
Replying to sault:
Thanks for working on this; I hope we can get it into shape soon, and then into Sage.
Known issues: If S is a simplicial complex, S.homology(generators=true) has not been directly implemented.
I know a good way to deal with this, and I'll eventually submit a patch on another ticket that takes care of it (as part of an implementation of cubical complexes and Delta-complexes, among other things).
Furthermore, S.chain_complex().homology(generators=true) computes the generators based on the order in which simplices are chosen for computing S.chain_complex() -- which is not guaranteed to be the same order in which simplices are listed in S.
I wonder what we can do to fix this. It might be a lot of work; I'm not sure. Maybe when we build the chain complex, modify the cached list of simplices of S? This is something to think about for another ticket, not this one.
There are three problems with this patch: the main one is that it doesn't work with field coefficients:
sage: T = simplicial_complexes.Torus() sage: C = T.chain_complex() sage: C.homology(base_ring=QQ, generators=True) {0: Vector space of dimension 1 over Rational Field, 1: Vector space of dimension 2 over Rational Field, 2: (Vector space of dimension 1 over Rational Field, [ 1 -1 -1 -1 1 -1 -1 1 1 1 1 1 -1 -1])}It only returns generators in dimensions where there is no incoming differential. When you fix this, add a doctest like
sage: T = simplicial_complexes.Torus() sage: C = T.chain_complex() sage: C.homology(1, base_ring=QQ, generators=True) ???The second problem is the documentation: you should explain (briefly) the format of the output when "generators" is True: it's giving a matrix, and you should say exactly what this matrix represents.
The third issue is minor: the indentation in the docstrings is important, but you changed it, so it gives errors when producing the reference manual. The docstring itself also looks bad: from the notebook, define a chain complex C and evaluate "C.homology?" to see what the formatted docstring looks like. Or do
browse_sage_doc(C.homology)
from the command line.
comment:5 Changed 9 years ago by
Hi Shaun,
You should also look at ticket #8302, which now has a positive review and so should be merged some time soon. You might want to base your patches on that. In particular, you should look at how keywords are passed between the various homology and chain complex methods, and you should look at how the Sage interface to CHomP returns generators. Your patch should be consistent with that (and you could add to the file homology/tests.py -- added in #8302 -- to test that your patch and CHomP produce compatible results).
Since you're just dealing with generators for chain complexes, I don't know if it's worth putting a warning in the homology method for cell complexes, or at least in the docstring: if someone asks for generators and they don't have chomp installed, it will pass generators=True
to the homology method for chain complexes, and therefore will produce something using your code, but it may not be what the user expects (since it will be in terms of the chain complex, not the simplicial complex). Probably a warning in the docstring is appropriate now, and in another ticket, we can try to translate the chain complex information back to simplicial complex information somehow.
Changed 6 years ago by
comment:6 Changed 6 years ago by
- Description modified (diff)
- Status changed from needs_work to needs_review
I've uploaded a patch which combines the two previous patches and hopefully addresses the issues you've mentioned.
For patchbot:
Apply: trac_6100-basis_homology-ts.patch
comment:7 Changed 6 years ago by
- Dependencies set to #5882
- Description modified (diff)
- Reviewers changed from John Palmieri to John Palmieri, Volker Braun
- Status changed from needs_review to positive_review
Looks good to me.
comment:8 Changed 6 years ago by
- Milestone changed from sage-5.10 to sage-5.11
comment:9 Changed 6 years ago by
- Merged in set to sage-5.11.beta0
- Resolution set to fixed
- Status changed from positive_review to closed
main patch, implementing generators