@@ -1745,10 +1745,10 @@ def universal_commutative_algebra(self):
1745
1745
R = P [0 ].parent ()
1746
1746
return R .quotient (P )
1747
1747
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 ):
1749
1749
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``.
1752
1752
1753
1753
A *Casimir element* of order `k` is a distinguished basis element
1754
1754
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):
1760
1760
INPUT:
1761
1761
1762
1762
- ``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
1765
1765
- ``force_generic`` -- (default: ``False``) if ``True`` for the
1766
1766
quadratic order, then this uses the default algorithm; otherwise
1767
1767
this is ignored
1768
+ - ``basis`` -- (default: ``False``) if ``True``, this returns a
1769
+ basis of all Casimir elements of order ``order`` as a list
1768
1770
1769
1771
ALGORITHM:
1770
1772
@@ -1832,6 +1834,13 @@ def casimir_element(self, order=2, UEA=None, force_generic=False):
1832
1834
sage: L.casimir_element()
1833
1835
0
1834
1836
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
+
1835
1844
TESTS::
1836
1845
1837
1846
sage: # needs sage.combinat sage.modules
@@ -1856,7 +1865,7 @@ def casimir_element(self, order=2, UEA=None, force_generic=False):
1856
1865
1857
1866
B = self .basis ()
1858
1867
1859
- if order == 2 and not force_generic :
1868
+ if order == 2 and not force_generic and not basis :
1860
1869
# Special case for the quadratic using the Killing form
1861
1870
try :
1862
1871
K = self .killing_form_matrix ().inverse ()
@@ -1896,11 +1905,10 @@ def casimir_element(self, order=2, UEA=None, force_generic=False):
1896
1905
if ker .dimension () == 0 :
1897
1906
return self .zero ()
1898
1907
1899
- tens = ker .basis ()[0 ]
1900
1908
del eqns # no need to hold onto the matrix
1901
1909
1902
- def to_prod (index ):
1903
- coeff = tens [index ]
1910
+ def to_prod (vec , index ):
1911
+ coeff = vec [index ]
1904
1912
p = [0 ] * order
1905
1913
base = dim ** (order - 1 )
1906
1914
for i in range (order ):
@@ -1910,7 +1918,15 @@ def to_prod(index):
1910
1918
p .reverse ()
1911
1919
return coeff * UEA .prod (UEA (B [keys [i ]]) for i in p )
1912
1920
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
+
1914
1930
1915
1931
class ElementMethods :
1916
1932
def adjoint_matrix (self , sparse = False ): # In #11111 (more or less) by using matrix of a morphism
0 commit comments