def __init__(self, coordinate_patch = None):
        """
        Construct the algebra of differential forms on a given coordinate patch.
        See ``DifferentialForms`` for details.

        INPUT::

        - ``coordinate_patch`` -- Coordinate patch where the algebra lives.
        If no coordinate patch is given, a default coordinate patch with
        coordinates (x, y, z) is used.

        EXAMPLES::

            sage: p, q = var('p, q')
            sage: U = CoordinatePatch((p, q)); U
            Open subset of R^2 with coordinates p, q
            sage: F = DifferentialForms(U); F
            Algebra of differential forms in the variables p, q

        """

        from sage.categories.graded_algebras_with_basis \
            import GradedAlgebrasWithBasis
        from sage.structure.parent_gens import ParentWithGens

        if not coordinate_patch:
            x, y, z = var('x, y, z')
            coordinate_patch = CoordinatePatch((x, y, z))

        if not isinstance(coordinate_patch, CoordinatePatch):
            raise TypeError("%s not a valid Coordinate Patch" % coordinate_patch)
        self._patch = coordinate_patch

        ParentWithGens.__init__(self, SR, \
                                category = GradedAlgebrasWithBasis(SR))
示例#2
0
    def __init__(self, map, base_ring=None, cohomology=False):
        """
        INPUT:

        - ``map`` -- the map of simplicial complexes
        - ``base_ring`` -- a field (optional, default ``QQ``)
        - ``cohomology`` -- boolean (optional, default ``False``). If
          ``True``, return the induced map in cohomology rather than
          homology.

        EXAMPLES::

            sage: from sage.homology.homology_morphism import InducedHomologyMorphism
            sage: K = simplicial_complexes.RandomComplex(8, 3)
            sage: H = Hom(K,K)
            sage: id = H.identity()
            sage: f = InducedHomologyMorphism(id, QQ)
            sage: f.to_matrix(0) == 1  and  f.to_matrix(1) == 1  and  f.to_matrix(2) == 1
            True
            sage: f = InducedHomologyMorphism(id, ZZ)
            Traceback (most recent call last):
            ...
            ValueError: the coefficient ring must be a field
            sage: S1 = simplicial_complexes.Sphere(1).barycentric_subdivision()
            sage: S1.is_mutable()
            True
            sage: g = Hom(S1, S1).identity()
            sage: h = g.induced_homology_morphism(QQ)
            Traceback (most recent call last):
            ...
            ValueError: the domain and codomain complexes must be immutable
            sage: S1.set_immutable()
            sage: g = Hom(S1, S1).identity()
            sage: h = g.induced_homology_morphism(QQ)
        """
        if (isinstance(map.domain(), SimplicialComplex)
            and (map.domain().is_mutable() or map.codomain().is_mutable())):
                raise ValueError('the domain and codomain complexes must be immutable')
        if base_ring is None:
            base_ring = QQ
        if not base_ring.is_field():
            raise ValueError('the coefficient ring must be a field')

        self._cohomology = cohomology
        self._map = map
        self._base_ring = base_ring
        if cohomology:
            domain = map.codomain().cohomology_ring(base_ring=base_ring)
            codomain = map.domain().cohomology_ring(base_ring=base_ring)
            Morphism.__init__(self, Hom(domain, codomain,
                                        category=GradedAlgebrasWithBasis(base_ring)))
        else:
            domain = map.domain().homology_with_basis(base_ring=base_ring, cohomology=cohomology)
            codomain = map.codomain().homology_with_basis(base_ring=base_ring, cohomology=cohomology)
            Morphism.__init__(self, Hom(domain, codomain,
                                        category=GradedModulesWithBasis(base_ring)))
示例#3
0
    def __init__(self, coordinate_patch=None):
        """
        Construct the algebra of differential forms on a given coordinate patch.

        See ``DifferentialForms`` for details.

        INPUT:

        - ``coordinate_patch`` -- Coordinate patch where the algebra lives.

        If no coordinate patch is given, a default coordinate patch with
        coordinates (x, y, z) is used.

        EXAMPLES::

            sage: p, q = var('p, q')
            sage: U = CoordinatePatch((p, q)); U
            doctest:...: DeprecationWarning: Use Manifold instead.
            See http://trac.sagemath.org/24444 for details.
            Open subset of R^2 with coordinates p, q
            sage: F = DifferentialForms(U); F
            doctest:...:  DeprecationWarning: For the set of differential forms of
             degree p, use U.diff_form_module(p), where U is the base manifold
             (type U.diff_form_module? for details).
            See http://trac.sagemath.org/24444 for details.
            Algebra of differential forms in the variables p, q
        """
        from sage.categories.graded_algebras_with_basis \
            import GradedAlgebrasWithBasis
        from sage.structure.parent_gens import ParentWithGens
        from sage.misc.superseded import deprecation
        deprecation(
            24444, 'For the set of differential forms of degree p, ' +
            'use U.diff_form_module(p), where U is the base ' +
            'manifold (type U.diff_form_module? for details).')

        if not coordinate_patch:
            x, y, z = var('x, y, z')
            coordinate_patch = CoordinatePatch((x, y, z))

        if not isinstance(coordinate_patch, CoordinatePatch):
            raise TypeError("%s not a valid Coordinate Patch" %
                            coordinate_patch)
        self._patch = coordinate_patch

        ParentWithGens.__init__(self, SR, \
                                category = GradedAlgebrasWithBasis(SR))
示例#4
0
    def __init__(self, k, P, order="negdegrevlex"):
        """
        Create a :class:`PathAlgebra` object.

        Type ``PathAlgebra?`` for more information.

        INPUT:

        - ``k`` -- a commutative ring
        - ``P`` -- the partial semigroup formed by the paths of a quiver

        TESTS::

            sage: P = DiGraph({1:{2:['a']}, 2:{3:['b', 'c']}, 4:{}}).path_semigroup()
            sage: P.algebra(GF(5))
            Path algebra of Multi-digraph on 4 vertices over Finite Field of size 5
        """
        # The following hidden methods are relevant:
        #
        # - _base
        #       The base ring of the path algebra.
        # - _basis_keys
        #       Finite enumerated set containing the QuiverPaths that form the
        #       basis.
        # - _quiver
        #       The quiver of the path algebra
        # - _semigroup
        #       Shortcut for _quiver.semigroup()

        from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis
        self._quiver = P.quiver()
        self._semigroup = P
        self._ordstr = order
        super(PathAlgebra, self).__init__(
            k,
            self._semigroup,
            prefix='',
            # element_class=self.Element,
            category=GradedAlgebrasWithBasis(k),
            bracket=False)
        self._assign_names(self._semigroup.variable_names())