Skip to content

Commit 238f042

Browse files
author
Release Manager
committed
gh-38382: refining the category of all-commuting g-algebras
fixing #38047 ### 📝 Checklist - [x] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. URL: #38382 Reported by: Frédéric Chapoton Reviewer(s): Travis Scrimshaw
2 parents 3058939 + 4727407 commit 238f042

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=282c4b485888da0c9e2ce72c1c2b08f2df47480b
3-
sha256=ddb46580851222af6d0f3bc8f997c47792cccb5a875dd22d130bb5b1acb8731e
2+
sha1=7b7c79fc15432a1cc3d08c2f2fc610391970a727
3+
sha256=732dc8f003f58952b811302a48ad743dab86208d236df8843fd6b904c46aa474
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3c279ec5712e0fa35c5733e03e010970727d7189
1+
46d6ebe05583047bc9cc89904af075483e78fdae

src/sage/algebras/free_algebra.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ def g_algebra(self, relations, names=None, order='degrevlex', check=True):
915915
"""
916916
The `G`-Algebra derived from this algebra by relations.
917917
918-
By default is assumed, that two variables commute.
918+
By default it is assumed that any two variables commute.
919919
920920
.. TODO::
921921
@@ -958,6 +958,7 @@ def g_algebra(self, relations, names=None, order='degrevlex', check=True):
958958
(-t)*x*y + t*y + (t + 1)
959959
"""
960960
from sage.matrix.constructor import Matrix
961+
commutative = not relations
961962

962963
base_ring = self.base_ring()
963964
polynomial_ring = PolynomialRing(base_ring, self.gens())
@@ -993,7 +994,7 @@ def g_algebra(self, relations, names=None, order='degrevlex', check=True):
993994
from sage.rings.polynomial.plural import g_Algebra
994995
return g_Algebra(base_ring, cmat, dmat,
995996
names=names or self.variable_names(),
996-
order=order, check=check)
997+
order=order, check=check, commutative=commutative)
997998

998999
def poincare_birkhoff_witt_basis(self):
9991000
"""

src/sage/rings/polynomial/plural.pyx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class G_AlgFactory(UniqueFactory):
157157
- ``key`` -- a 6-tuple, formed by a base ring, a tuple of names, two
158158
matrices over a polynomial ring over the base ring with the given
159159
variable names, a term order, and a category
160-
- ``extra_args`` -- a dictionary, whose only relevant key is 'check'.
160+
- ``extra_args`` -- a dictionary, whose only relevant key is 'check'
161161
162162
TESTS::
163163
@@ -174,7 +174,7 @@ class G_AlgFactory(UniqueFactory):
174174
category, check)
175175

176176
def create_key_and_extra_args(self, base_ring, c, d, names=None, order=None,
177-
category=None, check=None):
177+
category=None, check=None, commutative=None):
178178
"""
179179
Create a unique key for g-algebras.
180180
@@ -186,13 +186,18 @@ class G_AlgFactory(UniqueFactory):
186186
- ``order`` -- (optional) term order
187187
- ``category`` -- (optional) category
188188
- ``check`` -- optional bool
189+
- ``commutative`` -- optional bool
189190
190191
TESTS::
191192
192193
sage: A.<x,y,z> = FreeAlgebra(QQ, 3)
193194
sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y})
194195
sage: H is A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) # indirect doctest
195196
True
197+
198+
sage: P = A.g_algebra(relations={}, order='lex')
199+
sage: P.category()
200+
Category of commutative algebras over Rational Field
196201
"""
197202
if names is None:
198203
raise ValueError("The generator names must be provided")
@@ -213,7 +218,11 @@ class G_AlgFactory(UniqueFactory):
213218
d.set_immutable()
214219

215220
# Get the correct category
216-
category = check_default_category(Algebras(base_ring), category)
221+
if commutative:
222+
usualcat = Algebras(base_ring).Commutative()
223+
else:
224+
usualcat = Algebras(base_ring)
225+
category = check_default_category(usualcat, category)
217226

218227
# Extra arg
219228
if check is None:

src/sage/structure/factory.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ cdef class UniqueFactory(SageObject):
171171
....: return args, {'impl':kwds.get('impl', None)}
172172
....: def create_object(self, version, key, **extra_args):
173173
....: impl = extra_args['impl']
174-
....: if impl=='C':
174+
....: if impl == 'C':
175175
....: return C(*key)
176-
....: if impl=='D':
176+
....: if impl == 'D':
177177
....: return D(*key)
178178
....: return E(*key)
179179
....:

0 commit comments

Comments
 (0)