Beispiel #1
0
    def __init__(self, fmodule, degree, name=None, latex_name=None):
        r"""
        TESTS::

            sage: from sage.tensor.modules.ext_pow_free_module import ExtPowerFreeModule
            sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
            sage: e = M.basis('e')
            sage: A = ExtPowerFreeModule(M, 2) ; A
            2nd exterior power of the Rank-3 free module M over the
             Integer Ring
            sage: TestSuite(A).run()

        """
        from sage.functions.other import binomial
        self._fmodule = fmodule
        self._degree = degree
        rank = binomial(fmodule._rank, degree)
        if name is None and fmodule._name is not None:
            name = r'/\^{}('.format(degree) + fmodule._name + ')'
        if latex_name is None and fmodule._latex_name is not None:
            latex_name = r'\Lambda^{' + str(degree) + r'}\left(' + \
                                       fmodule._latex_name + r'\right)'
        FiniteRankFreeModule.__init__(self, fmodule._ring, rank,
                                      name=name, latex_name=latex_name,
                                      start_index=fmodule._sindex,
                             output_formatter=fmodule._output_formatter)
        # Unique representation:
        if self._degree == 1 or \
           self._degree in self._fmodule._exterior_powers:
            raise ValueError("the {}th exterior power of ".format(degree) +
                             "{}".format(self._fmodule) +
                             " has already been created")
        else:
            self._fmodule._exterior_powers[self._degree] = self
    def __init__(self, fmodule, tensor_type, name=None, latex_name=None):
        r"""
        TESTS::

            sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
            sage: T = M.tensor_module(2, 3)
            sage: TestSuite(T).run()

        """
        self._fmodule = fmodule
        self._tensor_type = tuple(tensor_type)
        rank = pow(fmodule._rank, tensor_type[0] + tensor_type[1])
        if self._tensor_type == (0, 1):  # case of the dual
            if name is None and fmodule._name is not None:
                name = fmodule._name + '*'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = fmodule._latex_name + r'^*'
        else:
            if name is None and fmodule._name is not None:
                name = 'T^' + str(self._tensor_type) + '(' + fmodule._name + \
                       ')'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = r'T^{' + str(self._tensor_type) + r'}\left(' + \
                             fmodule._latex_name + r'\right)'
        FiniteRankFreeModule.__init__(
            self,
            fmodule._ring,
            rank,
            name=name,
            latex_name=latex_name,
            start_index=fmodule._sindex,
            output_formatter=fmodule._output_formatter)
        fmodule._all_modules.add(self)
    def __init__(self, fmodule, degree, name=None, latex_name=None):
        r"""
        TESTS::

            sage: from sage.tensor.modules.ext_pow_free_module import ExtPowerFreeModule
            sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
            sage: e = M.basis('e')
            sage: A = ExtPowerFreeModule(M, 2) ; A
            2nd exterior power of the Rank-3 free module M over the
             Integer Ring
            sage: TestSuite(A).run()

        """
        from sage.functions.other import binomial
        self._fmodule = fmodule
        self._degree = ZZ(degree)
        rank = binomial(fmodule._rank, degree)
        if name is None and fmodule._name is not None:
            name = r'/\^{}('.format(degree) + fmodule._name + ')'
        if latex_name is None and fmodule._latex_name is not None:
            latex_name = r'\Lambda^{' + str(degree) + r'}\left(' + \
                                       fmodule._latex_name + r'\right)'
        FiniteRankFreeModule.__init__(
            self,
            fmodule._ring,
            rank,
            name=name,
            latex_name=latex_name,
            start_index=fmodule._sindex,
            output_formatter=fmodule._output_formatter)
        fmodule._all_modules.add(self)
