Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Better mutliplication of PBW elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Scrimshaw committed Jun 18, 2017
1 parent e0f9c88 commit f61aae2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sage/algebras/lie_algebras/lie_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ def monomial(self, i):
sage: L.monomial(x.leading_support())
x
"""
if i not in self.basis().keys():
if i not in self._assoc.basis().keys():
#return self(self._assoc.monomial(i))
raise ValueError("not an index")
return self.element_class(self, self._assoc.monomial(i))
Expand All @@ -1121,7 +1121,7 @@ def term(self, i, c=None):
sage: L.term(x.leading_support(), 4)
4*x
"""
if i not in self.basis().keys():
if i not in self._assoc.basis().keys():
#return self(self._assoc.term(i, c))
raise ValueError("not an index")
return self.element_class(self, self._assoc.term(i, c))
Expand Down
13 changes: 13 additions & 0 deletions src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,19 @@ def product_on_basis(self, lhs, rhs):
sage: E * F * H * E
PBW['E']^2*PBW['F']*PBW['H'] + 2*PBW['E']^2*PBW['F']
- PBW['E']*PBW['H']^2 - 2*PBW['E']*PBW['H']
TESTS:
Check that :trac:`23268` is fixed::
sage: MS = MatrixSpace(QQ, 2,2)
sage: gl = LieAlgebra(associative=MS)
sage: Ugl = gl.pbw_basis()
sage: prod(Ugl.gens())
PBW[(0, 0)]*PBW[(0, 1)]*PBW[(1, 0)]*PBW[(1, 1)]
sage: prod(reversed(list(Ugl.gens())))
PBW[(0, 0)]*PBW[(0, 1)]*PBW[(1, 0)]*PBW[(1, 1)]
- PBW[(0, 0)]^2*PBW[(1, 1)] + PBW[(0, 0)]*PBW[(1, 1)]^2
"""
# Some trivial base cases
if lhs == self.one_basis():
Expand Down

0 comments on commit f61aae2

Please sign in to comment.