def __init__(self, R, names, index_set, **kwds): """ Initialize ``self``. EXAMPLES:: sage: L = LieAlgebra(QQ, 3, 'x', abelian=True) sage: TestSuite(L).run() """ LieAlgebraWithStructureCoefficients.__init__(self, R, Family({}), names, index_set, **kwds)
def __init__(self, R, names, index_set, **kwds): """ Initialize ``self``. EXAMPLES:: sage: L = LieAlgebra(QQ, 3, 'x', abelian=True) sage: TestSuite(L).run() """ LieAlgebraWithStructureCoefficients.__init__(self, R, Family({}), names, index_set, **kwds)
def __init__(self, R, names, index_set, category, **kwds): """ Initialize ``self``. EXAMPLES:: sage: L = LieAlgebra(QQ, 3, 'x', abelian=True) sage: TestSuite(L).run() """ cat = LieAlgebras(R).FiniteDimensional().WithBasis().Nilpotent() category = cat.or_subcategory(category) LieAlgebraWithStructureCoefficients.__init__(self, R, Family({}), names, index_set, category, **kwds)
def __init__(self, R, s_coeff, names, index_set, step=None, **kwds): r""" Initialize ``self``. EXAMPLES:: sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True) sage: TestSuite(L).run() """ if step is not None: self._step = step LieAlgebraWithStructureCoefficients.__init__(self, R, s_coeff, names, index_set, **kwds)
def __init__(self, R, s_coeff, names, index_set, step=None, **kwds): r""" Initialize ``self``. EXAMPLES:: sage: L.<X,Y,Z,W> = LieAlgebra(QQ, {('X','Y'): {'Z': 1}}, nilpotent=True) sage: TestSuite(L).run() """ if step is not None: self._step = step LieAlgebraWithStructureCoefficients.__init__(self, R, s_coeff, names, index_set, **kwds)
def __init__(self, I, L, names, index_set, category=None): r""" Initialize ``self``. TESTS:: sage: L.<x,y,z> = LieAlgebra(SR, {('x','y'): {'x':1}}) sage: K = L.quotient(y) sage: K.dimension() 1 sage: TestSuite(K).run() """ B = L.basis() sm = L.module().submodule_with_basis( [I.reduce(B[i]).to_vector() for i in index_set]) SB = sm.basis() # compute and normalize structural coefficients for the quotient s_coeff = {} for i, ind_i in enumerate(index_set): for j in range(i + 1, len(index_set)): ind_j = index_set[j] brkt = I.reduce(L.bracket(SB[i], SB[j])) brktvec = sm.coordinate_vector(brkt.to_vector()) s_coeff[(ind_i, ind_j)] = dict(zip(index_set, brktvec)) s_coeff = LieAlgebraWithStructureCoefficients._standardize_s_coeff( s_coeff, index_set) self._ambient = L self._I = I self._sm = sm LieAlgebraWithStructureCoefficients.__init__(self, L.base_ring(), s_coeff, names, index_set, category=category) # register the quotient morphism as a conversion H = Hom(L, self) f = SetMorphism(H, self.retract) self.register_conversion(f)
def __init__(self, I, L, names, index_set, category=None): r""" Initialize ``self``. TESTS:: sage: L.<x,y,z> = LieAlgebra(SR, {('x','y'): {'x':1}}) sage: K = L.quotient(y) sage: K.dimension() 1 sage: TestSuite(K).run() """ B = L.basis() sm = L.module().submodule_with_basis([I.reduce(B[i]).to_vector() for i in index_set]) SB = sm.basis() # compute and normalize structural coefficients for the quotient s_coeff = {} for i, ind_i in enumerate(index_set): for j in range(i + 1, len(index_set)): ind_j = index_set[j] brkt = I.reduce(L.bracket(SB[i], SB[j])) brktvec = sm.coordinate_vector(brkt.to_vector()) s_coeff[(ind_i, ind_j)] = dict(zip(index_set, brktvec)) s_coeff = LieAlgebraWithStructureCoefficients._standardize_s_coeff( s_coeff, index_set) self._ambient = L self._I = I self._sm = sm LieAlgebraWithStructureCoefficients.__init__( self, L.base_ring(), s_coeff, names, index_set, category=category) # register the quotient morphism as a conversion H = Hom(L, self) f = SetMorphism(H, self.retract) self.register_conversion(f)
def __init__(self, R, cartan_type): r""" Initialize ``self``. TESTS:: sage: L = LieAlgebra(QQ, cartan_type=['A',2]) sage: TestSuite(L).run() # long time """ self._cartan_type = cartan_type RL = cartan_type.root_system().root_lattice() alpha = RL.simple_roots() p_roots = list(RL.positive_roots_by_height()) n_roots = [-x for x in p_roots] self._p_roots_index = {al: i for i,al in enumerate(p_roots)} alphacheck = RL.simple_coroots() roots = frozenset(RL.roots()) num_sroots = len(alpha) one = R.one() # Determine the signs for the structure coefficients from the root system # We first create the special roots sp_sign = {} for i,a in enumerate(p_roots): for b in p_roots[i+1:]: if a + b not in p_roots: continue # Compute the sign for the extra special pair x, y = (a + b).extraspecial_pair() if (x, y) == (a, b): # If it already is an extra special pair if (x, y) not in sp_sign: # This swap is so the structure coefficients match with GAP if (sum(x.coefficients()) == sum(y.coefficients()) and str(x) > str(y)): y,x = x,y sp_sign[(x, y)] = -one sp_sign[(y, x)] = one continue if b - x in roots: t1 = ((b-x).norm_squared() / b.norm_squared() * sp_sign[(x, b-x)] * sp_sign[(a, y-a)]) else: t1 = 0 if a - x in roots: t2 = ((a-x).norm_squared() / a.norm_squared() * sp_sign[(x, a-x)] * sp_sign[(b, y-b)]) else: t2 = 0 if t1 - t2 > 0: sp_sign[(a,b)] = -one elif t2 - t1 > 0: sp_sign[(a,b)] = one sp_sign[(b,a)] = -sp_sign[(a,b)] # Function to construct the structure coefficients (up to sign) def e_coeff(r, s): p = 1 while r - p*s in roots: p += 1 return p # Now we can compute all necessary structure coefficients s_coeffs = {} for i,r in enumerate(p_roots): # [e_r, h_i] and [h_i, f_r] for ac in alphacheck: c = r.scalar(ac) if c == 0: continue s_coeffs[(r, ac)] = {r: -c} s_coeffs[(ac, -r)] = {-r: -c} # [e_r, f_r] s_coeffs[(r, -r)] = {alphacheck[j]: c for j, c in r.associated_coroot()} # [e_r, e_s] and [e_r, f_s] with r != +/-s # We assume s is positive, as otherwise we negate # both r and s and the resulting coefficient for j, s in enumerate(p_roots[i+1:]): j += i+1 # Offset # Since h(s) >= h(r), we have s - r > 0 when s - r is a root # [f_r, e_s] if s - r in p_roots: c = e_coeff(r, -s) a, b = s-r, r if self._p_roots_index[a] > self._p_roots_index[b]: # Note a != b c *= -sp_sign[(b, a)] else: c *= sp_sign[(a, b)] s_coeffs[(-r, s)] = {a: -c} s_coeffs[(r, -s)] = {-a: c} # [e_r, e_s] a = r + s if a in p_roots: # (r, s) is a special pair c = e_coeff(r, s) * sp_sign[(r, s)] s_coeffs[(r, s)] = {a: c} s_coeffs[(-r, -s)] = {-a: -c} # Lastly, make sure a < b for all (a, b) in the coefficients and flip if necessary for k in s_coeffs.keys(): a,b = k[0], k[1] if self._basis_key(a) > self._basis_key(b): s_coeffs[(b,a)] = [(index, -v) for index,v in s_coeffs[k].items()] del s_coeffs[k] else: s_coeffs[k] = s_coeffs[k].items() names = ['e{}'.format(i) for i in range(1, num_sroots+1)] names += ['f{}'.format(i) for i in range(1, num_sroots+1)] names += ['h{}'.format(i) for i in range(1, num_sroots+1)] category = LieAlgebras(R).FiniteDimensional().WithBasis() index_set = p_roots + list(alphacheck) + n_roots names = tuple(names) from sage.sets.finite_enumerated_set import FiniteEnumeratedSet index_set = FiniteEnumeratedSet(index_set) LieAlgebraWithStructureCoefficients.__init__(self, R, s_coeffs, names, index_set, category, prefix='E', bracket='[', sorting_key=self._basis_key)