Lie Algebra Elements#

AUTHORS:

  • Travis Scrimshaw (2013-05-04): Initial implementation

class sage.algebras.lie_algebras.lie_algebra_element.FreeLieAlgebraElement[source]#

Bases: LieAlgebraElement

An element of a free Lie algebra.

lift()[source]#

Lift self to the universal enveloping algebra.

EXAMPLES:

sage: L = LieAlgebra(QQ, 'x,y,z')
sage: Lyn = L.Lyndon()
sage: x,y,z = Lyn.gens()
sage: a = Lyn([z, [[x, y], x]]); a
[x, [x, [y, z]]] + [x, [[x, z], y]] - [[x, y], [x, z]]
sage: a.lift()
x^2*y*z - 2*x*y*x*z + y*x^2*z - z*x^2*y + 2*z*x*y*x - z*y*x^2
>>> from sage.all import *
>>> L = LieAlgebra(QQ, 'x,y,z')
>>> Lyn = L.Lyndon()
>>> x,y,z = Lyn.gens()
>>> a = Lyn([z, [[x, y], x]]); a
[x, [x, [y, z]]] + [x, [[x, z], y]] - [[x, y], [x, z]]
>>> a.lift()
x^2*y*z - 2*x*y*x*z + y*x^2*z - z*x^2*y + 2*z*x*y*x - z*y*x^2
list()[source]#

Return self as a list of pairs (m, c) where m is a basis key (i.e., a key of one of the basis elements) and c is its coefficient.

This list is sorted from highest to lowest degree.

EXAMPLES:

sage: L.<x, y> = LieAlgebra(QQ)
sage: elt = x + L.bracket(y, x)
sage: elt.list()
[([x, y], -1), (x, 1)]
>>> from sage.all import *
>>> L = LieAlgebra(QQ, names=('x', 'y',)); (x, y,) = L._first_ngens(2)
>>> elt = x + L.bracket(y, x)
>>> elt.list()
[([x, y], -1), (x, 1)]
class sage.algebras.lie_algebras.lie_algebra_element.GradedLieBracket[source]#

Bases: LieBracket

A Lie bracket (LieBracket) for a graded Lie algebra.

Unlike the vanilla Lie bracket class, this also stores a degree, and uses it as a first criterion when comparing graded Lie brackets. (Graded Lie brackets still compare greater than Lie generators.)

class sage.algebras.lie_algebras.lie_algebra_element.LieAlgebraElement[source]#

Bases: IndexedFreeModuleElement

A Lie algebra element.

lift()[source]#

Lift self to the universal enveloping algebra.

EXAMPLES:

sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'):{'z':1}})
sage: x.lift().parent() == L.universal_enveloping_algebra()
True
>>> from sage.all import *
>>> L = LieAlgebra(QQ, {('x','y'):{'z':Integer(1)}}, names=('x', 'y', 'z',)); (x, y, z,) = L._first_ngens(3)
>>> x.lift().parent() == L.universal_enveloping_algebra()
True
class sage.algebras.lie_algebras.lie_algebra_element.LieAlgebraElementWrapper[source]#

Bases: ElementWrapper

Wrap an element as a Lie algebra element.

class sage.algebras.lie_algebras.lie_algebra_element.LieAlgebraMatrixWrapper[source]#

Bases: LieAlgebraElementWrapper

Lie algebra element wrapper around a matrix.

class sage.algebras.lie_algebras.lie_algebra_element.LieBracket[source]#

Bases: LieObject

An abstract Lie bracket (formally, just a binary tree).

lift(UEA_gens_dict)[source]#

Lift self to the universal enveloping algebra.

UEA_gens_dict should be the dictionary for the generators of the universal enveloping algebra.

EXAMPLES:

sage: L = LieAlgebra(QQ, 'x,y,z')
sage: Lyn = L.Lyndon()
sage: x,y,z = Lyn.gens()
sage: a = Lyn([z, [[x, y], x]]); a
[x, [x, [y, z]]] + [x, [[x, z], y]] - [[x, y], [x, z]]
sage: a.lift() # indirect doctest
x^2*y*z - 2*x*y*x*z + y*x^2*z - z*x^2*y + 2*z*x*y*x - z*y*x^2
>>> from sage.all import *
>>> L = LieAlgebra(QQ, 'x,y,z')
>>> Lyn = L.Lyndon()
>>> x,y,z = Lyn.gens()
>>> a = Lyn([z, [[x, y], x]]); a
[x, [x, [y, z]]] + [x, [[x, z], y]] - [[x, y], [x, z]]
>>> a.lift() # indirect doctest
x^2*y*z - 2*x*y*x*z + y*x^2*z - z*x^2*y + 2*z*x*y*x - z*y*x^2
to_word()[source]#

Return the word (“flattening”) of self.

