Skip to content

Commit d332d95

Browse files
committed
details in braid groups
1 parent dc99dc8 commit d332d95

File tree

1 file changed

+58
-45
lines changed

1 file changed

+58
-45
lines changed

src/sage/groups/braid.py

Lines changed: 58 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
Braid groups are implemented as a particular case of finitely presented groups,
55
but with a lot of specific methods for braids.
66
7-
A braid group can be created by giving the number of strands, and the name of the generators::
7+
A braid group can be created by giving the number of strands, and the name
8+
of the generators::
89
910
sage: BraidGroup(3)
1011
Braid group on 3 strands
@@ -15,8 +16,8 @@
1516
sage: BraidGroup(3,'a,b').gens()
1617
(a, b)
1718
18-
The elements can be created by operating with the generators, or by passing a list
19-
with the indices of the letters to the group::
19+
The elements can be created by operating with the generators, or by passing
20+
a list with the indices of the letters to the group::
2021
2122
sage: B.<s0,s1,s2> = BraidGroup(4)
2223
sage: s0*s1*s0
@@ -81,7 +82,8 @@
8182
GroupMorphismWithGensImages,
8283
)
8384
from sage.groups.free_group import FreeGroup, is_FreeGroup
84-
from sage.groups.perm_gps.permgroup_named import SymmetricGroup, SymmetricGroupElement
85+
from sage.groups.perm_gps.permgroup_named import (SymmetricGroup,
86+
SymmetricGroupElement)
8587
from sage.libs.gap.libgap import libgap
8688
from sage.matrix.constructor import identity_matrix, matrix
8789
from sage.misc.cachefunc import cached_method
@@ -96,10 +98,11 @@
9698
from sage.structure.richcmp import rich_to_bool, richcmp
9799

98100
lazy_import('sage.libs.braiding',
99-
['leftnormalform', 'rightnormalform', 'centralizer', 'supersummitset', 'greatestcommondivisor',
101+
['leftnormalform', 'rightnormalform', 'centralizer',
102+
'supersummitset', 'greatestcommondivisor',
100103
'leastcommonmultiple', 'conjugatingbraid', 'ultrasummitset',
101104
'thurston_type', 'rigidity', 'sliding_circuits', 'send_to_sss',
102-
'send_to_uss', 'send_to_sc', 'trajectory', 'cyclic_slidings' ],
105+
'send_to_uss', 'send_to_sc', 'trajectory', 'cyclic_slidings'],
103106
feature=sage__libs__braiding())
104107
lazy_import('sage.knots.knot', 'Knot')
105108

