diff --git a/src/sage/groups/cubic_braid.py b/src/sage/groups/cubic_braid.py index e8cb4a4e19f..debecbc0ba1 100644 --- a/src/sage/groups/cubic_braid.py +++ b/src/sage/groups/cubic_braid.py @@ -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: @@ -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 @@ -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") @@ -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 @@ -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): @@ -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. @@ -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 @@ -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 # ------------------------------------------------------------------------------- @@ -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 @@ -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} # ----------------------------------------------------------- @@ -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 @@ -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: @@ -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): diff --git a/src/sage/misc/superseded.py b/src/sage/misc/superseded.py index 6e93d8e5a51..87352e4f361 100644 --- a/src/sage/misc/superseded.py +++ b/src/sage/misc/superseded.py @@ -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)): diff --git a/src/sage/modules/free_module.py b/src/sage/modules/free_module.py index 5a65b4260f0..99538112cbc 100644 --- a/src/sage/modules/free_module.py +++ b/src/sage/modules/free_module.py @@ -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) @@ -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): @@ -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 diff --git a/src/sage/modules/with_basis/morphism.py b/src/sage/modules/with_basis/morphism.py index b94629a8dfe..30b4041f0cb 100644 --- a/src/sage/modules/with_basis/morphism.py +++ b/src/sage/modules/with_basis/morphism.py @@ -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(): @@ -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 diff --git a/src/sage/plot/plot3d/platonic.py b/src/sage/plot/plot3d/platonic.py index be590739c3e..94d15ab16ad 100644 --- a/src/sage/plot/plot3d/platonic.py +++ b/src/sage/plot/plot3d/platonic.py @@ -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): """ @@ -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): @@ -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""" @@ -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): @@ -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] @@ -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""" diff --git a/src/sage/plot/plot3d/tri_plot.py b/src/sage/plot/plot3d/tri_plot.py index da719020117..256b0d348c3 100644 --- a/src/sage/plot/plot3d/tri_plot.py +++ b/src/sage/plot/plot3d/tri_plot.py @@ -412,38 +412,38 @@ def plot_block(self, min_x, mid_x, max_x, min_y, mid_y, max_y, sw_z, nw_z, se_z, self.interface(0, sw.top, sw.top_c, nw.bottom, nw.bottom_c) self.interface(0, se.top, se.top_c, ne.bottom, ne.bottom_c) - #get the boundary information about the subsquares - left = sw.left + nw.left[1:] - left_c = sw.left_c + nw.left_c - right = se.right + ne.right[1:] - right_c = se.right_c + ne.right_c - top = nw.top + ne.top[1:] - top_c = nw.top_c + ne.top_c - bottom = sw.bottom + se.bottom[1:] + # get the boundary information about the subsquares + left = sw.left + nw.left[1:] + left_c = sw.left_c + nw.left_c + right = se.right + ne.right[1:] + right_c = se.right_c + ne.right_c + top = nw.top + ne.top[1:] + top_c = nw.top_c + ne.top_c + bottom = sw.bottom + se.bottom[1:] bottom_c = sw.bottom_c + se.bottom_c else: # just build the square we're in if self._g is None: - sw = [(min_x,min_y,sw_z[0])] - nw = [(min_x,max_y,nw_z[0])] - se = [(max_x,min_y,se_z[0])] - ne = [(max_x,max_y,ne_z[0])] - c = [[(mid_x,mid_y,mid_z[0])]] + sw = [(min_x, min_y, sw_z[0])] + nw = [(min_x, max_y, nw_z[0])] + se = [(max_x, min_y, se_z[0])] + ne = [(max_x, max_y, ne_z[0])] + c = [[(mid_x, mid_y, mid_z[0])]] else: - sw = [(min_x,min_y,sw_z[0]),sw_z[1]] - nw = [(min_x,max_y,nw_z[0]),nw_z[1]] - se = [(max_x,min_y,se_z[0]),se_z[1]] - ne = [(max_x,max_y,ne_z[0]),ne_z[1]] - c = [[(mid_x,mid_y,mid_z[0]),mid_z[1]]] - - left = [sw,nw] - left_c = c - top = [nw,ne] - top_c = c - right = [se,ne] - right_c = c - bottom = [sw,se] + sw = [(min_x, min_y, sw_z[0]), sw_z[1]] + nw = [(min_x, max_y, nw_z[0]), nw_z[1]] + se = [(max_x, min_y, se_z[0]), se_z[1]] + ne = [(max_x, max_y, ne_z[0]), ne_z[1]] + c = [[(mid_x, mid_y, mid_z[0]), mid_z[1]]] + + left = [sw, nw] + left_c = c + top = [nw, ne] + top_c = c + right = [se, ne] + right_c = c + bottom = [sw, se] bottom_c = c return PlotBlock(left, left_c, top, top_c, right, right_c, bottom, bottom_c) @@ -465,9 +465,9 @@ def interface(self, n, p, p_c, q, q_c): sage: t._objects[-1].get_vertices() ((-1/4, 0, 1/16), (-1/4, 1/4, 1/8), (-3/8, 1/8, 3/16)) """ - m = [p[0]] # a sorted union of p and q - mpc = [p_c[0]] # centers from p_c corresponding to m - mqc = [q_c[0]] # centers from q_c corresponding to m + m = [p[0]] # a sorted union of p and q + mpc = [p_c[0]] # centers from p_c corresponding to m + mqc = [q_c[0]] # centers from q_c corresponding to m i = 1 j = 1