Skip to content

Commit 45c963e

Browse files
author
Release Manager
committedJun 27, 2022
Trac #34030: move supercommutator to superalgebras
which is the proper place for it, as suggested by a TODO URL: https://trac.sagemath.org/34030 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Travis Scrimshaw
2 parents d4706f9 + d2c97b6 commit 45c963e

File tree

3 files changed

+68
-64
lines changed

3 files changed

+68
-64
lines changed
 

‎src/sage/algebras/clifford_algebra.py

-58
Original file line numberDiff line numberDiff line change
@@ -318,64 +318,6 @@ def conjugate(self):
318318

319319
clifford_conjugate = conjugate
320320

321-
# TODO: This is a general function which should be moved to a
322-
# superalgebras category when one is implemented.
323-
def supercommutator(self, x):
324-
r"""
325-
Return the supercommutator of ``self`` and ``x``.
326-
327-
Let `A` be a superalgebra. The *supercommutator* of homogeneous
328-
elements `x, y \in A` is defined by
329-
330-
.. MATH::
331-
332-
[x, y\} = x y - (-1)^{|x| |y|} y x
333-
334-
and extended to all elements by linearity.
335-
336-
EXAMPLES::
337-
338-
sage: Q = QuadraticForm(ZZ, 3, [1,2,3,4,5,6])
339-
sage: Cl.<x,y,z> = CliffordAlgebra(Q)
340-
sage: a = x*y - z
341-
sage: b = x - y + y*z
342-
sage: a.supercommutator(b)
343-
-5*x*y + 8*x*z - 2*y*z - 6*x + 12*y - 5*z
344-
sage: a.supercommutator(Cl.one())
345-
0
346-
sage: Cl.one().supercommutator(a)
347-
0
348-
sage: Cl.zero().supercommutator(a)
349-
0
350-
sage: a.supercommutator(Cl.zero())
351-
0
352-
353-
sage: Q = QuadraticForm(ZZ, 2, [-1,1,-3])
354-
sage: Cl.<x,y> = CliffordAlgebra(Q)
355-
sage: [a.supercommutator(b) for a in Cl.basis() for b in Cl.basis()]
356-
[0, 0, 0, 0, 0, -2, 1, -x - 2*y, 0, 1,
357-
-6, 6*x + y, 0, x + 2*y, -6*x - y, 0]
358-
sage: [a*b-b*a for a in Cl.basis() for b in Cl.basis()]
359-
[0, 0, 0, 0, 0, 0, 2*x*y - 1, -x - 2*y, 0,
360-
-2*x*y + 1, 0, 6*x + y, 0, x + 2*y, -6*x - y, 0]
361-
362-
Exterior algebras inherit from Clifford algebras, so
363-
supercommutators work as well. We verify the exterior algebra
364-
is supercommutative::
365-
366-
sage: E.<x,y,z,w> = ExteriorAlgebra(QQ)
367-
sage: all(b1.supercommutator(b2) == 0
368-
....: for b1 in E.basis() for b2 in E.basis())
369-
True
370-
"""
371-
P = self.parent()
372-
ret = P.zero()
373-
for ms,cs in self:
374-
for mx,cx in x:
375-
ret += P.term(ms, cs) * P.term(mx, cx)
376-
s = (-1)**(P.degree_on_basis(ms) * P.degree_on_basis(mx))
377-
ret -= s * P.term(mx, cx) * P.term(ms, cs)
378-
return ret
379321

380322
class CliffordAlgebra(CombinatorialFreeModule):
381323
r"""

‎src/sage/categories/super_algebras.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
r"""
22
Super Algebras
33
"""
4-
#*****************************************************************************
4+
# ****************************************************************************
55
# Copyright (C) 2015 Travis Scrimshaw <tscrim at ucdavis.edu>
66
#
77
# Distributed under the terms of the GNU General Public License (GPL)
8-
# http://www.gnu.org/licenses/
9-
#******************************************************************************
8+
# https://www.gnu.org/licenses/
9+
# *****************************************************************************
1010

1111
from sage.categories.super_modules import SuperModulesCategory
1212
from sage.categories.signed_tensor import SignedTensorProductsCategory, tensor_signed
1313
from sage.categories.tensor import tensor
1414
from sage.misc.lazy_import import LazyImport
1515
from sage.misc.cachefunc import cached_method
1616

17+
1718
class SuperAlgebras(SuperModulesCategory):
1819
r"""
1920
The category of super algebras.

