Skip to content
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

More fixes for e221 #36654

Merged
merged 2 commits into from
Dec 6, 2023
Merged
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
66 changes: 33 additions & 33 deletions src/sage/groups/cubic_braid.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def eliminate_item(tietze_list):
if second is None:
return None
middle = tietze_list[1:i]
end = tietze_list[i+1:l]
end = tietze_list[i+1:l]
if first == second:
return [-first] + middle + end
else:
Expand Down Expand Up @@ -490,7 +490,7 @@ def find_root(domain):
if root[0] == 0:
continue
root_bur = root[0]
if root[1] == 1:
if root[1] == 1:
break
return root_bur

Expand Down Expand Up @@ -747,7 +747,7 @@ def __init__(self, names, cbg_type=None):
sage: U5 = AssionGroupU(5) # indirect doctest
sage: TestSuite(U5).run() # long time
"""
n = Integer(len(names))
n = Integer(len(names))
if n < 1:
raise ValueError("the number of strands must be an integer larger than one")

Expand All @@ -759,12 +759,12 @@ def __init__(self, names, cbg_type=None):
free_group = FreeGroup(names)
self._cbg_type = cbg_type
self._nstrands = n + 1
self._ident = self._cbg_type.value + self._nstrands.str()
self._ident = self._cbg_type.value + self._nstrands.str()
self._braid_group = BraidGroup(names)

# internal naming of elements for convenience
b = [free_group([i]) for i in range(1, n+1)]
t = [free_group([i, i+1]) ** 3 for i in range(1, n)]
b = [free_group([i]) for i in range(1, n+1)]
t = [free_group([i, i+1]) ** 3 for i in range(1, n)]
ti = [free_group([-i, -i-1]) ** 3 for i in range(1, n)]

# first the braid relation
Expand Down Expand Up @@ -796,12 +796,12 @@ def __init__(self, names, cbg_type=None):
# the following global pointers to classical group realizations will be set in the private method
# _create_classical_realization
# ------------------------------------------------------------------------------------------------
self._classical_group = None # This is the classical Group returned by as_classical_group
self._classical_base_group = None # this only differs for special cases for Assion groups from the former
self._classical_invariant_form = None # invariant form of the classical base group
self._classical_embedding = None # if self._classical_group different from self._classical_base_group
self._centralizing_matrix = None # for Assion groups: element in classical base group commuting with self
self._centralizing_element = None # image under nat. map of the former one in the proj. classical group
self._classical_group = None # This is the classical Group returned by as_classical_group
self._classical_base_group = None # this only differs for special cases for Assion groups from the former
self._classical_invariant_form = None # invariant form of the classical base group
self._classical_embedding = None # if self._classical_group different from self._classical_base_group
self._centralizing_matrix = None # for Assion groups: element in classical base group commuting with self
self._centralizing_element = None # image under nat. map of the former one in the proj. classical group
return

def _repr_(self):
Expand Down Expand Up @@ -1095,7 +1095,7 @@ def set_classical_realization(self, base_group, proj_group, centralizing_matrix,
# ------------------------------------------------------------------------------
# Setting the List of Braid Images
# ------------------------------------------------------------------------------
im_gens = [base_group(m) for m in transvec_matrices]
im_gens = [base_group(m) for m in transvec_matrices]

# ------------------------------------------------------------------------------
# By the work of Assion no check on the group homomorphism is needed, at all.
Expand All @@ -1109,7 +1109,7 @@ def set_classical_realization(self, base_group, proj_group, centralizing_matrix,
# ------------------------------------------------------------------------------
# Do the projective group realization if needed
# ------------------------------------------------------------------------------
embedding = self._classical_embedding
embedding = self._classical_embedding
classical_group = None
if proj_group is None:
classical_group = base_group
Expand All @@ -1128,19 +1128,19 @@ def set_classical_realization(self, base_group, proj_group, centralizing_matrix,
nat_hom = base_group.hom(proj_group.gens(), check=check)
centralizing_element = nat_hom(centralizing_matrix)
classical_group_gens = [nat_hom(m) for m in transvec_matrices]
classical_group = proj_group.subgroup(classical_group_gens, canonicalize=False)
classical_group = proj_group.subgroup(classical_group_gens, canonicalize=False)
hom_to_classic = self.hom(classical_group.gens(), check=check)
classical_group.register_conversion(hom_to_classic)

# ------------------------------------------------------------------------------
# register constructed items
# ------------------------------------------------------------------------------
self._classical_group = classical_group
self._classical_base_group = base_group
self._classical_invariant_form = base_group.invariant_form()
self._centralizing_matrix = centralizing_matrix
self._centralizing_element = centralizing_element
self._classical_embedding = embedding
self._classical_group = classical_group
self._classical_base_group = base_group
self._classical_invariant_form = base_group.invariant_form()
self._centralizing_matrix = centralizing_matrix
self._centralizing_element = centralizing_element
self._classical_embedding = embedding
return

# -------------------------------------------------------------------------------
Expand Down Expand Up @@ -1211,7 +1211,7 @@ def transvec2mat(v, bas=bas, bform=bform, fact=1):
# ------------------------------------------------------------------------------
centralizing_vector = xbas[mhalf-1]
centralizing_matrix = base_group(transvec2mat(centralizing_vector, fact=1))
transvec_matrices = [transvec2mat(v) for v in transvections]
transvec_matrices = [transvec2mat(v) for v in transvections]

set_classical_realization(self, base_group, proj_group, centralizing_matrix, transvec_matrices)
return
Expand Down Expand Up @@ -1273,9 +1273,9 @@ def create_unitary_realization(self, m):
for j in range(mthird):
pos = 3*(j+1)-1
transvections.append(xbas[pos-1]) # t_{3i} = x_{3i-1}
if pos + 1 < m:
if pos + 1 < m:
transvections.append(xbas[pos-1]+xbas[pos]+xbas[pos+1]) # t_{3i+1} = x_{3i-1} + x_{3i} + x_{3i+1}
if pos + 3 < m:
if pos + 3 < m:
transvections.append(xbas[pos+1]+xbas[pos+2]+xbas[pos+3]) # t_{3i+2} = x_{3i+1} + x_{3i+2} + x_{3i+3}

# -----------------------------------------------------------
Expand All @@ -1294,7 +1294,7 @@ def transvec2mat(v, bas=bas, bform=bform, fact=a):
# ------------------------------------------------------------------------------
centralizing_vector = xbas[m-2]+xbas[m-1]
centralizing_matrix = base_group(transvec2mat(centralizing_vector, fact=1))
transvec_matrices = [transvec2mat(v) for v in transvections]
transvec_matrices = [transvec2mat(v) for v in transvections]

set_classical_realization(self, base_group, proj_group, centralizing_matrix, transvec_matrices)
return
Expand All @@ -1314,13 +1314,13 @@ def transvec2mat(v, bas=bas, bform=bform, fact=a):
# Setting the Classical group
# -------------------------------------------------------------------------------
if self._cbg_type == CubicBraidGroup.type.AssionS:
dim_sympl_group = n-1 # S(n-1) = Sp(n-1, 3)
if n % 2 == 0:
dim_sympl_group = n # S(n-1) = subgroup of PSp(n, 3)
dim_sympl_group = n-1 # S(n-1) = Sp(n-1, 3)
if n % 2 == 0:
dim_sympl_group = n # S(n-1) = subgroup of PSp(n, 3)
create_sympl_realization(self, dim_sympl_group)
elif self._cbg_type == CubicBraidGroup.type.AssionU:
dim_unitary_group = n-1 # U(n-1) = GU(n-1, 2)
if n % 3 == 0:
if n % 3 == 0:
dim_unitary_group = n # U(n-1) = subgroup PGU(n, 3)
create_unitary_realization(self, dim_unitary_group)
else:
Expand All @@ -1344,11 +1344,11 @@ def transvec2mat(v, bas=bas, bform=bform, fact=a):
UCF = UniversalCyclotomicField()
z12 = UCF.gen(12)
classical_group = self.as_matrix_group(root_bur=~z12, domain=UCF, reduced='unitary')
self._classical_group = classical_group
self._classical_base_group = classical_group
self._classical_embedding = classical_group
self._classical_group = classical_group
self._classical_base_group = classical_group
self._classical_embedding = classical_group
if self._classical_invariant_form is None:
self._classical_invariant_form = classical_group.ambient().invariant_form()
self._classical_invariant_form = classical_group.ambient().invariant_form()
return

def _element_constructor_(self, x, **kwds):
Expand Down
6 changes: 3 additions & 3 deletions src/sage/misc/superseded.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,10 @@ def __init__(self, issue_number, func, module, instance=None, unbound=None):
try:
self.__dict__.update(func.__dict__)
except AttributeError:
pass # Cython classes don't have __dict__
pass # Cython classes don't have __dict__
self.func = func
self.issue_number = issue_number
self.instance = instance # for use with methods
self.issue_number = issue_number
self.instance = instance # for use with methods
self.unbound = unbound
self.__module__ = module
if isinstance(func, type(deprecation)):
Expand Down
14 changes: 7 additions & 7 deletions src/sage/modules/free_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2443,7 +2443,7 @@ def aux(length, norm, max_):
iters = [iter(R) for _ in range(len(G))]
for x in iters:
next(x) # put at 0
zero = R(0)
zero = R.zero()
v = [zero for _ in range(len(G))]
n = 0
z = self(0)
Expand Down Expand Up @@ -3873,11 +3873,11 @@ def intersection(self, other):
V2 = self
A1 = V1.basis_matrix()
A2 = V2.basis_matrix()
S = A1.stack(A2)
K = S.integer_kernel(self.base_ring()).basis_matrix()
n = int(V1.dimension())
S = A1.stack(A2)
K = S.integer_kernel(self.base_ring()).basis_matrix()
n = int(V1.dimension())
K = K.matrix_from_columns(range(n))
B = K*A1
B = K * A1
return self.span(B)

def __and__(self, other):
Expand Down Expand Up @@ -5201,10 +5201,10 @@ def __quotient_matrices(self, sub):
# Our algorithm is to note that D is determined if we just
# replace both A and S by the submatrix got from their pivot
# columns.
P = A.pivots()
P = A.pivots()
AA = A.matrix_from_columns(P)
SS = S.matrix_from_columns(P)
D = SS * AA**(-1)
D = SS * AA**(-1)

# Compute the image of each basis vector for ``self`` under the
# map "write an element of ``self`` in terms of the basis A" then
Expand Down
4 changes: 2 additions & 2 deletions src/sage/modules/with_basis/morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ def coreduced(self, y):
on_basis = self.on_basis()
assert y in G

result = G.zero()
result = G.zero()
remainder = y

while not remainder.is_zero():
Expand Down Expand Up @@ -1447,7 +1447,7 @@ def __init__(self, domain, diagonal, codomain=None, category=None):
if codomain is None:
raise ValueError("The codomain should be specified")
if not (domain.basis().keys() == codomain.basis().keys() and
domain.base_ring() == codomain.base_ring()):
domain.base_ring() == codomain.base_ring()):
raise ValueError("The domain and codomain should have the same base ring "
"and the same basis indexing")
from collections.abc import Callable
Expand Down
29 changes: 17 additions & 12 deletions src/sage/plot/plot3d/platonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def prep(G, center, size, kwds):
G = G.translate(center)
return G


@rename_keyword(alpha='opacity')
def tetrahedron(center=(0, 0, 0), size=1, **kwds):
"""
Expand Down Expand Up @@ -255,15 +256,16 @@ def tetrahedron(center=(0, 0, 0), size=1, **kwds):
one = RR.one()
sqrt2 = RR(2).sqrt()
sqrt6 = RR(6).sqrt()
point_list = [(0,0,1),
(2*sqrt2/3, 0, -one/3),
( -sqrt2/3, sqrt6/3, -one/3),
( -sqrt2/3, -sqrt6/3, -one/3)]
point_list = [(0, 0, 1),
(2*sqrt2/3, 0, -one/3),
(-sqrt2/3, sqrt6/3, -one/3),
(-sqrt2/3, -sqrt6/3, -one/3)]
face_list = [[0,1,2],[1,3,2],[0,2,3],[0,3,1]]
if 'aspect_ratio' not in kwds:
kwds['aspect_ratio'] = [1, 1, 1]
return index_face_set(face_list, point_list, enclosed=True, center=center, size=size, **kwds)


