Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #31669: add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mjungmath committed May 6, 2021
1 parent c66dd12 commit 4cd7c03
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions src/sage/categories/chain_complexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#*****************************************************************************

from .category_types import Category_module
from .modules import Modules
from .commutative_additive_groups import CommutativeAdditiveGroups
from .functor import Functor
from sage.misc.abstract_method import abstract_method

Expand Down Expand Up @@ -121,7 +121,11 @@ def lift_from_homology(self, x):
EXAMPLES::
...
sage: E3 = EuclideanSpace(3)
sage: C = E3.de_rham_complex()
sage: one = C.homology().one()
sage: C.lift_from_homology(one)
Mixed differential form one on the Euclidean space E^3
"""

Expand All @@ -138,12 +142,16 @@ def reduce_to_homology(self, x, n=None):
EXAMPLES::
...
sage: E3 = EuclideanSpace(3)
sage: C = E3.de_rham_complex()
sage: one = C.one()
sage: C.reduce_to_homology(one)
[one]
"""
try:
# try coercion
self.homology(n)(x)
return self.homology(n)(x)
except TypeError:
# if not, this methods needs to be overwritten by parent
raise NotImplementedError
Expand Down Expand Up @@ -207,7 +215,7 @@ def __init__(self, domain, n=None):
"""
if not isinstance(domain, ChainComplexes):
raise TypeError(f'{domain} must be a category of chain complexes')
codomain = Modules(domain.base_ring())
codomain = CommutativeAdditiveGroups()
super().__init__(domain, codomain)
self.__n = n

Expand All @@ -231,12 +239,20 @@ def _apply_functor_to_morphism(self, f):
TESTS:
...
sage: E3 = EuclideanSpace(3)
sage: C = E3.de_rham_complex()
sage: id = Hom(C, C).identity()
sage: H = HomologyFunctor(ChainComplexes(SR))
sage: id_star = H(id); id_star
Generic endomorphism of De Rham cohomology ring on the
Euclidean space E^3
sage: one = C.one()
sage: id_star(one)
[one]
"""
from .morphism import SetMorphism
from .homset import Hom
from .commutative_additive_groups import CommutativeAdditiveGroups

domain = f.domain()
codomain = f.codomain()
Expand Down

0 comments on commit 4cd7c03

Please sign in to comment.