Skip to content

Commit 4b5848a

Browse files
committed
Allow returning all Casimir elements of a fixed order.
1 parent cb8e15b commit 4b5848a

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def degree_on_basis(self, m):
496496
"""
497497
return m.length()
498498

499-
def casimir_element(self, order=2):
499+
def casimir_element(self, order=2, *args, **kwds):
500500
r"""
501501
Return the Casimir element of ``self``.
502502
@@ -534,7 +534,7 @@ def casimir_element(self, order=2):
534534
from sage.rings.infinity import Infinity
535535
if self._g.dimension() == Infinity:
536536
raise ValueError("the Lie algebra must be finite dimensional")
537-
return self._g.casimir_element(order=order, UEA=self)
537+
return self._g.casimir_element(order=order, UEA=self, *args, **kwds)
538538

539539
class Element(CombinatorialFreeModule.Element):
540540
def _act_on_(self, x, self_on_left):

src/sage/categories/finite_dimensional_lie_algebras_with_basis.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,10 +1745,10 @@ def universal_commutative_algebra(self):
17451745
R = P[0].parent()
17461746
return R.quotient(P)
17471747

1748-
def casimir_element(self, order=2, UEA=None, force_generic=False):
1748+
def casimir_element(self, order=2, UEA=None, force_generic=False, basis=False):
17491749
r"""
1750-
Return the Casimir element in the universal enveloping algebra
1751-
of ``self``.
1750+
Return a Casimir element of order ``order`` in the universal
1751+
enveloping algebra of ``self``.
17521752
17531753
A *Casimir element* of order `k` is a distinguished basis element
17541754
for the center of `U(\mathfrak{g})` of homogeneous degree `k`
@@ -1760,11 +1760,13 @@ def casimir_element(self, order=2, UEA=None, force_generic=False):
17601760
INPUT:
17611761
17621762
- ``order`` -- (default: ``2``) the order of the Casimir element
1763-
- ``UEA`` -- (optional) the universal enveloping algebra to
1764-
return the result in
1763+
- ``UEA`` -- (optional) the universal enveloping algebra
1764+
implementation to return the result in
17651765
- ``force_generic`` -- (default: ``False``) if ``True`` for the
17661766
quadratic order, then this uses the default algorithm; otherwise
17671767
this is ignored
1768+
- ``basis`` -- (default: ``False``) if ``True``, this returns a
1769+
basis of all Casimir elements of order ``order`` as a list
17681770
17691771
ALGORITHM:
17701772
@@ -1832,6 +1834,13 @@ def casimir_element(self, order=2, UEA=None, force_generic=False):
18321834
sage: L.casimir_element()
18331835
0
18341836
1837+
sage: # needs sage.combinat sage.modules
1838+
sage: g = LieAlgebra(QQ, cartan_type=['D',2])
1839+
sage: U = g.pbw_basis()
1840+
sage: U.casimir_element(2, basis=True)
1841+
[2*PBW[alpha[2]]*PBW[-alpha[2]] + 1/2*PBW[alphacheck[2]]^2 - PBW[alphacheck[2]],
1842+
2*PBW[alpha[1]]*PBW[-alpha[1]] + 1/2*PBW[alphacheck[1]]^2 - PBW[alphacheck[1]]]
1843+
18351844
TESTS::
18361845
18371846
sage: # needs sage.combinat sage.modules
@@ -1856,7 +1865,7 @@ def casimir_element(self, order=2, UEA=None, force_generic=False):
18561865

18571866
B = self.basis()
18581867

1859-
if order == 2 and not force_generic:
1868+
if order == 2 and not force_generic and not basis:
18601869
# Special case for the quadratic using the Killing form
18611870
try:
18621871
K = self.killing_form_matrix().inverse()
@@ -1896,11 +1905,10 @@ def casimir_element(self, order=2, UEA=None, force_generic=False):
18961905
if ker.dimension() == 0:
18971906
return self.zero()
18981907

1899-
tens = ker.basis()[0]
19001908
del eqns # no need to hold onto the matrix
19011909

1902-
def to_prod(index):
1903-
coeff = tens[index]
1910+
def to_prod(vec, index):
1911+
coeff = vec[index]
19041912
p = [0] * order
19051913
base = dim ** (order-1)
19061914
for i in range(order):
@@ -1910,7 +1918,15 @@ def to_prod(index):
19101918
p.reverse()
19111919
return coeff * UEA.prod(UEA(B[keys[i]]) for i in p)
19121920

1913-
return UEA.sum(to_prod(index) for index in tens.support())
1921+
tens = ker.basis()
1922+
1923+
if not basis:
1924+
vec = tens[0]
1925+
return UEA.sum(to_prod(vec, index) for index in vec.support())
1926+
1927+
return [UEA.sum(to_prod(vec, index) for index in vec.support())
1928+
for vec in tens]
1929+
19141930

19151931
class ElementMethods:
19161932
def adjoint_matrix(self, sparse=False): # In #11111 (more or less) by using matrix of a morphism

0 commit comments

Comments
 (0)