@rename_keyword(alpha='opacity')
def cube(center=(0, 0, 0), size=1, color=None, frame_thickness=0,
frame_color=None, **kwds):
Expand Down Expand Up @@ -405,6 +407,7 @@ def cube(center=(0, 0, 0), size=1, color=None, frame_thickness=0,
B += frame3d((-0.5,-0.5,-0.5),(0.5,0.5,0.5), thickness=frame_thickness, color=frame_color)
return prep(B, center, size, kwds)


@rename_keyword(alpha='opacity')
def octahedron(center=(0, 0, 0), size=1, **kwds):
r"""
Expand Down Expand Up @@ -440,7 +443,8 @@ def octahedron(center=(0, 0, 0), size=1, **kwds):
kwds['enclosed'] = True
if 'aspect_ratio' not in kwds:
kwds['aspect_ratio'] = [1, 1, 1]
return prep(Box(1,1,1).dual(**kwds), center, size, kwds)
return prep(Box(1, 1, 1).dual(**kwds), center, size, kwds)


@rename_keyword(alpha='opacity')
def dodecahedron(center=(0, 0, 0), size=1, **kwds):
Expand Down Expand Up @@ -514,21 +518,21 @@ def dodecahedron(center=(0, 0, 0), size=1, **kwds):
- Robert Bradshaw, William Stein
"""
RR = RDF
one = RR(1)
one = RR.one()
sqrt3 = RR(3).sqrt()
sqrt5 = RR(5).sqrt()
R3 = RR**3
rot = matrix(RR, [[ -one/2,-sqrt3/2, 0],
[ sqrt3/2, -one/2, 0],
[ 0, 0, 1]])
rot2 = rot*rot
rot = matrix(RR, [[-one / 2, -sqrt3 / 2, 0],
[sqrt3 / 2, -one / 2, 0],
[0, 0, 1]])
rot2 = rot * rot

# The top
Q = R3([0,0,1])
Q = R3([0, 0, 1])
# The first ring
P1 = R3([2*one/3, 0, sqrt5/3])
# The second ring
R1 = R3([sqrt5/3, 1/sqrt3, one/3])
R1 = R3([sqrt5/3, 1/sqrt3, one/3])
R2 = R3([sqrt5/3, -1/sqrt3, one/3])

top = [Q, P1, rot*P1, rot2*P1, R1, rot*R2, rot*R1, rot2*R2, rot2*R1, R2]
Expand All @@ -555,6 +559,7 @@ def dodecahedron(center=(0, 0, 0), size=1, **kwds):
# vertex_spheres += [faces.stickers(['red','yellow','blue','purple','black','orange'], .1, .1)] # [faces]
# return Graphics3dGroup(vertex_spheres)


@rename_keyword(alpha='opacity')
def icosahedron(center=(0, 0, 0), size=1, **kwds):
r"""
Expand Down
Loading
Loading