Skip to content

minor details in doc and code of algebras/ #40325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sage/algebras/affine_nil_temperley_lieb.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def has_no_braid_relation(self, w, i) -> bool:

sage: A = AffineNilTemperleyLiebTypeA(5)
sage: W = A.weyl_group()
sage: s=W.simple_reflections()
sage: s = W.simple_reflections()
sage: A.has_no_braid_relation(s[2]*s[1]*s[0]*s[4]*s[3],0)
False
sage: A.has_no_braid_relation(s[2]*s[1]*s[0]*s[4]*s[3],2)
Expand Down
39 changes: 18 additions & 21 deletions src/sage/algebras/free_algebra_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
sage: (x*y)^3
x*y*x*y*x*y
"""

#*****************************************************************************
# ***************************************************************************
# Copyright (C) 2005 David Kohel <kohel@maths.usyd.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
Expand All @@ -31,8 +30,8 @@
# See the GNU General Public License for more details; the full text
# is available at:
#
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ***************************************************************************

from sage.misc.repr import repr_lincomb
from sage.monoids.free_monoid_element import FreeMonoidElement
Expand All @@ -56,7 +55,7 @@
sage: y * x < x * y
False
"""
def __init__(self, A, x):
def __init__(self, A, x) -> None:
"""
Create the element ``x`` of the FreeAlgebra ``A``.

Expand All @@ -68,7 +67,7 @@
"""
if isinstance(x, FreeAlgebraElement):
# We should have an input for when we know we don't need to
# convert the keys/values
# convert the keys/values
x = x._monomial_coefficients
R = A.base_ring()
if isinstance(x, AlgebraElement): # and x.parent() == A.base_ring():
Expand Down Expand Up @@ -131,7 +130,7 @@
7
sage: (2*x+y).subs({x:1,y:z})
2 + z
sage: f=x+3*y+z
sage: f = x+3*y+z
sage: f(1,2,1/2)
15/2
sage: f(1,2)
Expand All @@ -157,7 +156,8 @@
pass
return None

x = [extract_from(kwds,(p.gen(i),p.variable_name(i))) for i in range(p.ngens())]
x = [extract_from(kwds, (p.gen(i), p.variable_name(i)))

Check warning on line 159 in src/sage/algebras/free_algebra_element.py

View check run for this annotation

Codecov / codecov/patch

src/sage/algebras/free_algebra_element.py#L159

Added line #L159 was not covered by tests
for i in range(p.ngens())]
elif isinstance(x[0], tuple):
x = x[0]

Expand All @@ -169,18 +169,19 @@
result = None
for m, c in self._monomial_coefficients.items():
if result is None:
result = c*m(x)
result = c * m(x)
else:
result += c*m(x)
result += c * m(x)

if result is None:
return self.parent().zero()
return result

def _mul_(self, y):
"""
Return the product of ``self`` and ``y`` (another free algebra
element with the same parent).
Return the product of ``self`` and ``y``.

This is another free algebra element with the same parent.

EXAMPLES::

Expand All @@ -192,16 +193,16 @@
z_elt = {}
for mx, cx in self:
for my, cy in y:
key = mx*my
key = mx * my
if key in z_elt:
z_elt[key] += cx*cy
z_elt[key] += cx * cy
else:
z_elt[key] = cx*cy
z_elt[key] = cx * cy
if not z_elt[key]:
del z_elt[key]
return A._from_dict(z_elt)

def is_unit(self):
def is_unit(self) -> bool:
r"""
Return ``True`` if ``self`` is invertible.

Expand Down Expand Up @@ -274,10 +275,6 @@
return scalar * Factorization([(self, 1)])
return super()._acted_upon_(scalar, self_on_left)

# For backward compatibility
# _lmul_ = _acted_upon_
# _rmul_ = _acted_upon_

def _im_gens_(self, codomain, im_gens, base_map):
"""
Apply a morphism defined by its values on the generators.
Expand All @@ -304,7 +301,7 @@
return codomain.sum(base_map(c) * m(*im_gens)
for m, c in self._monomial_coefficients.items())

def variables(self):
def variables(self) -> list:
"""
Return the variables used in ``self``.

