def __init__(self, A, gens=None, names=None, index_set=None, category=None): """ Initialize ``self``. EXAMPLES:: sage: G = SymmetricGroup(3) sage: S = GroupAlgebra(G, QQ) sage: L = LieAlgebra(associative=S) sage: TestSuite(L).run() TESTS:: sage: from sage.algebras.lie_algebras.lie_algebra import LieAlgebraFromAssociative as LAFA sage: LAFA(MatrixSpace(QQ, 0, sparse=True), [], names=()) Lie algebra generated by () in Full MatrixSpace of 0 by 0 sparse matrices over Rational Field """ self._assoc = A R = self._assoc.base_ring() # We strip the following axioms from the category of the assoc. algebra: # FiniteDimensional and WithBasis category = LieAlgebras(R).or_subcategory(category) if 'FiniteDimensional' in self._assoc.category().axioms(): category = category.FiniteDimensional() if 'WithBasis' in self._assoc.category().axioms() and gens is None: category = category.WithBasis() LieAlgebraWithGenerators.__init__(self, R, names, index_set, category) if isinstance(gens, tuple): # This guarantees that the generators have a specified ordering d = { self._indices[i]: self.element_class(self, v) for i, v in enumerate(gens) } gens = Family(self._indices, lambda i: d[i]) elif gens is not None: # It is a family gens = Family(self._indices, lambda i: self.element_class(self, gens[i]), name="generator map") self._gens = gens # We don't need to store the original generators because we can # get them from lifting this object's generators # We construct the lift map to the ambient associative algebra LiftMorphismToAssociative(self, self._assoc).register_as_coercion()
def __init__(self, L, name, **kwds): r""" Initialize ``self``. TESTS:: sage: L = lie_algebras.Heisenberg(QQ, 2) sage: G = L.lie_group() sage: TestSuite(G).run() """ required_cat = LieAlgebras(L.base_ring()).FiniteDimensional() required_cat = required_cat.WithBasis().Nilpotent() if L not in required_cat: raise TypeError("L needs to be a finite dimensional nilpotent " "Lie algebra with basis") self._lie_algebra = L R = L.base_ring() category = kwds.pop('category', None) category = LieGroups(R).or_subcategory(category) if isinstance(R, RealField_class): structure = RealDifferentialStructure() else: structure = DifferentialStructure() DifferentiableManifold.__init__(self, L.dimension(), name, R, structure, category=category) # initialize exponential coordinates of the first kind basis_strs = [str(X) for X in L.basis()] split = list(zip(*[s.split('_') for s in basis_strs])) if len(split) == 2 and all(sk == split[0][0] for sk in split[0]): self._var_indexing = split[1] else: self._var_indexing = [str(k) for k in range(L.dimension())] variables = ' '.join('x_%s' % k for k in self._var_indexing) self._Exp1 = self.chart(variables) # compute a symbolic formula for the group law L_SR = _symbolic_lie_algebra_copy(L) n = L.dimension() a, b = (tuple(var('%s_%d' % (s, j)) for j in range(n)) for s in ['a', 'b']) self._group_law_vars = (a, b) bch = L_SR.bch(L_SR.from_vector(a), L_SR.from_vector(b), L.step()) self._group_law = vector(SR, (zk.expand() for zk in bch.to_vector()))