If self is a tree of Lie brackets, this word is usually obtained by “forgetting the brackets”.

EXAMPLES:

sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
sage: x = LieGenerator('x', 0)
sage: y = LieGenerator('y', 1)
sage: b = LieBracket(x, y)
sage: c = LieBracket(b, x)
sage: c.to_word()
('x', 'y', 'x')
>>> from sage.all import *
>>> from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator, LieBracket
>>> x = LieGenerator('x', Integer(0))
>>> y = LieGenerator('y', Integer(1))
>>> b = LieBracket(x, y)
>>> c = LieBracket(b, x)
>>> c.to_word()
('x', 'y', 'x')
class sage.algebras.lie_algebras.lie_algebra_element.LieGenerator[source]#

Bases: LieObject

A wrapper around an object so it can ducktype with and do comparison operations with LieBracket.

lift(UEA_gens_dict)[source]#

Lift self to the universal enveloping algebra.

UEA_gens_dict should be the dictionary for the generators of the universal enveloping algebra.

EXAMPLES:

sage: L = LieAlgebra(QQ, 'x,y,z')
sage: Lyn = L.Lyndon()
sage: x,y,z = Lyn.gens()
sage: x.lift()
x
sage: x.lift().parent()
Free Algebra on 3 generators (x, y, z) over Rational Field
>>> from sage.all import *
>>> L = LieAlgebra(QQ, 'x,y,z')
>>> Lyn = L.Lyndon()
>>> x,y,z = Lyn.gens()
>>> x.lift()
x
>>> x.lift().parent()
Free Algebra on 3 generators (x, y, z) over Rational Field
to_word()[source]#

Return the word (“flattening”) of self.

If self is a tree of Lie brackets, this word is usually obtained by “forgetting the brackets”.

EXAMPLES:

sage: from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator
sage: x = LieGenerator('x', 0)
sage: x.to_word()
('x',)
>>> from sage.all import *
>>> from sage.algebras.lie_algebras.lie_algebra_element import LieGenerator
>>> x = LieGenerator('x', Integer(0))
>>> x.to_word()
('x',)
class sage.algebras.lie_algebras.lie_algebra_element.LieObject[source]#

Bases: SageObject

Abstract base class for LieGenerator and LieBracket.

to_word()[source]#

Return the word (“flattening”) of self.

If self is a tree of Lie brackets, this word is usually obtained by “forgetting the brackets”.

class sage.algebras.lie_algebras.lie_algebra_element.LieSubalgebraElementWrapper[source]#

Bases: LieAlgebraElementWrapper

Wrap an element of the ambient Lie algebra as an element.

monomial_coefficients(copy=True)[source]#

Return a dictionary whose keys are indices of basis elements in the support of self and whose values are the corresponding coefficients.

INPUT:

  • copy – (default: True) if self is internally represented by a dictionary d, then make a copy of d; if False, then this can cause undesired behavior by mutating d

EXAMPLES:

sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})
sage: S = L.subalgebra([X, Y])
sage: S(2*Y + 9*Z).monomial_coefficients()
{1: 2, 2: 3}
sage: S2 = L.subalgebra([Y, Z])
sage: S2(2*Y + 9*Z).monomial_coefficients()
{0: 2, 1: 9}
>>> from sage.all import *
>>> L = LieAlgebra(ZZ, {('X','Y'): {'Z': Integer(3)}}, names=('X', 'Y', 'Z',)); (X, Y, Z,) = L._first_ngens(3)
>>> S = L.subalgebra([X, Y])
>>> S(Integer(2)*Y + Integer(9)*Z).monomial_coefficients()
{1: 2, 2: 3}
>>> S2 = L.subalgebra([Y, Z])
>>> S2(Integer(2)*Y + Integer(9)*Z).monomial_coefficients()
{0: 2, 1: 9}
to_vector(sparse=False, order=None)[source]#

Return the vector in g.module() corresponding to the element self of g (where g is the parent of self).

EXAMPLES:

sage: L.<X,Y,Z> = LieAlgebra(ZZ, {('X','Y'): {'Z': 3}})
sage: S = L.subalgebra([X, Y])
sage: S.basis()
Family (X, Y, 3*Z)
sage: S(2*Y + 9*Z).to_vector()
(0, 2, 9)
sage: S2 = L.subalgebra([Y, Z])
sage: S2.basis()
Family (Y, Z)
sage: S2(2*Y + 9*Z).to_vector()
(0, 2, 9)
>>> from sage.all import *
>>> L = LieAlgebra(ZZ, {('X','Y'): {'Z': Integer(3)}}, names=('X', 'Y', 'Z',)); (X, Y, Z,) = L._first_ngens(3)
>>> S = L.subalgebra([X, Y])
>>> S.basis()
Family (X, Y, 3*Z)
>>> S(Integer(2)*Y + Integer(9)*Z).to_vector()
(0, 2, 9)
>>> S2 = L.subalgebra([Y, Z])
>>> S2.basis()
Family (Y, Z)
>>> S2(Integer(2)*Y + Integer(9)*Z).to_vector()
(0, 2, 9)
class sage.algebras.lie_algebras.lie_algebra_element.LyndonBracket[source]#