Expand Down
6 changes: 3 additions & 3 deletions src/sage/algebras/fusion_rings/fusion_double.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def s_ijconj(self, i, j, unitary=False, base_coercion=True):

EXAMPLES::

sage: P=FusionDouble(CyclicPermutationGroup(3),prefix='p',inject_variables=True)
sage: P = FusionDouble(CyclicPermutationGroup(3),prefix='p',inject_variables=True)
sage: P.s_ij(p1,p3)
zeta3
sage: P.s_ijconj(p1,p3)
Expand Down Expand Up @@ -695,7 +695,7 @@ def product_on_basis(self, a, b):

EXAMPLES::

sage: Q=FusionDouble(SymmetricGroup(3),prefix='q',inject_variables=True)
sage: Q = FusionDouble(SymmetricGroup(3),prefix='q',inject_variables=True)
sage: q3*q4
q1 + q2 + q5 + q6 + q7
sage: Q._names
Expand Down Expand Up @@ -820,7 +820,7 @@ def twist(self, reduced=True):

EXAMPLES::

sage: Q=FusionDouble(CyclicPermutationGroup(3))
sage: Q = FusionDouble(CyclicPermutationGroup(3))
sage: [x.twist() for x in Q.basis()]
[0, 0, 0, 0, 2/3, 4/3, 0, 4/3, 2/3]
sage: [x.ribbon() for x in Q.basis()]
Expand Down
62 changes: 31 additions & 31 deletions src/sage/algebras/iwahori_hecke_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):

sage: R.<q> = LaurentPolynomialRing(ZZ)
sage: H = IwahoriHeckeAlgebra('A3', q^2)
sage: T=H.T(); Cp=H.Cp(); C=H.C()
sage: T = H.T(); Cp = H.Cp(); C = H.C()
sage: C(T[1])
q*C[1] + q^2
sage: elt = Cp(T[1,2,1]); elt
Expand All @@ -245,7 +245,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):

sage: R.<q> = LaurentPolynomialRing(ZZ)
sage: H = IwahoriHeckeAlgebra('A3', q, -q^-1)
sage: T=H.T(); Cp=H.Cp(); C=H.C()
sage: T = H.T(); Cp = H.Cp(); C = H.C()
sage: C(T[1])
C[1] + q
sage: elt = Cp(T[1,2,1]); elt
Expand All @@ -256,7 +256,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):
In the group algebra, so that `(T_r-1)(T_r+1) = 0`::

sage: H = IwahoriHeckeAlgebra('A3', 1)
sage: T=H.T(); Cp=H.Cp(); C=H.C()
sage: T = H.T(); Cp = H.Cp(); C = H.C()
sage: C(T[1])
C[1] + 1
sage: Cp(T[1,2,1])
Expand All @@ -270,7 +270,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):

sage: R.<q>=LaurentPolynomialRing(ZZ)
sage: H = IwahoriHeckeAlgebra('A3', q)
sage: C=H.C()
sage: C = H.C()
Traceback (most recent call last):
...
ValueError: the Kazhdan-Lusztig bases are defined only when -q_1*q_2 is a square
Expand All @@ -279,7 +279,7 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation):

sage: R.<v> = LaurentPolynomialRing(ZZ)
sage: H = IwahoriHeckeAlgebra(['A',2,1], v^2)
sage: T=H.T(); Cp=H.Cp(); C=H.C()
sage: T = H.T(); Cp = H.Cp(); C = H.C()
sage: C(T[1,0,2])
v^3*C[1,0,2] + v^4*C[1,0] + v^4*C[0,2] + v^4*C[1,2]
+ v^5*C[0] + v^5*C[2] + v^5*C[1] + v^6
Expand Down Expand Up @@ -1621,8 +1621,8 @@ def hash_involution_on_basis(self, w):

sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
sage: H = IwahoriHeckeAlgebra('A3', v**2)
sage: T=H.T()
sage: s=H.coxeter_group().simple_reflection(1)
sage: T = H.T()
sage: s = H.coxeter_group().simple_reflection(1)
sage: T.hash_involution_on_basis(s)
-(v^-2)*T[1]
sage: T[s].hash_involution()
Expand Down Expand Up @@ -1661,8 +1661,8 @@ def goldman_involution_on_basis(self, w):

sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
sage: H = IwahoriHeckeAlgebra('A3', v**2)
sage: T=H.T()
sage: s=H.coxeter_group().simple_reflection(1)
sage: T = H.T()
sage: s = H.coxeter_group().simple_reflection(1)
sage: T.goldman_involution_on_basis(s)
-T[1] - (1-v^2)
sage: T[s].goldman_involution()
Expand Down Expand Up @@ -1836,8 +1836,8 @@ def to_T_basis(self, w):

EXAMPLES::

sage: H=IwahoriHeckeAlgebra("A3",1); Cp=H.Cp(); C=H.C()
sage: s=H.coxeter_group().simple_reflection(1)
sage: H = IwahoriHeckeAlgebra("A3",1); Cp = H.Cp(); C = H.C()
sage: s = H.coxeter_group().simple_reflection(1)
sage: C.to_T_basis(s)
T[1] - 1
sage: Cp.to_T_basis(s)
Expand Down Expand Up @@ -2032,8 +2032,8 @@ def hash_involution_on_basis(self, w):

sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
sage: H = IwahoriHeckeAlgebra('A3', v**2)
sage: Cp=H.Cp()
sage: s=H.coxeter_group().simple_reflection(1)
sage: Cp = H.Cp()
sage: s = H.coxeter_group().simple_reflection(1)
sage: Cp.hash_involution_on_basis(s)
-Cp[1] + (v^-1+v)
sage: Cp[s].hash_involution()
Expand Down Expand Up @@ -2130,7 +2130,7 @@ def product_on_basis(self, w1, w2):
sage: # optional - coxeter3
sage: R.<v> = LaurentPolynomialRing(ZZ, 'v')
sage: W = CoxeterGroup('A3', implementation='coxeter3')
sage: H = IwahoriHeckeAlgebra(W, v**2); Cp=H.Cp()
sage: H = IwahoriHeckeAlgebra(W, v**2); Cp = H.Cp()
sage: Cp.product_on_basis(W([1,2,1]), W([3,1]))
(v^-1+v)*Cp[1,2,1,3]
sage: Cp.product_on_basis(W([1,2,1]), W([3,1,2]))
Expand Down Expand Up @@ -2267,7 +2267,7 @@ def _decompose_into_generators(self, u):

sage: R.<v> = LaurentPolynomialRing(ZZ, 'v') # optional - coxeter3
sage: W = CoxeterGroup('A3', implementation='coxeter3') # optional - coxeter3
sage: H = IwahoriHeckeAlgebra(W, v**2); Cp=H.Cp() # optional - coxeter3
sage: H = IwahoriHeckeAlgebra(W, v**2); Cp = H.Cp() # optional - coxeter3

When `u` is itself a generator `s`, the decomposition is trivial::

Expand Down Expand Up @@ -2440,8 +2440,8 @@ def hash_involution_on_basis(self, w):

sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
sage: H = IwahoriHeckeAlgebra('A3', v**2)
sage: C=H.C()
sage: s=H.coxeter_group().simple_reflection(1)
sage: C = H.C()
sage: s = H.coxeter_group().simple_reflection(1)
sage: C.hash_involution_on_basis(s)
-C[1] - (v^-1+v)
sage: C[s].hash_involution()
Expand Down Expand Up @@ -2473,7 +2473,7 @@ class A(_Basis):

sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
sage: H = IwahoriHeckeAlgebra('A3', v**2)
sage: A=H.A(); T=H.T()
sage: A = H.A(); T = H.T()
sage: T(A[1])
T[1] + (1/2-1/2*v^2)
sage: T(A[1,2])
Expand Down Expand Up @@ -2526,8 +2526,8 @@ def to_T_basis(self, w):
EXAMPLES::

