Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

r""" 

Examples of a Lie algebra with basis 

""" 

#***************************************************************************** 

# Copyright (C) 2014 Travis Scrimshaw <tscrim at ucdavis.edu> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

 

#from sage.misc.cachefunc import cached_method 

from sage.sets.family import Family 

from sage.categories.lie_algebras import LieAlgebras 

from sage.categories.algebras import Algebras 

from sage.monoids.indexed_free_monoid import IndexedFreeAbelianMonoid 

from sage.combinat.free_module import CombinatorialFreeModule 

 

class AbelianLieAlgebra(CombinatorialFreeModule): 

r""" 

An example of a Lie algebra: the abelian Lie algebra. 

 

This class illustrates a minimal implementation of a Lie algebra with 

a distinguished basis. 

""" 

def __init__(self, R, gens): 

""" 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: TestSuite(L).run() 

""" 

cat = LieAlgebras(R).WithBasis() 

CombinatorialFreeModule.__init__(self, R, gens, category=cat) 

 

def _construct_UEA(self): 

""" 

Construct the universal enveloping algebra of ``self``. 

 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: L._construct_UEA() 

Polynomial algebra with generators indexed by Partitions over Rational Field 

""" 

return IndexedPolynomialRing(self.base_ring(), self._indices) 

 

def _repr_(self): 

""" 

EXAMPLES:: 

 

sage: LieAlgebras(QQ).WithBasis().example() 

An example of a Lie algebra: the abelian Lie algebra on the 

generators indexed by Partitions over Rational Field 

""" 

return "An example of a Lie algebra: the abelian Lie algebra on the" \ 

" generators indexed by {} over {}".format( 

self.basis().keys(), self.base_ring()) 

 

def lie_algebra_generators(self): 

""" 

Return the generators of ``self`` as a Lie algebra. 

 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: L.lie_algebra_generators() 

Lazy family (Term map from Partitions to 

An example of a Lie algebra: the abelian Lie algebra on the 

generators indexed by Partitions over Rational 

Field(i))_{i in Partitions} 

""" 

return self.basis() 

 

def bracket_on_basis(self, x, y): 

""" 

Return the Lie bracket on basis elements indexed by ``x`` and ``y``. 

 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: L.bracket_on_basis(Partition([4,1]), Partition([2,2,1])) 

0 

""" 

return self.zero() 

 

class Element(CombinatorialFreeModule.Element): 

def lift(self): 

""" 

Return the lift of ``self`` to the universal enveloping algebra. 

 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: elt = L.an_element() 

sage: elt.lift() 

3*P[F[2]] + 2*P[F[1]] + 2*P[F[]] 

""" 

UEA = self.parent().universal_enveloping_algebra() 

I = UEA._indices 

return UEA.sum_of_terms((I.gen(t), c) for t, c in self) 

 

Example = AbelianLieAlgebra 

 

############## 

 

class IndexedPolynomialRing(CombinatorialFreeModule): 

""" 

Polynomial ring whose generators are indexed by an arbitrary set. 

 

.. TODO:: 

 

Currently this is just used as the universal enveloping algebra 

for the example of the abelian Lie algebra. This should be 

factored out into a more complete class. 

""" 

def __init__(self, R, indices, **kwds): 

""" 

Initialize ``self``. 

 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: UEA = L.universal_enveloping_algebra() 

sage: TestSuite(UEA).run() 

""" 

if 'category' not in kwds: 

kwds['category'] = Algebras(R).WithBasis() 

if 'prefix' not in kwds: 

kwds['prefix'] = 'P' 

# This is a workaround until IndexedFree(Abelian)Monoid elements compare properly 

kwds['sorting_key'] = lambda x: x.to_word_list() 

kwds['sorting_reverse'] = True 

M = IndexedFreeAbelianMonoid(indices, bracket='') 

CombinatorialFreeModule.__init__(self, R, M, **kwds) 

 

def _repr_(self): 

""" 

Return a string representation of ``self``. 

 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: L.universal_enveloping_algebra() 

Polynomial algebra with generators indexed by Partitions over Rational Field 

""" 

return "Polynomial algebra with generators indexed by {} over {}".format( 

self._indices._indices, self.base_ring()) 

 

def one_basis(self): 

""" 

Return the index of element `1`. 

 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: UEA = L.universal_enveloping_algebra() 

sage: UEA.one_basis() 

1 

sage: UEA.one_basis().parent() 

Free abelian monoid indexed by Partitions 

""" 

return self._indices.one() 

 

def product_on_basis(self, x, y): 

""" 

Return the product of the monomials indexed by ``x`` and ``y``. 

 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: UEA = L.universal_enveloping_algebra() 

sage: I = UEA._indices 

sage: UEA.product_on_basis(I.an_element(), I.an_element()) 

P[F[]^4*F[1]^4*F[2]^6] 

""" 

return self.monomial(x*y) 

 

def algebra_generators(self): 

""" 

Return the algebra generators of ``self``. 

 

EXAMPLES:: 

 

sage: L = LieAlgebras(QQ).WithBasis().example() 

sage: UEA = L.universal_enveloping_algebra() 

sage: UEA.algebra_generators() 

Lazy family (algebra generator map(i))_{i in Partitions} 

""" 

I = self._indices 

return Family(I._indices, lambda x: self.monomial(I.gen(x)), 

name="algebra generator map")