Bases: GradedLieBracket

A Lie bracket (LieBracket) tailored for the Lyndon basis.

The order on these brackets is defined by \(l < r\) if \(w(l) < w(r)\), where \(w(l)\) is the word corresponding to \(l\). (This is also true if one or both of \(l\) and \(r\) is a LieGenerator.)

class sage.algebras.lie_algebras.lie_algebra_element.StructureCoefficientsElement[source]#

Bases: LieAlgebraMatrixWrapper

An element of a Lie algebra given by structure coefficients.

bracket(right)[source]#

Return the Lie bracket [self, right].

EXAMPLES:

sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}, ('y','z'): {'x':1}, ('z','x'): {'y':1}})
sage: x.bracket(y)
z
sage: y.bracket(x)
-z
sage: (x + y - z).bracket(x - y + z)
-2*y - 2*z
>>> from sage.all import *
>>> L = LieAlgebra(QQ, {('x','y'): {'z':Integer(1)}, ('y','z'): {'x':Integer(1)}, ('z','x'): {'y':Integer(1)}}, names=('x', 'y', 'z',)); (x, y, z,) = L._first_ngens(3)
>>> x.bracket(y)
z
>>> y.bracket(x)
-z
>>> (x + y - z).bracket(x - y + z)
-2*y - 2*z
lift()[source]#

Return the lift of self to the universal enveloping algebra.

EXAMPLES:

sage: L.<x,y> = LieAlgebra(QQ, {('x','y'): {'x':1}})
sage: elt = x - 3/2 * y
sage: l = elt.lift(); l
x - 3/2*y
sage: l.parent()
Noncommutative Multivariate Polynomial Ring in x, y
 over Rational Field, nc-relations: {y*x: x*y - x}
>>> from sage.all import *
>>> L = LieAlgebra(QQ, {('x','y'): {'x':Integer(1)}}, names=('x', 'y',)); (x, y,) = L._first_ngens(2)
>>> elt = x - Integer(3)/Integer(2) * y
>>> l = elt.lift(); l
x - 3/2*y
>>> l.parent()
Noncommutative Multivariate Polynomial Ring in x, y
 over Rational Field, nc-relations: {y*x: x*y - x}
monomial_coefficients(copy=True)[source]#

Return the monomial coefficients of self as a dictionary.

EXAMPLES:

sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})
sage: a = 2*x - 3/2*y + z
sage: a.monomial_coefficients()
{'x': 2, 'y': -3/2, 'z': 1}
sage: a = 2*x - 3/2*z
sage: a.monomial_coefficients()
{'x': 2, 'z': -3/2}
>>> from sage.all import *
>>> L = LieAlgebra(QQ, {('x','y'): {'z':Integer(1)}}, names=('x', 'y', 'z',)); (x, y, z,) = L._first_ngens(3)
>>> a = Integer(2)*x - Integer(3)/Integer(2)*y + z
>>> a.monomial_coefficients()
{'x': 2, 'y': -3/2, 'z': 1}
>>> a = Integer(2)*x - Integer(3)/Integer(2)*z
>>> a.monomial_coefficients()
{'x': 2, 'z': -3/2}
to_vector(sparse=False, order=None)[source]#

Return self as a vector.

EXAMPLES:

sage: L.<x,y,z> = LieAlgebra(QQ, {('x','y'): {'z':1}})
sage: a = x + 3*y - z/2
sage: a.to_vector()
(1, 3, -1/2)
>>> from sage.all import *
>>> L = LieAlgebra(QQ, {('x','y'): {'z':Integer(1)}}, names=('x', 'y', 'z',)); (x, y, z,) = L._first_ngens(3)
>>> a = x + Integer(3)*y - z/Integer(2)
>>> a.to_vector()
(1, 3, -1/2)
class sage.algebras.lie_algebras.lie_algebra_element.UntwistedAffineLieAlgebraElement[source]#

Bases: Element

An element of an untwisted affine Lie algebra.

bracket(right)[source]#

Return the Lie bracket [self, right].

EXAMPLES:

sage: L = LieAlgebra(QQ, cartan_type=['A',1,1])
sage: e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
sage: e0.bracket(f0)
(-h1)#t^0 + 4*c
sage: e1.bracket(0)
0
sage: e1.bracket(1)
Traceback (most recent call last):
...
TypeError: no common canonical parent for objects with parents:
 'Affine Kac-Moody algebra of ['A', 1] in the Chevalley basis'
 and 'Integer Ring'