@@ -466,7 +469,8 @@ def permutation(self, W=None):
466469
"""
467470
return self.coxeter_group_element(W)
468471

469-
def plot(self, color='rainbow', orientation='bottom-top', gap=0.05, aspect_ratio=1, axes=False, **kwds):
472+
def plot(self, color='rainbow', orientation='bottom-top', gap=0.05,
473+
aspect_ratio=1, axes=False, **kwds):
470474
"""
471475
Plot the braid.
472476
@@ -598,7 +602,7 @@ def plot(self, color='rainbow', orientation='bottom-top', gap=0.05, aspect_ratio
598602

599603
def plot3d(self, color='rainbow'):
600604
"""
601-
Plots the braid in 3d.
605+
Plot the braid in 3d.
602606
603607
The following option is available:
604608
@@ -796,6 +800,7 @@ def links_gould_matrix(self, symbolics=False):
796800
r"""
797801
Return the representation matrix of ``self`` according to the R-matrix
798802
representation being attached to the quantum superalgebra `\mathfrak{sl}_q(2|1)`.
803+
799804
See [MW2012]_, section 3 and references given there.
800805
801806
INPUT:
@@ -827,15 +832,16 @@ def links_gould_matrix(self, symbolics=False):
827832
M = rep[0][0].parent().one()
828833
for i in self.Tietze():
829834
if i > 0:
830-
M = M*rep[i-1][0]
835+
M = M * rep[i-1][0]
831836
if i < 0:
832-
M = M*rep[-i-1][1]
837+
M = M * rep[-i-1][1]
833838
return M
834839

835840
@cached_method
836841
def links_gould_polynomial(self, varnames=None, use_symbolics=False):
837842
r"""
838843
Return the Links-Gould polynomial of the closure of ``self``.
844+
839845
See [MW2012]_, section 3 and references given there.
840846
841847
INPUT:
@@ -872,12 +878,13 @@ def links_gould_polynomial(self, varnames=None, use_symbolics=False):
872878
mu = rep[ln - 1] # quantum trace factor
873879
M = mu * self.links_gould_matrix(symbolics=use_symbolics)
874880
d1, d2 = M.dimensions()
875-
e = d1//4
881+
e = d1 // 4
876882
B = M.base_ring()
877883
R = LaurentPolynomialRing(ZZ, varnames)
878884

879885
# partial quantum trace according to I. Marin section 2.5
880-
part_trace = matrix(B, 4, 4, lambda i, j: sum(M[e * i + k, e * j + k] for k in range(e)))
886+
part_trace = matrix(B, 4, 4, lambda i, j: sum(M[e * i + k, e * j + k]
887+
for k in range(e)))
881888
ptemp = part_trace[0, 0] # part_trace == psymb*M.parent().one()
882889
if use_symbolics:
883890
v1, v2 = R.variable_names()
@@ -888,13 +895,13 @@ def links_gould_polynomial(self, varnames=None, use_symbolics=False):
888895
else:
889896
ltemp = ptemp.lift().constant_coefficient()
890897
# Since the result of the calculation is known to be a Laurent polynomial
891-
# in t0 and t1 all exponents of ltemp must be divisable by 2
898+
# in t0 and t1 all exponents of ltemp must be divisible by 2
892899
L = ltemp.parent()
893900
lred = L({(k[0]/2, k[1]/2): v for k, v in ltemp.monomial_coefficients().items()})
894901
t0, t1 = R.gens()
895902
return lred(t0, t1)
896903

897-
def tropical_coordinates(self):
904+
def tropical_coordinates(self) -> list:
898905
r"""
899906
Return the tropical coordinates of ``self`` in the braid group `B_n`.
900907
@@ -938,7 +945,7 @@ def tropical_coordinates(self):
938945

939946
from sage.rings.semirings.tropical_semiring import TropicalSemiring
940947
T = TropicalSemiring(ZZ)
941-
return [T(_) for _ in coord]
948+
return [T(c) for c in coord]
942949

943950
def markov_trace(self, variab=None, normalized=True):
944951
r"""
@@ -1606,7 +1613,7 @@ def right_normal_form(self):
16061613
B = self.parent()
16071614
return tuple([B(b) for b in rnf[:-1]] + [B.delta()**rnf[-1][0]])
16081615

1609-
def centralizer(self):
1616+
def centralizer(self) -> list:
16101617
"""
16111618
Return a list of generators of the centralizer of the braid.
16121619
@@ -1621,7 +1628,7 @@ def centralizer(self):
16211628
B = self.parent()
16221629
return [B._element_from_libbraiding(b) for b in c]
16231630

1624-
def super_summit_set(self):
1631+
def super_summit_set(self) -> list:
16251632
"""
16261633
Return a list with the super summit set of the braid.
16271634
@@ -1739,10 +1746,9 @@ def conjugating_braid(self, other):
17391746
cb = conjugatingbraid(self, other)
17401747
if not cb:
17411748
return None
1742-
else:
1743-
B = self.parent()
1744-
cb[0][0] %= 2
1745-
return B._element_from_libbraiding(cb)
1749+
B = self.parent()
1750+
cb[0][0] %= 2
1751+
return B._element_from_libbraiding(cb)
17461752

17471753
def is_conjugated(self, other) -> bool:
17481754
"""
@@ -1859,7 +1865,7 @@ def pure_conjugating_braid(self, other):
18591865
n2 = len(b2.Tietze())
18601866
return b2 if n2 <= n0 else b0
18611867

1862-
def ultra_summit_set(self):
1868+
def ultra_summit_set(self) -> list:
18631869
"""
18641870
Return a list with the orbits of the ultra summit set of ``self``.
18651871
@@ -1888,7 +1894,7 @@ def ultra_summit_set(self):
18881894
B = self.parent()
18891895
return [[B._element_from_libbraiding(i) for i in s] for s in uss]
18901896

1891-
def thurston_type(self):
1897+
def thurston_type(self) -> str:
18921898
"""
18931899
Return the thurston_type of ``self``.
18941900
@@ -1973,7 +1979,7 @@ def rigidity(self):
19731979
"""
19741980
return Integer(rigidity(self))
19751981

1976-
def sliding_circuits(self):
1982+
def sliding_circuits(self) -> list:
19771983
"""
19781984
Return the sliding circuits of the braid.
19791985
@@ -2270,7 +2276,7 @@ def ultra_summit_set_element(self):
22702276
B = self.parent()
22712277
return tuple([B._element_from_libbraiding(b) for b in to_uss])
22722278

2273-
def sliding_circuits_element(self):
2279+
def sliding_circuits_element(self) -> tuple:
22742280
r"""
22752281
Return an element of the braid's sliding circuits, and the conjugating
22762282
braid.
@@ -2286,7 +2292,7 @@ def sliding_circuits_element(self):
22862292
B = self.parent()
22872293
return tuple([B._element_from_libbraiding(b) for b in to_sc])
22882294

2289-
def trajectory(self):
2295+
def trajectory(self) -> list:
22902296
r"""
22912297
Return the braid's trajectory.
22922298
@@ -2304,7 +2310,7 @@ def trajectory(self):
23042310
B = self.parent()
23052311
return [B._element_from_libbraiding(b) for b in traj]
23062312

2307-
def cyclic_slidings(self):
2313+
def cyclic_slidings(self) -> list:
23082314
r"""
23092315
Return the braid's cyclic slidings.
23102316
@@ -2484,6 +2490,7 @@ def reduced_word(self):
24842490
def tuple_to_word(q_tuple):
24852491
return M.prod(self._gens[i]**exp
24862492
for i, exp in enumerate(q_tuple))
2493+
24872494
ret = {tuple_to_word(q_tuple): q_factor
24882495
for q_tuple, q_factor in self.tuples.items() if q_factor}
24892496
return self._algebra._from_dict(ret, remove_zeros=False)
@@ -2546,7 +2553,7 @@ def eps_monom(q_tuple):
25462553
return sum(q_factor * eps_monom(q_tuple)
25472554
for q_tuple, q_factor in self.tuples.items())
25482555

2549-
def __repr__(self):
2556+
def __repr__(self) -> str:
25502557
r"""
25512558
String representation of ``self``.
25522559
@@ -2582,7 +2589,7 @@ class BraidGroup_class(FiniteTypeArtinGroup):
25822589
"""
25832590
Element = Braid
25842591

2585-
def __init__(self, names):
2592+
def __init__(self, names) -> None:
25862593
"""
25872594
Python constructor.
25882595
@@ -2657,7 +2664,7 @@ def __init__(self, names):
26572664
# For caching hermitian form of unitary Burau representation
26582665
self._hermitian_form = None
26592666

2660-
def __reduce__(self):
2667+
def __reduce__(self) -> tuple:
26612668
"""
26622669
TESTS::
26632670
@@ -2670,7 +2677,7 @@ def __reduce__(self):
26702677
"""
26712678
return (BraidGroup_class, (self.variable_names(), ))
26722679

2673-
def _repr_(self):
2680+
def _repr_(self) -> str:
26742681
"""
26752682
Return a string representation.
26762683
@@ -2761,7 +2768,7 @@ def an_element(self):
27612768
"""
27622769
return self.gen(0)
27632770

2764-
def some_elements(self):
2771+
def some_elements(self) -> list:
27652772
"""
27662773
Return a list of some elements of the braid group.
27672774
@@ -2778,7 +2785,7 @@ def some_elements(self):
27782785
elements_list.append(elements_list[-1]**self.strands())
27792786
return elements_list
27802787

2781-
def _standard_lift_Tietze(self, p):
2788+
def _standard_lift_Tietze(self, p) -> tuple:
27822789
"""
27832790
Helper for :meth:`_standard_lift_Tietze`.
27842791
@@ -2806,8 +2813,7 @@ def _standard_lift_Tietze(self, p):
28062813
(1, 2, 3, 4, 1, 2)
28072814
"""
28082815
G = SymmetricGroup(self.strands())
2809-
pl = G(p)
2810-
return tuple(pl.reduced_word())
2816+
return tuple(G(p).reduced_word())
28112817

28122818
@cached_method
28132819
def _links_gould_representation(self, symbolics=False):
@@ -2853,8 +2859,9 @@ def _links_gould_representation(self, symbolics=False):
28532859
else:
28542860
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
28552861
LR = LaurentPolynomialRing(ZZ, 's0r, s1r')
2862+
s0r, s1r = LR.gens()
28562863
PR = PolynomialRing(LR, 'Yr')
2857-
s0r, s1r, Yr = PR.gens_dict_recursive().values()
2864+
Yr = PR.gens()
28582865
pqr = Yr**2 + (s0r**2 - 1) * (s1r**2 - 1)
28592866
BR = PR.quotient_ring(pqr)
28602867
s0 = BR(s0r)
@@ -3419,9 +3426,10 @@ def mirror_involution(self):
34193426
r"""
34203427
Return the mirror involution of ``self``.
34213428
3422-
This automorphism maps a braid to another one by replacing each generator
3423-
in its word by the inverse. In general this is different from the inverse
3424-
of the braid since the order of the generators in the word is not reversed.
3429+
This automorphism maps a braid to another one by replacing
3430+
each generator in its word by the inverse. In general this is
3431+
different from the inverse of the braid since the order of the
3432+
generators in the word is not reversed.
34253433
34263434
EXAMPLES::
34273435
@@ -3485,7 +3493,7 @@ def presentation_two_generators(self, isomorphisms=False):
34853493
h2 = G.hom(codomain=self, im_gens=[self(a) for a in L2], check=False)
34863494
return (G, h1, h2)
34873495

3488-
def epimorphisms(self, H):
3496+
def epimorphisms(self, H) -> list:
34893497
r"""
34903498
Return the epimorphisms from ``self`` to ``H``, up to automorphism of `H` passing
34913499
through the :meth:`two generator presentation
@@ -3518,12 +3526,15 @@ def epimorphisms(self, H):
35183526
Gg = libgap(G)
35193527
Hg = libgap(H)
35203528
gquotients = Gg.GQuotients(Hg)
3521-
hom1g = libgap.GroupHomomorphismByImagesNC(G0g, Gg, [libgap(hom1(u)) for u in self.gens()])
3529+
hom1g = libgap.GroupHomomorphismByImagesNC(G0g, Gg,
3530+
[libgap(hom1(u))
3531+
for u in self.gens()])
35223532
g0quotients = [hom1g * h for h in gquotients]
35233533
res = []
35243534
# the following closure is needed to attach a specific value of quo to
35253535
# each function in the different morphisms
3526-
fmap = lambda tup: (lambda a: H(prod(tup[abs(i)-1]**sign(i) for i in a.Tietze())))
3536+
fmap = lambda tup: (lambda a: H(prod(tup[abs(i)-1]**sign(i)
3537+
for i in a.Tietze())))
35273538
for quo in g0quotients:
35283539
tup = tuple(H(quo.ImageElm(i.gap()).sage()) for i in self.gens())
35293540
fhom = GroupMorphismWithGensImages(HomSpace, fmap(tup))
@@ -3651,22 +3662,24 @@ class group of the punctured disk.
36513662
36523663
sage: A = B.mapping_class_action(F)
36533664
sage: A
3654-
Right action by Braid group on 4 strands on Free Group on generators {x0, x1, x2, x3}
3665+
Right action by Braid group on 4 strands on Free Group
3666+
on generators {x0, x1, x2, x3}
36553667
sage: A(x0, s1)
36563668
x0
36573669
sage: A(x1, s1)
36583670
x1*x2*x1^-1
36593671
sage: A(x1^-1, s1)
36603672
x1*x2^-1*x1^-1
36613673
"""
3662-
def __init__(self, G, M):
3674+
def __init__(self, G, M) -> None:
36633675
"""
36643676
TESTS::
36653677
36663678
sage: B = BraidGroup(3)
36673679
sage: G = FreeGroup('a, b, c')
36683680
sage: B.mapping_class_action(G) # indirect doctest
3669-
Right action by Braid group on 3 strands on Free Group on generators {a, b, c}
3681+
Right action by Braid group on 3 strands on Free Group
3682+
on generators {a, b, c}
36703683
"""
36713684
import operator
36723685
Action.__init__(self, G, M, False, operator.mul)

0 commit comments

Comments
 (0)