Beispiel #4
0
    def __init__(self, vbundle, domain):
        r"""
        Construct the free module of sections over a trivial part of a vector
        bundle.

        TESTS::

            sage: M = Manifold(3, 'M', structure='top')
            sage: X.<x,y,z> = M.chart()
            sage: E = M.vector_bundle(2, 'E')
            sage: from sage.manifolds.section_module import SectionFreeModule
            sage: C0 = SectionFreeModule(E, M); C0
            Free module C^0(M;E) of sections on the 3-dimensional topological
             manifold M with values in the real vector bundle E of rank 2
            sage: C0 is E.section_module(force_free=True)
            True
            sage: TestSuite(C0).run()

        """
        from .scalarfield import ScalarField
        self._domain = domain
        name = "C^0({};{})".format(domain._name, vbundle._name)
        latex_name = r'C^0({};{})'.format(domain._latex_name,
                                          vbundle._latex_name)
        base_space = vbundle.base_space()
        self._base_space = base_space
        self._vbundle = vbundle
        cat = Modules(domain.scalar_field_algebra()).FiniteDimensional()
        FiniteRankFreeModule.__init__(self, domain.scalar_field_algebra(),
                               vbundle.rank(), name=name,
                               latex_name=latex_name,
                               start_index=base_space._sindex,
                               output_formatter=ScalarField.coord_function,
                               category=cat)
    def __init__(self, fmodule, degree, name=None, latex_name=None):
        r"""
        TESTS::

            sage: from sage.tensor.modules.ext_pow_free_module import ExtPowerDualFreeModule
            sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
            sage: e = M.basis('e')
            sage: A = ExtPowerDualFreeModule(M, 2) ; A
            2nd exterior power of the dual of the Rank-3 free module M over
             the Integer Ring
            sage: TestSuite(A).run()

        """
        from sage.functions.other import binomial
        self._fmodule = fmodule
        self._degree = degree
        rank = binomial(fmodule._rank, degree)
        self._zero_element = 0  # provisory (to avoid infinite recursion in what
        # follows)
        if degree == 1:  # case of the dual
            if name is None and fmodule._name is not None:
                name = fmodule._name + '*'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = fmodule._latex_name + r'^*'
        else:
            if name is None and fmodule._name is not None:
                name = r'/\^{}('.format(degree) + fmodule._name + '*)'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = r'\Lambda^{' + str(degree) + r'}\left(' + \
                             fmodule._latex_name + r'^*\right)'
        FiniteRankFreeModule.__init__(
            self,
            fmodule._ring,
            rank,
            name=name,
            latex_name=latex_name,
            start_index=fmodule._sindex,
            output_formatter=fmodule._output_formatter)
        # Unique representation:
        if self._degree in self._fmodule._dual_exterior_powers:
            raise ValueError("the {}th exterior power of ".format(degree) +
                             "the dual of {}".format(self._fmodule) +
                             " has already been created")
        else:
            self._fmodule._dual_exterior_powers[self._degree] = self
        # Zero element
        self._zero_element = self._element_constructor_(name='zero',
                                                        latex_name='0')
        for basis in self._fmodule._known_bases:
            self._zero_element._components[basis] = \
                                            self._zero_element._new_comp(basis)
Beispiel #6
0
 def stalk(self, point):
     """
       Return the stalk of ``self`` at the point ``point``.
       
       INPUT:
       
       - ``point`` -- A point in the domain poset of ``self``. 
       
       OUTPUT:
       
       The stalk of ``self`` at ``point``
     """
     stalk = FiniteRankFreeModule(self._base_ring, self._stalk_dict[point], name="Stalk of {} at {}".format(self, point))
     stalk.basis('e')
     return stalk
