diff --git a/lmfdb/abvar/fq/main.py b/lmfdb/abvar/fq/main.py index f665cc12cf..8acd564b5f 100644 --- a/lmfdb/abvar/fq/main.py +++ b/lmfdb/abvar/fq/main.py @@ -616,7 +616,7 @@ def jump(info): if deg % 2 == 1: raise ValueError except Exception: - flash_error ("%s is not valid input. Expected a label or Weil polynomial.", jump_box) + flash_error("%s is not valid input. Expected a label or Weil polynomial.", jump_box) return redirect(url_for(".abelian_varieties")) g = deg//2 lead = cdict[deg] @@ -624,7 +624,7 @@ def jump(info): lead = cdict[0] cdict = {deg-exp: coeff for (exp, coeff) in cdict.items()} if cdict.get(0) != 1: - flash_error ("%s is not valid input. Polynomial must have constant or leading coefficient 1", jump_box) + flash_error("%s is not valid input. Polynomial must have constant or leading coefficient 1", jump_box) return redirect(url_for(".abelian_varieties")) try: q = lead.nth_root(g) @@ -634,7 +634,7 @@ def jump(info): if cdict.get(2*g-i, 0) != q**(g-i) * cdict.get(i, 0): raise ValueError except ValueError: - flash_error ("%s is not valid input. Expected a label or Weil polynomial.", jump_box) + flash_error("%s is not valid input. Expected a label or Weil polynomial.", jump_box) return redirect(url_for(".abelian_varieties")) def extended_code(c): diff --git a/lmfdb/characters/web_character.py b/lmfdb/characters/web_character.py index f8048cd972..2ef7c11080 100644 --- a/lmfdb/characters/web_character.py +++ b/lmfdb/characters/web_character.py @@ -339,13 +339,13 @@ def jacobi_sum(self, val): try: val = int(val) except ValueError: - raise Warning ("n must be a positive integer coprime to the modulus {} and no greater than it".format(mod)) + raise Warning("n must be a positive integer coprime to the modulus {} and no greater than it".format(mod)) if gcd(mod, val) > 1: - raise Warning ("n must be coprime to the modulus : %s" % mod) + raise Warning("n must be coprime to the modulus : %s" % mod) if val > mod: - raise Warning ("n must be less than the modulus : %s" % mod) + raise Warning("n must be less than the modulus : %s" % mod) if val < 0: - raise Warning ("n must be positive") + raise Warning("n must be positive") chi_valuepairs = [[k, chi.conreyangle(k) * chi.order] for k in self.gens] chi_genvalues = [int(v) for g, v in chi_valuepairs] diff --git a/lmfdb/classical_modular_forms/main.py b/lmfdb/classical_modular_forms/main.py index dd4fcb1aed..4bc5266b9d 100644 --- a/lmfdb/classical_modular_forms/main.py +++ b/lmfdb/classical_modular_forms/main.py @@ -582,7 +582,7 @@ def url_for_label(label): return abort(404, "Invalid label") keys = ['level', 'weight', 'char_orbit_label', 'hecke_orbit', 'conrey_index', 'embedding'] keytypes = [POSINT_RE, POSINT_RE, ALPHA_RE, ALPHA_RE, POSINT_RE, POSINT_RE] - for i in range (len(slabel)): + for i in range(len(slabel)): if not keytypes[i].match(slabel[i]): raise ValueError("Invalid label") kwds = {keys[i]: val for i, val in enumerate(slabel)} diff --git a/lmfdb/ecnf/WebEllipticCurve.py b/lmfdb/ecnf/WebEllipticCurve.py index 22b64cb83b..886861429a 100644 --- a/lmfdb/ecnf/WebEllipticCurve.py +++ b/lmfdb/ecnf/WebEllipticCurve.py @@ -84,7 +84,7 @@ def get_nf_info(lab): r""" extract number field label from string and pretty""" try: label = nf_string_to_label(lab) - pretty = field_pretty (label) + pretty = field_pretty(label) except ValueError as err: raise ValueError(Markup("%s is not a valid number field label. %s" % (escape(lab),err))) return label, pretty @@ -566,7 +566,7 @@ def make_E(self): # Regulator only in conditional/unconditional cases, or when we know the rank: BSDReg = None if self.bsd_status in ["conditional", "unconditional"]: - if self.ar == 0: + if self.analytic_rank == 0: BSDReg = 1 self.reg = self.NTreg = web_latex(BSDReg) # otherwise we only get 1.00000... else: @@ -575,7 +575,7 @@ def make_E(self): BSDReg = R * K.degree()**self.rank self.reg = web_latex(R) self.NTreg = web_latex(BSDReg) - except AttributeError: + except Exception: self.reg = "not available" self.NTreg = "not available" elif self.rk != "not available": @@ -652,7 +652,7 @@ def make_E(self): BSDsha_denominator = BSDReg * BSDomega * BSDprodcp BSDsha_from_formula = BSDLvalue * BSDsha_numerator / BSDsha_denominator BSDsha_from_formula_rounded = BSDsha_from_formula.round() - BSDok = (BSDsha_from_formula_rounded == BSDsha) and ((BSDsha_from_formula_rounded -BSDsha_from_formula).abs() < 0.001) + BSDok = (BSDsha_from_formula_rounded == BSDsha) and ((BSDsha_from_formula_rounded - BSDsha_from_formula).abs() < 0.001) #print(f"{BSDsha_from_formula=}") #print(f"{BSDsha_from_formula_rounded=}") #print(f"{BSDsha=}") @@ -686,7 +686,7 @@ def make_E(self): tors2 = '\\#E(K)_{\\mathrm{tor}}^2' rootD = '\\left|d_K\\right|^{1/2}' - lder_name = rf"L^{{({r})}}(E/K,1)/{r}!" if r>=2 else "L'(E/K,1)" if r else "L(E/K,1)" + lder_name = rf"L^{{({r})}}(E/K,1)/{r}!" if r >= 2 else "L'(E/K,1)" if r else "L(E/K,1)" lhs_num = rf'{Sha} {dot} {Om} {dot} {Reg} {dot} {prodcp}' lhs_den = rf'{tors2} {dot} {rootD}' lhs = rf'{frac}{{ {lhs_num} }} {{ {lhs_den} }}' diff --git a/lmfdb/ecnf/main.py b/lmfdb/ecnf/main.py index 22496b4618..7e23feb428 100644 --- a/lmfdb/ecnf/main.py +++ b/lmfdb/ecnf/main.py @@ -200,7 +200,7 @@ def show_ecnf1(nf): if len(request.args) > 0: # if requested field differs from nf, redirect to general search if 'field' in request.args and request.args['field'] != nf_label: - return redirect (url_for(".index", **request.args), 307) + return redirect(url_for(".index", **request.args), 307) info['title'] += ' Search results' info['bread'].append(('Search results','')) info['field'] = nf_label @@ -223,7 +223,7 @@ def show_ecnf_conductor(nf, conductor_label): # if requested field or conductor norm differs from nf or conductor_lable, redirect to general search if ('field' in request.args and request.args['field'] != nf_label) or \ ('conductor_norm' in request.args and request.args['conductor_norm'] != conductor_norm): - return redirect (url_for(".index", **request.args), 307) + return redirect(url_for(".index", **request.args), 307) info['title'] += ' Search results' info['bread'].append(('Search results','')) info['field'] = nf_label @@ -386,7 +386,7 @@ def parse_cm_list(inp, query, qfield): short_title="nonmaximal primes", default=lambda info: info.get("nonmax_primes"), mathmode=True, align="center"), ProcessedCol("galois_images", "ec.galois_rep_modell_image", r"mod-$\ell$ images", lambda v: ", ".join(display_knowl('gl2.subgroup_data', title=s, kwargs={'label':s}) for s in v), - short_title="mod-ℓ images", default=lambda info: info.get ("nonmax_primes") or info.get("galois_image"), align="center"), + short_title="mod-ℓ images", default=lambda info: info.get("nonmax_primes") or info.get("galois_image"), align="center"), MathCol("sha", "ec.analytic_sha_order", r"$Ш_{\textrm{an}}$", short_title="analytic Ш", default=False), ProcessedCol("tamagawa_product", "ec.tamagawa_number", "Tamagawa", lambda v: web_latex(factor(v)), short_title="Tamagawa product", align="center", default=False), ProcessedCol("reg", "ec.regulator", "Regulator", lambda v: str(v)[:11], mathmode=True, align="left", default=False), diff --git a/lmfdb/elliptic_curves/elliptic_curve.py b/lmfdb/elliptic_curves/elliptic_curve.py index ef47bc5ef9..62a2c7e93a 100644 --- a/lmfdb/elliptic_curves/elliptic_curve.py +++ b/lmfdb/elliptic_curves/elliptic_curve.py @@ -252,7 +252,7 @@ def by_conductor(conductor): if request.args: # if conductor changed, fall back to a general search if 'conductor' in request.args and request.args['conductor'] != str(conductor): - return redirect (url_for(".rational_elliptic_curves", **request.args), 307) + return redirect(url_for(".rational_elliptic_curves", **request.args), 307) info['title'] += ' Search results' info['bread'].append(('Search results','')) info['conductor'] = conductor diff --git a/lmfdb/genus2_curves/web_g2c.py b/lmfdb/genus2_curves/web_g2c.py index a60cbc9290..4b951cf8e0 100644 --- a/lmfdb/genus2_curves/web_g2c.py +++ b/lmfdb/genus2_curves/web_g2c.py @@ -898,11 +898,11 @@ def make_object(self, curve, endo, tama, ratpts, clus, galrep, nonsurj, is_curve else: data['mw_group'] = r'\(' + r' \oplus '.join((r'\Z' if n == 0 else r'\Z/{%s}\Z' % n) for n in invs) + r'\)' if lower >= upper: - data['mw_gens_table'] = mw_gens_table (ratpts['mw_invs'], ratpts['mw_gens'], ratpts['mw_heights'], ratpts['rat_pts']) - data['mw_gens_simple_table'] = mw_gens_simple_table (ratpts['mw_invs'], ratpts['mw_gens'], ratpts['mw_heights'], ratpts['rat_pts'], data['min_eqn']) + data['mw_gens_table'] = mw_gens_table(ratpts['mw_invs'], ratpts['mw_gens'], ratpts['mw_heights'], ratpts['rat_pts']) + data['mw_gens_simple_table'] = mw_gens_simple_table(ratpts['mw_invs'], ratpts['mw_gens'], ratpts['mw_heights'], ratpts['rat_pts'], data['min_eqn']) if curve['two_torsion_field'][0]: - data['two_torsion_field_knowl'] = nf_display_knowl (curve['two_torsion_field'][0], field_pretty(curve['two_torsion_field'][0])) + data['two_torsion_field_knowl'] = nf_display_knowl(curve['two_torsion_field'][0], field_pretty(curve['two_torsion_field'][0])) else: t = curve['two_torsion_field'] data['two_torsion_field_knowl'] = r"splitting field of \(%s\) with Galois group %s" % (intlist_to_poly(t[1]),transitive_group_display_knowl(f"{t[2][0]}T{t[2][1]}")) diff --git a/lmfdb/groups/abstract/code.yaml b/lmfdb/groups/abstract/code.yaml index 6977858bcd..df99125e74 100644 --- a/lmfdb/groups/abstract/code.yaml +++ b/lmfdb/groups/abstract/code.yaml @@ -56,7 +56,7 @@ GLZq: GLFq: comment: Define the group as a matrix group with coefficients in GLFq - magma: F:=GF({Fq}); al:=PrimitiveElement(F); G := MatrixGroup< {nFq}, F | {LFq} >; + magma: F:=GF({Fq}); al:=F.1; G := MatrixGroup< {nFq}, F | {LFq} >; gap: G := Group({LFqsplit}); transitive: diff --git a/lmfdb/groups/abstract/web_groups.py b/lmfdb/groups/abstract/web_groups.py index 021bc81a52..e1df744b44 100644 --- a/lmfdb/groups/abstract/web_groups.py +++ b/lmfdb/groups/abstract/web_groups.py @@ -1925,7 +1925,9 @@ def _matrix_coefficient_data(self, rep_type, as_str=False): rep_type = "GLFp" return R, N, k, d, rep_type - def decode_as_matrix(self, code, rep_type, as_str=False, LieType=False, ListForm=False): + def decode_as_matrix(self, code, rep_type, as_str=False, LieType=False, ListForm=False, GLFq_logs=None): + if GLFq_logs is None: + GLFq_logs = as_str or ListForm # ListForm is for code snippet if rep_type == "GLZ" and not isinstance(code, int): # decimal here represents an integer encoding b a, b = str(code).split(".") @@ -1948,13 +1950,14 @@ def pad(X, m): L = pad(L, k * d**2) if rep_type == "GLFq": L = [R(L[i:i+k]) for i in range(0, k*d**2, k)] - L = [l.log(a) if l != 0 else -1 for l in L] #-1 represents 0, to distinguish from a^0 + if GLFq_logs: + L = [l.log(a) if l != 0 else -1 for l in L] #-1 represents 0, to distinguish from a^0 elif rep_type == "GLZ": shift = (N - 1) // 2 L = [c - shift for c in L] if ListForm: return L #as ints representing powers of primitive element if GLFq - if rep_type == "GLFq": + if rep_type == "GLFq" and GLFq_logs: x = matrix(ZZ, d, d, L) #giving powers of alpha (primitive element) else: x = matrix(R, d, d, L) @@ -1963,21 +1966,22 @@ def pad(X, m): if LieType and self.representations["Lie"][0]["family"][0] == "P": return r"\left[" + latex(x) + r"\right]" if rep_type == "GLFq": #need to customize latex command for GLFq - rs = 'r'*d - st_latex = r'\left(\begin{array}{'+rs+'}' - for i in range(d): - for j in range(d): - if j < d-1: - endstr = ' & ' - else: - endstr = r' \\ ' - if L[d*i+j] > 0: - st_latex = st_latex + r'\alpha^{' + str(L[d*i+j]) + '}' + endstr - elif L[d*i+j] == 0: - st_latex = st_latex + str(1) + endstr - else: - st_latex = st_latex + str(0) + endstr - st_latex = st_latex + r'\end{array}\right)' + ls = 'l'*d + st_latex = r'\left(\begin{array}{'+ls+'}' + for i, entrylog in enumerate(L): + if entrylog > 1: + st_latex += rf'\alpha^{{{entrylog}}}' + elif entrylog == 1: + st_latex += r'\alpha' + elif entrylog == 0: + st_latex += "1" + else: + st_latex += "0" + if (i+1)%d == 0: + st_latex += r' \\ ' + else: + st_latex += ' & ' + st_latex += r'\end{array}\right)' return st_latex return latex(x) return x @@ -2236,7 +2240,12 @@ def representation_line(self, rep_type, skip_head=False): # Matrix group R, N, k, d, _ = self._matrix_coefficient_data(rep_type, as_str=True) gens = ", ".join(self.decode_as_matrix(g, rep_type, as_str=True) for g in rdata["gens"]) - gens = fr"$\left\langle {gens} \right\rangle \subseteq \GL_{{{d}}}({R})$" + ambient = fr"\GL_{{{d}}}({R})" + if rep_type == "GLFq": + Fq = GF(N**k, "alpha") + poly = latex(Fq.polynomial()) + ambient += fr" = \GL_{{{d}}}(\F_{{{N}}}[\alpha]/({poly}))" + gens = fr"$\left\langle {gens} \right\rangle \subseteq {ambient}$" code_cmd = self.create_snippet(rep_type) if skip_head: return f'