>>> from sage.all import *
>>> L = LieAlgebra(QQ, cartan_type=['A',Integer(1),Integer(1)])
>>> e1,f1,h1,e0,f0,c,d = list(L.lie_algebra_generators())
>>> e0.bracket(f0)
(-h1)#t^0 + 4*c
>>> e1.bracket(Integer(0))
0
>>> e1.bracket(Integer(1))
Traceback (most recent call last):
...
TypeError: no common canonical parent for objects with parents:
 'Affine Kac-Moody algebra of ['A', 1] in the Chevalley basis'
 and 'Integer Ring'
c_coefficient()[source]#

Return the coefficient of \(c\) of self.

EXAMPLES:

sage: L = lie_algebras.Affine(QQ, ['A',1,1])
sage: x = L.an_element() - 3 * L.c()
sage: x.c_coefficient()
-2
>>> from sage.all import *
>>> L = lie_algebras.Affine(QQ, ['A',Integer(1),Integer(1)])
>>> x = L.an_element() - Integer(3) * L.c()
>>> x.c_coefficient()
-2
canonical_derivation()[source]#

Return the canonical derivation \(d\) applied to self.

The canonical derivation \(d\) is defined as

\[d(a \otimes t^m + \alpha c) = a \otimes m t^m.\]

Another formulation is by \(d = t \frac{d}{dt}\).

EXAMPLES:

sage: L = lie_algebras.Affine(QQ, ['E',6,1])
sage: al = RootSystem(['E',6]).root_lattice().simple_roots()
sage: x = L.basis()[al[2]+al[3]+2*al[4]+al[5],5] + 4*L.c() + L.d()
sage: x.canonical_derivation()
(5*E[alpha[2] + alpha[3] + 2*alpha[4] + alpha[5]])#t^5
>>> from sage.all import *
>>> L = lie_algebras.Affine(QQ, ['E',Integer(6),Integer(1)])
>>> al = RootSystem(['E',Integer(6)]).root_lattice().simple_roots()
>>> x = L.basis()[al[Integer(2)]+al[Integer(3)]+Integer(2)*al[Integer(4)]+al[Integer(5)],Integer(5)] + Integer(4)*L.c() + L.d()
>>> x.canonical_derivation()
(5*E[alpha[2] + alpha[3] + 2*alpha[4] + alpha[5]])#t^5
d_coefficient()[source]#

Return the coefficient of \(d\) of self.

EXAMPLES:

sage: L = lie_algebras.Affine(QQ, ['A',1,1])
sage: x = L.an_element() + L.d()
sage: x.d_coefficient()
2
>>> from sage.all import *
>>> L = lie_algebras.Affine(QQ, ['A',Integer(1),Integer(1)])
>>> x = L.an_element() + L.d()
>>> x.d_coefficient()
2
monomial_coefficients(copy=True)[source]#

Return the monomial coefficients of self.

EXAMPLES:

sage: L = lie_algebras.Affine(QQ, ['C',2,1])
sage: x = L.an_element()
sage: sorted(x.monomial_coefficients(), key=str)
[(-2*alpha[1] - alpha[2], 1),
 (-alpha[1], 0),
 (-alpha[2], 0),
 (2*alpha[1] + alpha[2], -1),
 (alpha[1], 0),
 (alpha[2], 0),
 (alphacheck[1], 0),
 (alphacheck[2], 0),
 'c',
 'd']
>>> from sage.all import *
>>> L = lie_algebras.Affine(QQ, ['C',Integer(2),Integer(1)])
>>> x = L.an_element()
>>> sorted(x.monomial_coefficients(), key=str)
[(-2*alpha[1] - alpha[2], 1),
 (-alpha[1], 0),
 (-alpha[2], 0),
 (2*alpha[1] + alpha[2], -1),
 (alpha[1], 0),
 (alpha[2], 0),
 (alphacheck[1], 0),
 (alphacheck[2], 0),
 'c',
 'd']
t_dict()[source]#

Return the dict, whose keys are powers of \(t\) and values are elements of the classical Lie algebra, of self.

EXAMPLES:

sage: L = lie_algebras.Affine(QQ, ['A',1,1])
sage: x = L.an_element()
sage: x.t_dict()
{-1: E[alpha[1]],
 0: E[alpha[1]] + h1 + E[-alpha[1]],
 1: E[-alpha[1]]}
>>> from sage.all import *
>>> L = lie_algebras.Affine(QQ, ['A',Integer(1),Integer(1)])
>>> x = L.an_element()
>>> x.t_dict()
{-1: E[alpha[1]],
 0: E[alpha[1]] + h1 + E[-alpha[1]],
 1: E[-alpha[1]]}