Beispiel #7
0
    def __init__(self, fmodule, tensor_type, name=None, latex_name=None):
        r"""
        TEST::

            sage: from sage.tensor.modules.tensor_free_module import TensorFreeModule
            sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
            sage: T = TensorFreeModule(M, (2,3), name='T23', latex_name=r'T^2_3')
            sage: TestSuite(T).run()

        """
        self._fmodule = fmodule
        self._tensor_type = tuple(tensor_type)
        rank = pow(fmodule._rank, tensor_type[0] + tensor_type[1])
        self._zero_element = 0  # provisory (to avoid infinite recursion in what
        # follows)
        if self._tensor_type == (0, 1):  # case of the dual
            if name is None and fmodule._name is not None:
                name = fmodule._name + '*'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = fmodule._latex_name + r'^*'
        else:
            if name is None and fmodule._name is not None:
                name = 'T^' + str(self._tensor_type) + '(' + fmodule._name + \
                       ')'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = r'T^{' + str(self._tensor_type) + r'}\left(' + \
                             fmodule._latex_name + r'\right)'
        FiniteRankFreeModule.__init__(
            self,
            fmodule._ring,
            rank,
            name=name,
            latex_name=latex_name,
            start_index=fmodule._sindex,
            output_formatter=fmodule._output_formatter)
        # Unique representation:
        if self._tensor_type in self._fmodule._tensor_modules:
            raise ValueError(
                "the module of tensors of type {}".format(self._tensor_type) +
                " has already been created")
        else:
            self._fmodule._tensor_modules[self._tensor_type] = self
        # Zero element
        self._zero_element = self._element_constructor_(name='zero',
                                                        latex_name='0')
        for basis in self._fmodule._known_bases:
            self._zero_element._components[basis] = \
                                            self._zero_element._new_comp(basis)
    def __init__(self, fmodule, degree, name=None, latex_name=None):
        r"""
        TESTS::

            sage: from sage.tensor.modules.ext_pow_free_module import ExtPowerDualFreeModule
            sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
            sage: e = M.basis('e')
            sage: A = ExtPowerDualFreeModule(M, 2) ; A
            2nd exterior power of the dual of the Rank-3 free module M over
             the Integer Ring
            sage: TestSuite(A).run()

        """
        from sage.functions.other import binomial
        self._fmodule = fmodule
        self._degree = degree
        rank = binomial(fmodule._rank, degree)
        self._zero_element = 0 # provisory (to avoid infinite recursion in what
                               # follows)
        if degree == 1:  # case of the dual
            if name is None and fmodule._name is not None:
                name = fmodule._name + '*'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = fmodule._latex_name + r'^*'
        else:
            if name is None and fmodule._name is not None:
                name = '/\^{}('.format(degree) + fmodule._name + '*)'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = r'\Lambda^{' + str(degree) + r'}\left(' + \
                             fmodule._latex_name + r'^*\right)'
        FiniteRankFreeModule.__init__(self, fmodule._ring, rank, name=name,
                                      latex_name=latex_name,
                                      start_index=fmodule._sindex,
                                    output_formatter=fmodule._output_formatter)
        # Unique representation:
        if self._degree in self._fmodule._dual_exterior_powers:
            raise ValueError("the {}th exterior power of ".format(degree) +
                             "the dual of {}".format(self._fmodule) +
                             " has already been created")
        else:
            self._fmodule._dual_exterior_powers[self._degree] = self
        # Zero element
        self._zero_element = self._element_constructor_(name='zero',
                                                        latex_name='0')
        for basis in self._fmodule._known_bases:
            self._zero_element._components[basis] = \
                                            self._zero_element._new_comp(basis)
Beispiel #9
0
    def __init__(self, fmodule, tensor_type, name=None, latex_name=None):
        r"""
        TEST::

            sage: from sage.tensor.modules.tensor_free_module import TensorFreeModule
            sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
            sage: T = TensorFreeModule(M, (2,3), name='T23', latex_name=r'T^2_3')
            sage: TestSuite(T).run()

        """
        self._fmodule = fmodule
        self._tensor_type = tuple(tensor_type)
        rank = pow(fmodule._rank, tensor_type[0] + tensor_type[1])
        self._zero_element = 0 # provisory (to avoid infinite recursion in what
                               # follows)
        if self._tensor_type == (0,1):  # case of the dual
            if name is None and fmodule._name is not None:
                name = fmodule._name + '*'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = fmodule._latex_name + r'^*'
        else:
            if name is None and fmodule._name is not None:
                name = 'T^' + str(self._tensor_type) + '(' + fmodule._name + \
                       ')'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = r'T^{' + str(self._tensor_type) + r'}\left(' + \
                             fmodule._latex_name + r'\right)'
        FiniteRankFreeModule.__init__(self, fmodule._ring, rank, name=name,
                                      latex_name=latex_name,
                                      start_index=fmodule._sindex,
                                    output_formatter=fmodule._output_formatter)
        # Unique representation:
        if self._tensor_type in self._fmodule._tensor_modules:
            raise ValueError("the module of tensors of type {}".format(
                                                          self._tensor_type) +
                             " has already been created")
        else:
            self._fmodule._tensor_modules[self._tensor_type] = self
        # Zero element
        self._zero_element = self._element_constructor_(name='zero',
                                                        latex_name='0')
        for basis in self._fmodule._known_bases:
            self._zero_element._components[basis] = \
                                            self._zero_element._new_comp(basis)
