Skip to content

Commit 0480499

Browse files
committed
minor details in doc and code of algebras/
1 parent 665a3fa commit 0480499

File tree

5 files changed

+54
-57
lines changed

5 files changed

+54
-57
lines changed

src/sage/algebras/affine_nil_temperley_lieb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def has_no_braid_relation(self, w, i) -> bool:
221221
222222
sage: A = AffineNilTemperleyLiebTypeA(5)
223223
sage: W = A.weyl_group()
224-
sage: s=W.simple_reflections()
224+
sage: s = W.simple_reflections()
225225
sage: A.has_no_braid_relation(s[2]*s[1]*s[0]*s[4]*s[3],0)
226226
False
227227
sage: A.has_no_braid_relation(s[2]*s[1]*s[0]*s[4]*s[3],2)

src/sage/algebras/free_algebra_element.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
sage: (x*y)^3
1919
x*y*x*y*x*y
2020
"""
21-
22-
#*****************************************************************************
21+
# ***************************************************************************
2322
# Copyright (C) 2005 David Kohel <[email protected]>
2423
#
2524
# Distributed under the terms of the GNU General Public License (GPL)
@@ -31,8 +30,8 @@
3130
# See the GNU General Public License for more details; the full text
3231
# is available at:
3332
#
34-
# http://www.gnu.org/licenses/
35-
#*****************************************************************************
33+
# https://www.gnu.org/licenses/
34+
# ***************************************************************************
3635

3736
from sage.misc.repr import repr_lincomb
3837
from sage.monoids.free_monoid_element import FreeMonoidElement
@@ -56,7 +55,7 @@ class FreeAlgebraElement(IndexedFreeModuleElement, AlgebraElement):
5655
sage: y * x < x * y
5756
False
5857
"""
59-
def __init__(self, A, x):
58+
def __init__(self, A, x) -> None:
6059
"""
6160
Create the element ``x`` of the FreeAlgebra ``A``.
6261
@@ -68,7 +67,7 @@ def __init__(self, A, x):
6867
"""
6968
if isinstance(x, FreeAlgebraElement):
7069
# We should have an input for when we know we don't need to
71-
# convert the keys/values
70+
# convert the keys/values
7271
x = x._monomial_coefficients
7372
R = A.base_ring()
7473
if isinstance(x, AlgebraElement): # and x.parent() == A.base_ring():
@@ -131,7 +130,7 @@ def __call__(self, *x, **kwds):
131130
7
132131
sage: (2*x+y).subs({x:1,y:z})
133132
2 + z
134-
sage: f=x+3*y+z
133+
sage: f = x+3*y+z
135134
sage: f(1,2,1/2)
136135
15/2
137136
sage: f(1,2)
@@ -157,7 +156,8 @@ def extract_from(kwds, g):
157156
pass
158157
return None
159158

160-
x = [extract_from(kwds,(p.gen(i),p.variable_name(i))) for i in range(p.ngens())]
159+
x = [extract_from(kwds, (p.gen(i), p.variable_name(i)))
160+
for i in range(p.ngens())]
161161
elif isinstance(x[0], tuple):
162162
x = x[0]
163163

@@ -169,18 +169,19 @@ def extract_from(kwds, g):
169169
result = None
170170
for m, c in self._monomial_coefficients.items():
171171
if result is None:
172-
result = c*m(x)
172+
result = c * m(x)
173173
else:
174-
result += c*m(x)
174+
result += c * m(x)
175175

176176
if result is None:
177177
return self.parent().zero()
178178
return result
179179

180180
def _mul_(self, y):
181181
"""
182-
Return the product of ``self`` and ``y`` (another free algebra
183-
element with the same parent).
182+
Return the product of ``self`` and ``y``.
183+
184+
This is another free algebra element with the same parent.
184185
185186
EXAMPLES::
186187
@@ -192,16 +193,16 @@ def _mul_(self, y):
192193
z_elt = {}
193194
for mx, cx in self:
194195
for my, cy in y:
195-
key = mx*my
196+
key = mx * my
196197
if key in z_elt:
197-
z_elt[key] += cx*cy
198+
z_elt[key] += cx * cy
198199
else:
199-
z_elt[key] = cx*cy
200+
z_elt[key] = cx * cy
200201
if not z_elt[key]:
201202
del z_elt[key]
202203
return A._from_dict(z_elt)
203204

204-
def is_unit(self):
205+
def is_unit(self) -> bool:
205206
r"""
206207
Return ``True`` if ``self`` is invertible.
207208
@@ -274,10 +275,6 @@ def _acted_upon_(self, scalar, self_on_left=False):
274275
return scalar * Factorization([(self, 1)])
275276
return super()._acted_upon_(scalar, self_on_left)
276277

