# Examples of a Lie algebra¶

sage.categories.examples.lie_algebras.Example
class sage.categories.examples.lie_algebras.LieAlgebraFromAssociative(gens)

An example of a Lie algebra: a Lie algebra generated by a set of elements of an associative algebra.

This class illustrates a minimal implementation of a Lie algebra.

Let $$R$$ be a commutative ring, and $$A$$ an associative $$R$$-algebra. The Lie algebra $$A$$ (sometimes denoted $$A^-$$) is defined to be the $$R$$-module $$A$$ with Lie bracket given by the commutator in $$A$$: that is, $$[a, b] := ab - ba$$ for all $$a, b \in A$$.

What this class implements is not precisely $$A^-$$, however; it is the Lie subalgebra of $$A^-$$ generated by the elements of the iterable gens. This specific implementation does not provide a reasonable containment test (i.e., it does not allow you to check if a given element $$a$$ of $$A^-$$ belongs to this Lie subalgebra); it, however, allows computing inside it.

INPUT:

• gens – a nonempty iterable consisting of elements of an associative algebra $$A$$

OUTPUT:

The Lie subalgebra of $$A^-$$ generated by the elements of gens

EXAMPLES:

We create a model of $$\mathfrak{sl}_2$$ using matrices:

sage: gens = [matrix([[0,1],[0,0]]), matrix([[0,0],[1,0]]), matrix([[1,0],[0,-1]])]
sage: for g in gens:
....:     g.set_immutable()
sage: L = LieAlgebras(QQ).example(gens)
sage: e,f,h = L.lie_algebra_generators()
sage: e.bracket(f) == h
True
sage: h.bracket(e) == 2*e
True
sage: h.bracket(f) == -2*f
True

class Element

Wrap an element as a Lie algebra element.

lie_algebra_generators()

Return the generators of self as a Lie algebra.

EXAMPLES:

sage: L = LieAlgebras(QQ).example()
sage: L.lie_algebra_generators()
Family ([2, 1, 3], [2, 3, 1])

zero()

Return the element 0.

EXAMPLES:

sage: L = LieAlgebras(QQ).example()
sage: L.zero()
0