Beispiel #10
0
    def __init__(self, fmodule, tensor_type, name=None, latex_name=None):
        r"""
        TESTS::

            sage: from sage.tensor.modules.tensor_free_module import TensorFreeModule
            sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
            sage: T = TensorFreeModule(M, (2,3), name='T23', latex_name=r'T^2_3')
            sage: TestSuite(T).run()

        """
        self._fmodule = fmodule
        self._tensor_type = tuple(tensor_type)
        rank = pow(fmodule._rank, tensor_type[0] + tensor_type[1])
        if self._tensor_type == (0, 1):  # case of the dual
            if name is None and fmodule._name is not None:
                name = fmodule._name + '*'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = fmodule._latex_name + r'^*'
        else:
            if name is None and fmodule._name is not None:
                name = 'T^' + str(self._tensor_type) + '(' + fmodule._name + \
                       ')'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = r'T^{' + str(self._tensor_type) + r'}\left(' + \
                             fmodule._latex_name + r'\right)'
        FiniteRankFreeModule.__init__(
            self,
            fmodule._ring,
            rank,
            name=name,
            latex_name=latex_name,
            start_index=fmodule._sindex,
            output_formatter=fmodule._output_formatter)
        # Unique representation:
        if self._tensor_type in self._fmodule._tensor_modules:
            raise ValueError(
                "the module of tensors of type {}".format(self._tensor_type) +
                " has already been created")
        else:
            self._fmodule._tensor_modules[self._tensor_type] = self
    def __init__(self, fmodule, degree, name=None, latex_name=None):
        r"""
        TESTS::

            sage: from sage.tensor.modules.ext_pow_free_module import ExtPowerDualFreeModule
            sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
            sage: e = M.basis('e')
            sage: A = ExtPowerDualFreeModule(M, 2) ; A
            2nd exterior power of the dual of the Rank-3 free module M over
             the Integer Ring
            sage: TestSuite(A).run()

        """
        from sage.arith.all import binomial
        from sage.typeset.unicode_characters import unicode_bigwedge
        self._fmodule = fmodule
        self._degree = ZZ(degree)
        rank = binomial(fmodule._rank, degree)
        if degree == 1:  # case of the dual
            if name is None and fmodule._name is not None:
                name = fmodule._name + '*'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = fmodule._latex_name + r'^*'
        else:
            if name is None and fmodule._name is not None:
                name = unicode_bigwedge + r'^{}('.format(degree) \
                       + fmodule._name + '*)'
            if latex_name is None and fmodule._latex_name is not None:
                latex_name = r'\Lambda^{' + str(degree) + r'}\left(' \
                             + fmodule._latex_name + r'^*\right)'
        FiniteRankFreeModule.__init__(
            self,
            fmodule._ring,
            rank,
            name=name,
            latex_name=latex_name,
            start_index=fmodule._sindex,
            output_formatter=fmodule._output_formatter)
        fmodule._all_modules.add(self)
