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

main->web #6307

Merged
merged 13 commits into from
Dec 19, 2024
6 changes: 3 additions & 3 deletions lmfdb/abvar/fq/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,15 @@ 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]
if lead == 1: # accept monic normalization
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)
Expand All @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions lmfdb/characters/web_character.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/classical_modular_forms/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
10 changes: 5 additions & 5 deletions lmfdb/ecnf/WebEllipticCurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("<span style='color:black'>%s</span> is not a valid number field label. %s" % (escape(lab),err)))
return label, pretty
Expand Down Expand Up @@ -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:
Expand All @@ -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":
Expand Down Expand Up @@ -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=}")
Expand Down Expand Up @@ -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} }}'
Expand Down
6 changes: 3 additions & 3 deletions lmfdb/ecnf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/elliptic_curves/elliptic_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lmfdb/genus2_curves/web_g2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]}"))
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/groups/abstract/code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
54 changes: 32 additions & 22 deletions lmfdb/groups/abstract/web_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(".")
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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'<tr><td></td><td colspan="5">{gens}</td></tr>{code_cmd}'
Expand Down Expand Up @@ -2735,7 +2744,7 @@ def code_snippets(self):
nZN = self.representations["GLZN"]["d"]
N = self.representations["GLZN"]["p"]
LZN = [self.decode_as_matrix(g, "GLZN", ListForm=True) for g in self.representations["GLZN"]["gens"]]
LZNsplit = "[" + ",".join([split_matrix_list_ZN(self.decode_as_matrix(g, "GLZN", ListForm=True) , nZN, N) for g in self.representations["GLZN"]["gens"]]) + "]"
LZNsplit = "[" + ",".join(split_matrix_list_ZN(mat, nZN, N) for mat in LZN) + "]"
else:
nZN, N, LZN, LZNsplit = None, None, None, None
if "GLZq" in self.representations:
Expand All @@ -2749,8 +2758,9 @@ def code_snippets(self):
if "GLFq" in self.representations:
nFq = self.representations["GLFq"]["d"]
Fq = self.representations["GLFq"]["q"]
LFq = ",".join([split_matrix_Fq_add_al(self.decode_as_matrix(g, "GLFq", ListForm=True), nFq ) for g in self.representations["GLFq"]["gens"]])
LFqsplit = "[" + ",".join([split_matrix_list_Fq(self.decode_as_matrix(g, "GLFq", ListForm=True), nFq, Fq) for g in self.representations["GLFq"]["gens"]]) + "]"
mats = [self.decode_as_matrix(g, "GLFq", ListForm=True) for g in self.representations["GLFq"]["gens"]]
LFq = ",".join(split_matrix_Fq_add_al(mat, nFq ) for mat in mats)
LFqsplit = "[" + ",".join(split_matrix_list_Fq(mat, nFq, Fq) for mat in mats) + "]"
else:
nFq, Fq, LFq, LFqsplit = None, None, None, None

Expand Down
2 changes: 1 addition & 1 deletion lmfdb/higher_genus_w_automorphisms/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def decjac_format(decjac_list):
entry = entry + "^{" + str(ints[1]) + "}"
entries.append(entry)
latex = "\\times ".join(entries)
ccClasses = cc_display ([ints[2] for ints in decjac_list])
ccClasses = cc_display([ints[2] for ints in decjac_list])
return latex, ccClasses

# Turn 'i.j' in the total label in to cc displayed in mongo
Expand Down
12 changes: 6 additions & 6 deletions lmfdb/lfunctions/Lfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,10 @@ def __init__(self, **args):

# Check for compulsory arguments
if self.fromDB:
validate_required_args ('Unable to construct L-function of Maass form.',
validate_required_args('Unable to construct L-function of Maass form.',
args, 'group', 'level', 'char', 'R', 'ap_id')
else:
validate_required_args ('Unable to construct L-function of Maass form.',
validate_required_args('Unable to construct L-function of Maass form.',
args, 'maass_id')

self._Ltype = "maass"
Expand Down Expand Up @@ -848,9 +848,9 @@ def __init__(self, **args):
constructor_logger(self, args)

# Check for compulsory arguments
validate_required_args ('Unable to construct Hilbert modular form '
validate_required_args('Unable to construct Hilbert modular form '
+ 'L-function.', args, 'label', 'number', 'character')
validate_integer_args ('Unable to construct Hilbert modular form L-function.',
validate_integer_args('Unable to construct Hilbert modular form L-function.',
args, 'character','number')

self._Ltype = "hilbertmodularform"
Expand Down Expand Up @@ -1125,7 +1125,7 @@ def __init__(self, **args):
constructor_logger(self, args)

# Check for compulsory arguments
validate_required_args ('Unable to construct Dedekind zeta function.', args, 'label')
validate_required_args('Unable to construct Dedekind zeta function.', args, 'label')
self._Ltype = "dedekindzeta"

# Put the arguments into the object dictionary
Expand Down Expand Up @@ -1434,7 +1434,7 @@ def __init__(self, **args):
validate_required_args('Unable to construct symmetric power L-function.',
args, 'power', 'underlying_type', 'field',
'conductor', 'isogeny')
validate_integer_args ('The power has to be an integer.',
validate_integer_args('The power has to be an integer.',
args, 'power', 'conductor')
self._Ltype = "SymmetricPower"

Expand Down
Loading
Loading