277-
# For backward compatibility
278-
# _lmul_ = _acted_upon_
279-
# _rmul_ = _acted_upon_
280-
281278
def _im_gens_(self, codomain, im_gens, base_map):
282279
"""
283280
Apply a morphism defined by its values on the generators.
@@ -304,7 +301,7 @@ def _im_gens_(self, codomain, im_gens, base_map):
304301
return codomain.sum(base_map(c) * m(*im_gens)
305302
for m, c in self._monomial_coefficients.items())
306303

307-
def variables(self):
304+
def variables(self) -> list:
308305
"""
309306
Return the variables used in ``self``.
310307

src/sage/algebras/fusion_rings/fusion_double.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def s_ijconj(self, i, j, unitary=False, base_coercion=True):
286286
287287
EXAMPLES::
288288
289-
sage: P=FusionDouble(CyclicPermutationGroup(3),prefix='p',inject_variables=True)
289+
sage: P = FusionDouble(CyclicPermutationGroup(3),prefix='p',inject_variables=True)
290290
sage: P.s_ij(p1,p3)
291291
zeta3
292292
sage: P.s_ijconj(p1,p3)
@@ -695,7 +695,7 @@ def product_on_basis(self, a, b):
695695
696696
EXAMPLES::
697697
698-
sage: Q=FusionDouble(SymmetricGroup(3),prefix='q',inject_variables=True)
698+
sage: Q = FusionDouble(SymmetricGroup(3),prefix='q',inject_variables=True)
699699
sage: q3*q4
700700
q1 + q2 + q5 + q6 + q7
701701
sage: Q._names
@@ -820,7 +820,7 @@ def twist(self, reduced=True):
820820
821821
EXAMPLES::
822822
823-
sage: Q=FusionDouble(CyclicPermutationGroup(3))
823+
sage: Q = FusionDouble(CyclicPermutationGroup(3))
824824
sage: [x.twist() for x in Q.basis()]
825825
[0, 0, 0, 0, 2/3, 4/3, 0, 4/3, 2/3]
826826
sage: [x.ribbon() for x in Q.basis()]