Beispiel #12
0
    def __init__(self, point):
        r"""
        Construct the tangent space at a given point.

        TESTS::

            sage: from sage.geometry.manifolds.tangentspace import TangentSpace
            sage: M = Manifold(2, 'M')
            sage: X.<x,y> = M.chart()
            sage: p = M.point((1,-2), name='p')
            sage: Tp = TangentSpace(p) ; Tp
            tangent space at point 'p' on 2-dimensional manifold 'M'
            sage: TestSuite(Tp).run()

        """
        manif = point._manifold
        name = "T_" + str(point._name) + " " + str(manif._name)
        latex_name = r"T_{" + str(point._latex_name) + "}\," + \
                     str(manif._latex_name)
        self._point = point
        self._manif = manif
        FiniteRankFreeModule.__init__(self,
                                      SR,
                                      manif._dim,
                                      name=name,
                                      latex_name=latex_name,
                                      start_index=manif._sindex)
        # Initialization of bases of the tangent space from existing vector
        # frames around the point:
        self._frame_bases = {}  # dictionary of bases of the tangent vector
        # derived from vector frames (keys: vector
        # frames)
        for frame in point._subset._top_frames:
            if point in frame._domain:
                basis = self.basis(symbol=frame._symbol,
                                   latex_symbol=frame._latex_symbol)
                # Names of basis vectors set to those of the frame vector
                # fields:
                n = manif._dim
                for i in range(n):
                    basis._vec[i]._name = frame._vec[i]._name
                    basis._vec[i]._latex_name = frame._vec[i]._latex_name
                basis._name = "(" + \
                        ",".join([basis._vec[i]._name for i in range(n)]) + ")"
                basis._latex_name = r"\left(" + \
                     ",".join([basis._vec[i]._latex_name for i in range(n)])+ \
                     r"\right)"
                basis._symbol = basis._name
                basis._latex_symbol = basis._latex_name
                # Names of cobasis linear forms set to those of the coframe
                # 1-forms:
                coframe = frame.coframe()
                cobasis = basis.dual_basis()
                for i in range(n):
                    cobasis._form[i]._name = coframe._form[i]._name
                    cobasis._form[i]._latex_name = coframe._form[i]._latex_name
                cobasis._name = "(" + \
                     ",".join([cobasis._form[i]._name for i in range(n)]) + ")"
                cobasis._latex_name = r"\left(" + \
                  ",".join([cobasis._form[i]._latex_name for i in range(n)])+ \
                  r"\right)"
                self._frame_bases[frame] = basis
        # The basis induced by the default frame of the manifold subset
        # in which the point has been created is declared the default
        # basis of self:
        def_frame = point._subset._def_frame
        if def_frame in self._frame_bases:
            self._def_basis = self._frame_bases[def_frame]
        # Initialization of the changes of bases from the existing changes of
        # frames around the point:
        for frame_pair, automorph in point._subset._frame_changes.iteritems():
            frame1 = frame_pair[0]
            frame2 = frame_pair[1]
            fr1, fr2 = None, None
            for frame in self._frame_bases:
                if frame1 in frame._subframes:
                    fr1 = frame
                    break
            for frame in self._frame_bases:
                if frame2 in frame._subframes:
                    fr2 = frame
                    break
            if fr1 is not None and fr2 is not None:
                basis1 = self._frame_bases[fr1]
                basis2 = self._frame_bases[fr2]
                auto = self.automorphism()
                for frame, comp in automorph._components.iteritems():
                    basis = None
                    if frame is frame1:
                        basis = basis1
                    if frame is frame2:
                        basis = basis2
                    if basis is not None:
                        cauto = auto.add_comp(basis)
                        for ind, val in comp._comp.iteritems():
                            cauto._comp[ind] = val(point)
                self._basis_changes[(basis1, basis2)] = auto
Beispiel #13
0
    def __init__(self, point):
        r"""
        Construct the tangent space at a given point.

        TESTS::

            sage: from sage.manifolds.differentiable.tangent_space import TangentSpace
            sage: M = Manifold(2, 'M')
            sage: X.<x,y> = M.chart()
            sage: p = M.point((1,-2), name='p')
            sage: Tp = TangentSpace(p) ; Tp
            Tangent space at Point p on the 2-dimensional differentiable
             manifold M
            sage: TestSuite(Tp).run()

        """
        manif = point._manifold
        name = "T_{} {}".format(point._name, manif._name)
        latex_name = r"T_{%s}\,%s"%(point._latex_name, manif._latex_name)
        self._point = point
        self._manif = manif
        FiniteRankFreeModule.__init__(self, SR, manif._dim, name=name,
                                      latex_name=latex_name,
                                      start_index=manif._sindex)
        # Initialization of bases of the tangent space from existing vector
        # frames around the point:

        # dictionary of bases of the tangent space derived from vector
        # frames around the point (keys: vector frames)
        self._frame_bases = {}
        for frame in point.parent()._top_frames:
            # the frame is used to construct a basis of the tangent space
            # only if it is a frame on the current manifold:
            if frame.destination_map().is_identity():
                if point in frame._domain:
                    coframe = frame.coframe()
                    basis = self.basis(frame._symbol,
                                       latex_symbol=frame._latex_symbol,
                                       indices=frame._indices,
                                       latex_indices=frame._latex_indices,
                                       symbol_dual=coframe._symbol,
                                       latex_symbol_dual=coframe._latex_symbol)
                    self._frame_bases[frame] = basis
        # The basis induced by the default frame of the manifold subset
        # in which the point has been created is declared the default
        # basis of self:
        def_frame = point.parent()._def_frame
        if def_frame in self._frame_bases:
            self._def_basis = self._frame_bases[def_frame]
        # Initialization of the changes of bases from the existing changes of
        # frames around the point:
        for frame_pair, automorph in point.parent()._frame_changes.items():
            if point in automorph.domain():
                frame1, frame2 = frame_pair[0], frame_pair[1]
                fr1, fr2 = None, None
                for frame in self._frame_bases:
                    if frame1 in frame._subframes:
                        fr1 = frame
                        break
                for frame in self._frame_bases:
                    if frame2 in frame._subframes:
                        fr2 = frame
                        break
                if fr1 is not None and fr2 is not None:
                    basis1 = self._frame_bases[fr1]
                    basis2 = self._frame_bases[fr2]
                    auto = self.automorphism()
                    for frame, comp in automorph._components.items():
                        try:
                            basis = None
                            if frame is frame1:
                                basis = basis1
                            if frame is frame2:
                                basis = basis2
                            if basis is not None:
                                cauto = auto.add_comp(basis=basis)
                                for ind, val in comp._comp.items():
                                    cauto._comp[ind] = val(point)
                        except ValueError:
                            pass
                    self._basis_changes[(basis1, basis2)] = auto