sage: R.<v> = LaurentPolynomialRing(QQ)
sage: H = IwahoriHeckeAlgebra('A3', v**2); A=H.A(); T=H.T()
sage: s=H.coxeter_group().simple_reflection(1)
sage: H = IwahoriHeckeAlgebra('A3', v**2); A = H.A(); T = H.T()
sage: s = H.coxeter_group().simple_reflection(1)
sage: A.to_T_basis(s)
T[1] + (1/2-1/2*v^2)
sage: T(A[1,2])
Expand All @@ -2550,8 +2550,8 @@ def goldman_involution_on_basis(self, w):

sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
sage: H = IwahoriHeckeAlgebra('A3', v**2)
sage: A=H.A()
sage: s=H.coxeter_group().simple_reflection(1)
sage: A = H.A()
sage: s = H.coxeter_group().simple_reflection(1)
sage: A.goldman_involution_on_basis(s)
-A[1]
sage: A[1,2].goldman_involution()
Expand Down Expand Up @@ -2593,7 +2593,7 @@ class B(_Basis):

sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
sage: H = IwahoriHeckeAlgebra('A3', v**2)
sage: A=H.A(); T=H.T(); Cp=H.Cp()
sage: A = H.A(); T = H.T(); Cp = H.Cp()
sage: T(A[1])
T[1] + (1/2-1/2*v^2)
sage: T(A[1,2])
Expand Down Expand Up @@ -2659,8 +2659,8 @@ def to_T_basis(self, w):
EXAMPLES::

sage: R.<v> = LaurentPolynomialRing(QQ)
sage: H = IwahoriHeckeAlgebra('A3', v**2); B=H.B(); T=H.T()
sage: s=H.coxeter_group().simple_reflection(1)
sage: H = IwahoriHeckeAlgebra('A3', v**2); B = H.B(); T = H.T()
sage: s = H.coxeter_group().simple_reflection(1)
sage: B.to_T_basis(s)
T[1] + (1/2-1/2*v^2)
sage: T(B[1,2])
Expand All @@ -2687,8 +2687,8 @@ def goldman_involution_on_basis(self, w):

sage: R.<v> = LaurentPolynomialRing(QQ, 'v')
sage: H = IwahoriHeckeAlgebra('A3', v**2)
sage: B=H.B()
sage: s=H.coxeter_group().simple_reflection(1)
sage: B = H.B()
sage: s = H.coxeter_group().simple_reflection(1)
sage: B.goldman_involution_on_basis(s)
-B[1]
sage: B[1,2].goldman_involution()
Expand Down Expand Up @@ -2822,8 +2822,8 @@ def _bar_on_coefficients(self, c):
EXAMPLES::

sage: R.<q>=LaurentPolynomialRing(ZZ)
sage: H=IwahoriHeckeAlgebra("A3",q^2)
sage: GH=H._generic_iwahori_hecke_algebra
sage: H = IwahoriHeckeAlgebra("A3",q^2)
sage: GH = H._generic_iwahori_hecke_algebra
sage: GH._bar_on_coefficients(GH.u_inv)
u
sage: GH._bar_on_coefficients(GH.v_inv)
Expand Down Expand Up @@ -2871,8 +2871,8 @@ def specialize_to(self, new_hecke):
EXAMPLES::

sage: R.<a,b>=LaurentPolynomialRing(ZZ,2)
sage: H=IwahoriHeckeAlgebra("A3",a^2,-b^2)
sage: GH=H._generic_iwahori_hecke_algebra
sage: H = IwahoriHeckeAlgebra("A3",a^2,-b^2)
sage: GH = H._generic_iwahori_hecke_algebra
sage: GH.T()(GH.C()[1])
(v^-1)*T[1] + (-u*v^-1)
sage: ( GH.T()(GH.C()[1]) ).specialize_to(H)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/steenrod/steenrod_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2966,7 +2966,7 @@ def top_class(self):

TESTS::

sage: A=SteenrodAlgebra(2, profile=(3,2,1), basis='pst')
sage: A = SteenrodAlgebra(2, profile=(3,2,1), basis='pst')
sage: A.top_class().parent() is A
True
"""
Expand Down
Loading