‎src/sage/categories/super_algebras_with_basis.py

+64-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
r"""
22
Super algebras with basis
33
"""
4-
#*****************************************************************************
4+
# ****************************************************************************
55
# Copyright (C) 2015,2019 Travis Scrimshaw <tcscrims at gmail.com>
66
#
77
# Distributed under the terms of the GNU General Public License (GPL)
8-
# http://www.gnu.org/licenses/
9-
#******************************************************************************
8+
# https://www.gnu.org/licenses/
9+
# *****************************************************************************
1010

1111
from sage.categories.super_modules import SuperModulesCategory
1212
from sage.categories.signed_tensor import SignedTensorProductsCategory
1313
from sage.misc.cachefunc import cached_method
1414

15+
1516
class SuperAlgebrasWithBasis(SuperModulesCategory):
1617
"""
1718
The category of super algebras with a distinguished basis
@@ -59,6 +60,66 @@ def graded_algebra(self):
5960
from sage.algebras.associated_graded import AssociatedGradedAlgebra
6061
return AssociatedGradedAlgebra(self)
6162

63+
class ElementMethods:
64+
def supercommutator(self, x):
65+
r"""
66+
Return the supercommutator of ``self`` and ``x``.
67+
68+
Let `A` be a superalgebra. The *supercommutator* of homogeneous
69+
elements `x, y \in A` is defined by
70+
71+
.. MATH::
72+
73+
[x, y\} = x y - (-1)^{|x| |y|} y x
74+
75+
and extended to all elements by linearity.
76+
77+
EXAMPLES::
78+
79+
sage: Q = QuadraticForm(ZZ, 3, [1,2,3,4,5,6])
80+
sage: Cl.<x,y,z> = CliffordAlgebra(Q)
81+
sage: a = x*y - z
82+
sage: b = x - y + y*z
83+
sage: a.supercommutator(b)
84+
-5*x*y + 8*x*z - 2*y*z - 6*x + 12*y - 5*z
85+
sage: a.supercommutator(Cl.one())
86+
0
87+
sage: Cl.one().supercommutator(a)
88+
0
89+
sage: Cl.zero().supercommutator(a)
90+
0
91+
sage: a.supercommutator(Cl.zero())
92+
0
93+
94+
sage: Q = QuadraticForm(ZZ, 2, [-1,1,-3])
95+
sage: Cl.<x,y> = CliffordAlgebra(Q)
96+
sage: [a.supercommutator(b) for a in Cl.basis() for b in Cl.basis()]
97+
[0, 0, 0, 0, 0, -2, 1, -x - 2*y, 0, 1,
98+
-6, 6*x + y, 0, x + 2*y, -6*x - y, 0]
99+
sage: [a*b-b*a for a in Cl.basis() for b in Cl.basis()]
100+
[0, 0, 0, 0, 0, 0, 2*x*y - 1, -x - 2*y, 0,
101+
-2*x*y + 1, 0, 6*x + y, 0, x + 2*y, -6*x - y, 0]
102+
103+
Exterior algebras inherit from Clifford algebras, so
104+
supercommutators work as well. We verify the exterior algebra
105+
is supercommutative::
106+
107+
sage: E.<x,y,z,w> = ExteriorAlgebra(QQ)
108+
sage: all(b1.supercommutator(b2) == 0
109+
....: for b1 in E.basis() for b2 in E.basis())
110+
True
111+
"""
112+
P = self.parent()
113+
ret = P.zero()
114+
for ms, cs in self:
115+
term_s = P.term(ms, cs)
116+
sign_s = (-1)**P.degree_on_basis(ms)
117+
for mx, cx in x:
118+
ret += term_s * P.term(mx, cx)
119+
s = sign_s**P.degree_on_basis(mx)
120+
ret -= s * P.term(mx, cx) * term_s
121+
return ret
122+
62123
class SignedTensorProducts(SignedTensorProductsCategory):
63124
"""
64125
The category of super algebras with basis constructed by tensor

0 commit comments

Comments
 (0)
Please sign in to comment.