Beispiel #14
0
 def global_sections(self):
     """
       Return the global sections of ``self``.  
     """
     c = self.cohomology(0)
     return FiniteRankFreeModule(self._base_ring, c.ngens(), name="Global Sections of {}".format(self))
    def __init__(self, vector_bundle, point):
        r"""
        Construct a fiber of a vector bundle.

        TESTS::

            sage: M = Manifold(3, 'M', structure='top')
            sage: X.<x,y,z> = M.chart()
            sage: p = M((0,0,0), name='p')
            sage: E = M.vector_bundle(2, 'E')
            sage: e = E.local_frame('e')
            sage: Ep = E.fiber(p)
            sage: TestSuite(Ep).run()

        """
        if point._manifold is not vector_bundle._base_space:
            raise ValueError("Point must be an element "
                             "of {}".format(vector_bundle._manifold))
        name = "{}_{}".format(vector_bundle._name, point._name)
        latex_name = r'{}_{{{}}}'.format(vector_bundle._latex_name,
                                         point._latex_name)
        self._rank = vector_bundle._rank
        self._vbundle = vector_bundle
        self._point = point
        self._base_space = point._manifold
        FiniteRankFreeModule.__init__(self,
                                      SR,
                                      self._rank,
                                      name=name,
                                      latex_name=latex_name,
                                      start_index=self._base_space._sindex)
        ###
        # Construct basis
        self._frame_bases = {
        }  # dictionary of bases of the vector bundle fiber
        # derived from local frames around the point
        # (keys: local frames)
        self._def_basis = None
        for frame in vector_bundle._frames:
            # the frame is used to construct a basis of the vector bundle fiber
            # only if it is a frame for the given point:
            if point in frame.domain():
                coframe = frame.coframe()
                basis = self.basis(frame._symbol,
                                   latex_symbol=frame._latex_symbol,
                                   indices=frame._indices,
                                   latex_indices=frame._latex_indices,
                                   symbol_dual=coframe._symbol,
                                   latex_symbol_dual=coframe._latex_symbol)
                self._frame_bases[frame] = basis
                if self._def_basis is None:
                    self._def_basis = basis  # Declare the first basis as default
        # Initialization of the changes of bases from the existing changes of
        # frames around the point:
        for frame_pair, automorph in self._vbundle._frame_changes.items():
            if point in automorph._fmodule.domain():
                frame1, frame2 = frame_pair[0], frame_pair[1]
                fr1, fr2 = None, None
                for frame in self._frame_bases:
                    if frame1 in frame._subframes:
                        fr1 = frame
                        break
                for frame in self._frame_bases:
                    if frame2 in frame._subframes:
                        fr2 = frame
                        break
                if fr1 is not None and fr2 is not None:
                    basis1 = self._frame_bases[fr1]
                    basis2 = self._frame_bases[fr2]
                    auto = self.automorphism()
                    for frame, comp in automorph._components.items():
                        try:
                            basis = None
                            if frame is frame1:
                                basis = basis1
                            if frame is frame2:
                                basis = basis2
                            if basis is not None:
                                cauto = auto.add_comp(basis)
                                for ind, val in comp._comp.items():
                                    cauto._comp[ind] = val(point)
                        except ValueError:
                            pass
                    self._basis_changes[(basis1, basis2)] = auto