src/sage/algebras/iwahori_hecke_algebra.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):
233233
234234
sage: R.<q> = LaurentPolynomialRing(ZZ)
235235
sage: H = IwahoriHeckeAlgebra('A3', q^2)
236-
sage: T=H.T(); Cp=H.Cp(); C=H.C()
236+
sage: T = H.T(); Cp = H.Cp(); C = H.C()
237237
sage: C(T[1])
238238
q*C[1] + q^2
239239
sage: elt = Cp(T[1,2,1]); elt
@@ -245,7 +245,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):
245245
246246
sage: R.<q> = LaurentPolynomialRing(ZZ)
247247
sage: H = IwahoriHeckeAlgebra('A3', q, -q^-1)
248-
sage: T=H.T(); Cp=H.Cp(); C=H.C()
248+
sage: T = H.T(); Cp = H.Cp(); C = H.C()
249249
sage: C(T[1])
250250
C[1] + q
251251
sage: elt = Cp(T[1,2,1]); elt
@@ -256,7 +256,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):
256256
In the group algebra, so that `(T_r-1)(T_r+1) = 0`::
257257
258258
sage: H = IwahoriHeckeAlgebra('A3', 1)
259-
sage: T=H.T(); Cp=H.Cp(); C=H.C()
259+
sage: T = H.T(); Cp = H.Cp(); C = H.C()
260260
sage: C(T[1])
261261
C[1] + 1
262262
sage: Cp(T[1,2,1])
@@ -270,7 +270,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):
270270
271271
sage: R.<q>=LaurentPolynomialRing(ZZ)
272272
sage: H = IwahoriHeckeAlgebra('A3', q)
273-
sage: C=H.C()
273+
sage: C = H.C()
274274
Traceback (most recent call last):
275275
...
276276
ValueError: the Kazhdan-Lusztig bases are defined only when -q_1*q_2 is a square
@@ -279,7 +279,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):
279279
280280
sage: R.<v> = LaurentPolynomialRing(ZZ)
281281
sage: H = IwahoriHeckeAlgebra(['A',2,1], v^2)
282-
sage: T=H.T(); Cp=H.Cp(); C=H.C()
282+
sage: T = H.T(); Cp = H.Cp(); C = H.C()
283283
sage: C(T[1,0,2])
284284
v^3*C[1,0,2] + v^4*C[1,0] + v^4*C[0,2] + v^4*C[1,2]
285285
+ v^5*C[0] + v^5*C[2] + v^5*C[1] + v^6
@@ -1621,8 +1621,8 @@ def hash_involution_on_basis(self, w):
16211621
16221622
sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
16231623
sage: H = IwahoriHeckeAlgebra('A3', v**2)
1624-
sage: T=H.T()
1625-
sage: s=H.coxeter_group().simple_reflection(1)
1624+
sage: T = H.T()
1625+
sage: s = H.coxeter_group().simple_reflection(1)
16261626
sage: T.hash_involution_on_basis(s)
16271627
-(v^-2)*T[1]
16281628
sage: T[s].hash_involution()
@@ -1661,8 +1661,8 @@ def goldman_involution_on_basis(self, w):
16611661
16621662
sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
16631663
sage: H = IwahoriHeckeAlgebra('A3', v**2)
1664-
sage: T=H.T()
1665-
sage: s=H.coxeter_group().simple_reflection(1)
1664+
sage: T = H.T()
1665+
sage: s = H.coxeter_group().simple_reflection(1)
16661666
sage: T.goldman_involution_on_basis(s)
16671667
-T[1] - (1-v^2)
16681668
sage: T[s].goldman_involution()
@@ -1836,8 +1836,8 @@ def to_T_basis(self, w):
18361836
18371837
EXAMPLES::
18381838
1839-
sage: H=IwahoriHeckeAlgebra("A3",1); Cp=H.Cp(); C=H.C()
1840-
sage: s=H.coxeter_group().simple_reflection(1)
1839+
sage: H = IwahoriHeckeAlgebra("A3",1); Cp = H.Cp(); C = H.C()
1840+
sage: s = H.coxeter_group().simple_reflection(1)
18411841
sage: C.to_T_basis(s)
18421842
T[1] - 1
18431843
sage: Cp.to_T_basis(s)
@@ -2032,8 +2032,8 @@ def hash_involution_on_basis(self, w):
20322032
20332033
sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
20342034
sage: H = IwahoriHeckeAlgebra('A3', v**2)
2035-
sage: Cp=H.Cp()
2036-
sage: s=H.coxeter_group().simple_reflection(1)
2035+
sage: Cp = H.Cp()
2036+
sage: s = H.coxeter_group().simple_reflection(1)
20372037
sage: Cp.hash_involution_on_basis(s)
20382038
-Cp[1] + (v^-1+v)
20392039
sage: Cp[s].hash_involution()
@@ -2130,7 +2130,7 @@ def product_on_basis(self, w1, w2):
21302130
sage: # optional - coxeter3
21312131
sage: R.<v> = LaurentPolynomialRing(ZZ, 'v')
21322132
sage: W = CoxeterGroup('A3', implementation='coxeter3')
2133-
sage: H = IwahoriHeckeAlgebra(W, v**2); Cp=H.Cp()
2133+
sage: H = IwahoriHeckeAlgebra(W, v**2); Cp = H.Cp()
21342134
sage: Cp.product_on_basis(W([1,2,1]), W([3,1]))
21352135
(v^-1+v)*Cp[1,2,1,3]
21362136
sage: Cp.product_on_basis(W([1,2,1]), W([3,1,2]))
@@ -2267,7 +2267,7 @@ def _decompose_into_generators(self, u):
22672267
22682268
sage: R.<v> = LaurentPolynomialRing(ZZ, 'v') # optional - coxeter3
22692269
sage: W = CoxeterGroup('A3', implementation='coxeter3') # optional - coxeter3
2270-
sage: H = IwahoriHeckeAlgebra(W, v**2); Cp=H.Cp() # optional - coxeter3
2270+
sage: H = IwahoriHeckeAlgebra(W, v**2); Cp = H.Cp() # optional - coxeter3
22712271
22722272
When `u` is itself a generator `s`, the decomposition is trivial::
22732273
@@ -2440,8 +2440,8 @@ def hash_involution_on_basis(self, w):
24402440
24412441
sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
24422442
sage: H = IwahoriHeckeAlgebra('A3', v**2)
2443-
sage: C=H.C()
2444-
sage: s=H.coxeter_group().simple_reflection(1)
2443+
sage: C = H.C()
2444+
sage: s = H.coxeter_group().simple_reflection(1)
24452445
sage: C.hash_involution_on_basis(s)
24462446
-C[1] - (v^-1+v)
24472447
sage: C[s].hash_involution()
@@ -2473,7 +2473,7 @@ class A(_Basis):
24732473
24742474
sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
24752475
sage: H = IwahoriHeckeAlgebra('A3', v**2)
2476-
sage: A=H.A(); T=H.T()
2476+
sage: A = H.A(); T = H.T()
24772477
sage: T(A[1])
24782478
T[1] + (1/2-1/2*v^2)
24792479
sage: T(A[1,2])
@@ -2526,8 +2526,8 @@ def to_T_basis(self, w):
25262526
EXAMPLES::
25272527
25282528
sage: R.<v> = LaurentPolynomialRing(QQ)
2529-
sage: H = IwahoriHeckeAlgebra('A3', v**2); A=H.A(); T=H.T()
2530-
sage: s=H.coxeter_group().simple_reflection(1)
2529+
sage: H = IwahoriHeckeAlgebra('A3', v**2); A = H.A(); T = H.T()
2530+
sage: s = H.coxeter_group().simple_reflection(1)
25312531
sage: A.to_T_basis(s)
25322532
T[1] + (1/2-1/2*v^2)
25332533
sage: T(A[1,2])
@@ -2550,8 +2550,8 @@ def goldman_involution_on_basis(self, w):
25502550
25512551
sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
25522552
sage: H = IwahoriHeckeAlgebra('A3', v**2)
2553-
sage: A=H.A()
2554-
sage: s=H.coxeter_group().simple_reflection(1)
2553+
sage: A = H.A()
2554+
sage: s = H.coxeter_group().simple_reflection(1)
25552555
sage: A.goldman_involution_on_basis(s)
25562556
-A[1]
25572557
sage: A[1,2].goldman_involution()
@@ -2593,7 +2593,7 @@ class B(_Basis):
25932593
25942594
sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
25952595
sage: H = IwahoriHeckeAlgebra('A3', v**2)
2596-
sage: A=H.A(); T=H.T(); Cp=H.Cp()
2596+
sage: A = H.A(); T = H.T(); Cp = H.Cp()
25972597
sage: T(A[1])
25982598
T[1] + (1/2-1/2*v^2)
25992599
sage: T(A[1,2])
@@ -2659,8 +2659,8 @@ def to_T_basis(self, w):
26592659
EXAMPLES::
26602660
26612661
sage: R.<v> = LaurentPolynomialRing(QQ)
2662-
sage: H = IwahoriHeckeAlgebra('A3', v**2); B=H.B(); T=H.T()
2663-
sage: s=H.coxeter_group().simple_reflection(1)
2662+
sage: H = IwahoriHeckeAlgebra('A3', v**2); B = H.B(); T = H.T()
2663+
sage: s = H.coxeter_group().simple_reflection(1)
26642664
sage: B.to_T_basis(s)
26652665
T[1] + (1/2-1/2*v^2)
26662666
sage: T(B[1,2])
@@ -2687,8 +2687,8 @@ def goldman_involution_on_basis(self, w):
26872687
26882688
sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
26892689
sage: H = IwahoriHeckeAlgebra('A3', v**2)
2690-
sage: B=H.B()
2691-
sage: s=H.coxeter_group().simple_reflection(1)
2690+
sage: B = H.B()
2691+
sage: s = H.coxeter_group().simple_reflection(1)
26922692
sage: B.goldman_involution_on_basis(s)
26932693
-B[1]
26942694
sage: B[1,2].goldman_involution()
@@ -2822,8 +2822,8 @@ def _bar_on_coefficients(self, c):
28222822
EXAMPLES::
28232823
28242824
sage: R.<q>=LaurentPolynomialRing(ZZ)
2825-
sage: H=IwahoriHeckeAlgebra("A3",q^2)
2826-
sage: GH=H._generic_iwahori_hecke_algebra
2825+
sage: H = IwahoriHeckeAlgebra("A3",q^2)
2826+
sage: GH = H._generic_iwahori_hecke_algebra
28272827
sage: GH._bar_on_coefficients(GH.u_inv)
28282828
u
28292829
sage: GH._bar_on_coefficients(GH.v_inv)
@@ -2871,8 +2871,8 @@ def specialize_to(self, new_hecke):
28712871
EXAMPLES::
28722872
28732873
sage: R.<a,b>=LaurentPolynomialRing(ZZ,2)
2874-
sage: H=IwahoriHeckeAlgebra("A3",a^2,-b^2)
2875-
sage: GH=H._generic_iwahori_hecke_algebra
2874+
sage: H = IwahoriHeckeAlgebra("A3",a^2,-b^2)
2875+
sage: GH = H._generic_iwahori_hecke_algebra
28762876
sage: GH.T()(GH.C()[1])
28772877
(v^-1)*T[1] + (-u*v^-1)
28782878
sage: ( GH.T()(GH.C()[1]) ).specialize_to(H)

src/sage/algebras/steenrod/steenrod_algebra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2966,7 +2966,7 @@ def top_class(self):
29662966
29672967
TESTS::
29682968
2969-
sage: A=SteenrodAlgebra(2, profile=(3,2,1), basis='pst')
2969+
sage: A = SteenrodAlgebra(2, profile=(3,2,1), basis='pst')
29702970
sage: A.top_class().parent() is A
29712971
True
29722972
"""

0 commit comments

Comments
 (0)