Beispiel #16
0
    def __init__(self, point):
        r"""
        Construct the tangent space at a given point.

        TESTS::

            sage: from sage.manifolds.differentiable.tangent_space import TangentSpace
            sage: M = Manifold(2, 'M')
            sage: X.<x,y> = M.chart()
            sage: p = M.point((1,-2), name='p')
            sage: Tp = TangentSpace(p) ; Tp
            Tangent space at Point p on the 2-dimensional differentiable
             manifold M
            sage: TestSuite(Tp).run()

        """
        manif = point._manifold
        name = "T_{} {}".format(point._name, manif._name)
        latex_name = r"T_{%s}\,%s"%(point._latex_name, manif._latex_name)
        self._point = point
        self._manif = manif
        FiniteRankFreeModule.__init__(self, SR, manif._dim, name=name,
                                      latex_name=latex_name,
                                      start_index=manif._sindex)
        # Initialization of bases of the tangent space from existing vector
        # frames around the point:

        # dictionary of bases of the tangent space derived from vector
        # frames around the point (keys: vector frames)
        self._frame_bases = {}
        for frame in point.parent()._top_frames:
            # the frame is used to construct a basis of the tangent space
            # only if it is a frame on the current manifold:
            if frame.destination_map().is_identity():
                if point in frame._domain:
                    basis = self.basis(symbol=frame._symbol,
                                       latex_symbol=frame._latex_symbol)
                    # Names of basis vectors set to those of the frame vector
                    # fields:
                    for i,v in enumerate(frame._vec):
                        basis._vec[i]._name = v._name
                        basis._vec[i]._latex_name = v._latex_name
                    basis._name = "({})".format(
                                         ",".join(v._name for v in basis._vec))
                    basis._latex_name = r"\left({}\right)".format(
                                   ",".join(v._latex_name for v in basis._vec))
                    basis._symbol = basis._name
                    basis._latex_symbol = basis._latex_name
                    # Names of cobasis linear forms set to those of the coframe
                    # 1-forms:
                    coframe = frame.coframe()
                    cobasis = basis.dual_basis()
                    for i,f in enumerate(coframe._form):
                        cobasis._form[i]._name = f._name
                        cobasis._form[i]._latex_name = f._latex_name
                    cobasis._name = "({})".format(
                                      ",".join(f._name for f in cobasis._form))
                    cobasis._latex_name = r"\left({}\right)".format(
                                ",".join(f._latex_name for f in cobasis._form))
                    self._frame_bases[frame] = basis
        # The basis induced by the default frame of the manifold subset
        # in which the point has been created is declared the default
        # basis of self:
        def_frame = point.parent()._def_frame
        if def_frame in self._frame_bases:
            self._def_basis = self._frame_bases[def_frame]
        # Initialization of the changes of bases from the existing changes of
        # frames around the point:
        for frame_pair, automorph in point.parent()._frame_changes.items():
            if point in automorph.domain():
                frame1, frame2 = frame_pair[0], frame_pair[1]
                fr1, fr2 = None, None
                for frame in self._frame_bases:
                    if frame1 in frame._subframes:
                        fr1 = frame
                        break
                for frame in self._frame_bases:
                    if frame2 in frame._subframes:
                        fr2 = frame
                        break
                if fr1 is not None and fr2 is not None:
                    basis1 = self._frame_bases[fr1]
                    basis2 = self._frame_bases[fr2]
                    auto = self.automorphism()
                    for frame, comp in automorph._components.items():
                        try:
                            basis = None
                            if frame is frame1:
                                basis = basis1
                            if frame is frame2:
                                basis = basis2
                            if basis is not None:
                                cauto = auto.add_comp(basis)
                                for ind, val in comp._comp.items():
                                    cauto._comp[ind] = val(point)
                        except ValueError:
                            pass
                    self._basis_changes[(basis1, basis2)] = auto