Skip to content

Commit

Permalink
Merge pull request #5709 from edgarcosta/noLfly
Browse files Browse the repository at this point in the history
No L-functions on the fly on beta/www
  • Loading branch information
AndrewVSutherland authored Nov 3, 2023
2 parents 81c7ff7 + d8b01de commit 9c303c9
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 86 deletions.
10 changes: 5 additions & 5 deletions lmfdb/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ def urlencode(kwargs):
# Redirects and errors #
##############################

@app.after_request
def print_done(T):
app.logger.info(f"done with = {request.url}")
return T
# @app.after_request
# def print_done(T):
# app.logger.info(f"done with = {request.url}")
# return T

@app.before_request
def netloc_redirect():
Expand All @@ -265,7 +265,7 @@ def netloc_redirect():
from urllib.parse import urlparse, urlunparse

urlparts = urlparse(request.url)
app.logger.info(f"Requested url = {request.url}")
# app.logger.info(f"Requested url = {request.url}")

if urlparts.netloc in ["lmfdb.org", "lmfdb.com", "www.lmfdb.com"]:
replaced = urlparts._replace(netloc="www.lmfdb.org", scheme="https")
Expand Down
6 changes: 3 additions & 3 deletions lmfdb/artin_representations/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def add_lfunction_friends(friends, label):
cmf_label = '.'.join(s[4:])
url = r['url'] if r['url'][0] == '/' else '/' + r['url']
friends.append(("Modular form " + cmf_label, url))
friends.append(("L-function", url_for("l_functions.l_function_artin_page", label=label)))
friends.append(("L-function", url_for('l_functions.by_full_label', label=rec["label"])))
return friends

@artin_representations_page.route("/")
Expand Down Expand Up @@ -379,13 +379,13 @@ def render_artin_representation_webpage(label):
if the_rep.dimension() == 1:
# Zeta is loaded differently
if the_rep.conductor == 1:
friends.append(("L-function", url_for("l_functions.l_function_dirichlet_page", modulus=1, number=1)))
friends.append(("L-function", url_for('l_functions.by_full_label', label='1-1-1.1-r0-0-0')))
else:
# looking for Lhash dirichlet_L_modulus.number
mylhash = 'dirichlet_L_%d.%d'%(cc.modulus,cc.number)
lres = db.lfunc_instances.lucky({'Lhash': mylhash})
if lres is not None:
friends.append(("L-function", url_for("l_functions.l_function_dirichlet_page", modulus=cc.modulus, number=cc.number)))
friends.append(("L-function", url_for('l_functions.by_full_label', label=lres["label"])))
if case == 'rep':
orblabel = re.sub(r'\.[a-z]+$', '', label)
friends.append(("Galois orbit " + artin_label_pretty(orblabel),
Expand Down
40 changes: 36 additions & 4 deletions lmfdb/lfunctions/Lfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ def __init__(self, **args):
title_end = "" #" on $%s$" % (self.group)

else: # Generate from Maass form
if not is_debug_mode():
raise ValueError(f'Error constructing L-function for Maass form {self.maass_id}, as it is not in the database')

# Create the Maass form
self.mf = WebMaassForm.by_maass_id(self.maass_id)
Expand Down Expand Up @@ -854,6 +856,12 @@ def __init__(self, **args):

# Put the arguments into the object dictionary
self.origin_label = args['label']


# disable L-functions on the fly in production
if not is_debug_mode():
raise ValueError(f'Error constructing L-function for Hilbert modular form {self.origin_label}, as it is not in the database')

self.number = int(args['number'])
self.character= int(args['character'])
if self.character != 0:
Expand Down Expand Up @@ -1027,6 +1035,13 @@ def __init__(self, **args):

# Load form (S) from database
label = '%d_%s'%(self.weight,self.orbit)


# disable L-functions on the fly in production
if not is_debug_mode():
raise ValueError(f'Error constructing L-function for Siegel modular form {label}, as it is not in the database')


self.S = Sample('Sp4Z', label)
if not self.S:
raise KeyError("Siegel modular form Sp4Z.%s not found in database." % label)
Expand Down Expand Up @@ -1120,6 +1135,10 @@ def __init__(self, **args):
self.origin_label = self.label
self.__dict__.pop('label')

# disable L-functions on the fly in production
if not is_debug_mode():
raise ValueError(f'Error constructing Dedekind zeta function for {self.origin_label}, as it is not in the database')

# Fetch the polynomial of the field from the database
wnf = WebNumberField(self.origin_label)
if not wnf or wnf.is_null():
Expand Down Expand Up @@ -1239,6 +1258,10 @@ def __init__(self, **args):
# Put the arguments into the object dictionary
self.origin_label = args["label"]

# disable L-functions on the fly in production
if not is_debug_mode():
raise ValueError(f'Error constructing L-function for the Artin representation {self.origin_label}, as it is not in the database')

# Create the Artin representation
try:
self.artin = ArtinRepresentation(self.origin_label)
Expand All @@ -1257,10 +1280,6 @@ def __init__(self, **args):
self.degree = self.artin.dimension()
self.level = self.artin.conductor()

# disable expensive L-functions, these should not be linked anywhere regardless
# this threshold comes from lmfdb/artin_representations/main.py
if not is_debug_mode() and self.level**self.degree > 729000000000000:
raise ValueError(f'Error constructing L-function for the Artin representation {self.origin_label}, as the conductor/degree is too large.')

self.level_factored = factor(self.level)
self.mu_fe = self.artin.mu_fe()
Expand Down Expand Up @@ -1334,6 +1353,11 @@ def __init__(self, **args):
# Put the arguments into the object dictionary
self.origin_label = args["label"]


# disable L-functions on the fly in production
if not is_debug_mode():
raise ValueError(f'Error constructing L-function for the hypergeometric motive {self.origin_label}, as it is not in the database')

# Get the motive from the database
self.motive = getHgmData(self.origin_label)
if not self.motive:
Expand Down Expand Up @@ -1421,6 +1445,14 @@ def __init__(self, **args):
self.__dict__.update(args)
self.m = int(self.power)
self.origin_label = str(self.conductor) + '.' + self.isogeny


# disable L-functions on the fly in production
# FIXME: redirect for m = 1?
if not is_debug_mode():
raise ValueError(f'Error constructing L-function for symmetric power {self.m} of {self.origin_label}, as it is not in the database')


if self.underlying_type != 'EllipticCurve' or self.field != 'Q':
raise TypeError("The symmetric L-functions have been implemented "
+ "only for elliptic curves over Q.")
Expand Down
138 changes: 69 additions & 69 deletions lmfdb/lfunctions/test_lfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,20 +300,20 @@ def test_Lhmf(self):
assert '0.28781' in L.get_data(as_text=True)
assert '4-24e2-1.1-c1e2-0-1' in L.get_data(as_text=True)

def test_Lgl2maass(self):
L = self.tc.get('/L/ModularForm/GL2/Q/Maass/4f5695df88aece2afe000021/')
assert '1 + 4.54845492142i' in L.get_data(as_text=True)
# FIXME
# these zeros cannot be correct to this much precision
# the eigenvalue was computed to lower precision
L = self.tc.get('/L/Zeros/ModularForm/GL2/Q/Maass/4f5695df88aece2afe000021/')
assert '7.8729423429' in L.get_data(as_text=True)
L = self.tc.get('/L/ModularForm/GL2/Q/Maass/4f55571b88aece241f000013/')
assert '5.09874190873i' in L.get_data(as_text=True)
L = self.tc.get('/L/Zeros/ModularForm/GL2/Q/Maass/4f55571b88aece241f000013/')
assert '11.614970337' in L.get_data(as_text=True)
L = self.tc.get('/L/ModularForm/GL2/Q/Maass/4cb8503a58bca91458000032/')
assert '1 + 9.53369526135i' in L.get_data(as_text=True)
# def test_Lgl2maass(self):
# L = self.tc.get('/L/ModularForm/GL2/Q/Maass/4f5695df88aece2afe000021/')
# assert '1 + 4.54845492142i' in L.get_data(as_text=True)
# # FIXME
# # these zeros cannot be correct to this much precision
# # the eigenvalue was computed to lower precision
# L = self.tc.get('/L/Zeros/ModularForm/GL2/Q/Maass/4f5695df88aece2afe000021/')
# assert '7.8729423429' in L.get_data(as_text=True)
# L = self.tc.get('/L/ModularForm/GL2/Q/Maass/4f55571b88aece241f000013/')
# assert '5.09874190873i' in L.get_data(as_text=True)
# L = self.tc.get('/L/Zeros/ModularForm/GL2/Q/Maass/4f55571b88aece241f000013/')
# assert '11.614970337' in L.get_data(as_text=True)
# L = self.tc.get('/L/ModularForm/GL2/Q/Maass/4cb8503a58bca91458000032/')
# assert '1 + 9.53369526135i' in L.get_data(as_text=True)

def test_Lgl3maass(self):
L = self.tc.get('/L/ModularForm/GL3/Q/Maass/1/1/20.39039_14.06890/-0.0742719/', follow_redirects=True)
Expand All @@ -332,58 +332,58 @@ def test_Lgl4maass(self):
L = self.tc.get('/L/Zeros/4/1/1.1/r0e4/p2.27m6.04m13.14p16.90/0/')
assert '16.18901597' in L.get_data(as_text=True)

def test_Lsym2EC(self):
L = self.tc.get('/L/SymmetricPower/2/EllipticCurve/Q/11/a/')
assert '0.8933960461' in L.get_data(as_text=True)
L = self.tc.get('/L/Zeros/SymmetricPower/2/EllipticCurve/Q/11/a/')
assert '4.7345954' in L.get_data(as_text=True)

def test_Lsym3EC(self):
L = self.tc.get('/L/SymmetricPower/3/EllipticCurve/Q/11/a/')
assert '1.140230868' in L.get_data(as_text=True)

def test_Lsym4EC(self):
L = self.tc.get('/L/SymmetricPower/4/EllipticCurve/Q/11/a/')
assert '0.6058003920' in L.get_data(as_text=True)

def test_LsymHighEC(self):
L = self.tc.get('/L/SymmetricPower/5/EllipticCurve/Q/11/a/')
assert '161051' in L.get_data(as_text=True)
L = self.tc.get('/L/SymmetricPower/6/EllipticCurve/Q/11/a/')
assert '1771561' in L.get_data(as_text=True)
L = self.tc.get('/L/SymmetricPower/11/EllipticCurve/Q/11/a/')
assert '11^{11}' in L.get_data(as_text=True)

def test_Ldedekind(self):
L = self.tc.get('/L/NumberField/3.1.23.1/')
assert '0.2541547348' in L.get_data(as_text=True)
L = self.tc.get('/L/Zeros/NumberField/3.1.23.1/')
assert '5.1156833288' in L.get_data(as_text=True)
L = self.tc.get('/L/NumberField/5.5.2337227518904161.1/')
assert '3718837' in L.get_data(as_text=True)
L = self.tc.get('L/NumberField/14.14.28152039412241052225421312.1/')
assert 'chi_{172}' in L.get_data(as_text=True) and 'chi_{43}' in L.get_data(as_text=True)

def test_Ldedekindabelian(self):
L = self.tc.get('/L/NumberField/3.3.81.1/')
assert 'Graph' in L.get_data(as_text=True)
# def test_Lsym2EC(self):
# L = self.tc.get('/L/SymmetricPower/2/EllipticCurve/Q/11/a/')
# assert '0.8933960461' in L.get_data(as_text=True)
# L = self.tc.get('/L/Zeros/SymmetricPower/2/EllipticCurve/Q/11/a/')
# assert '4.7345954' in L.get_data(as_text=True)

# def test_Lsym3EC(self):
# L = self.tc.get('/L/SymmetricPower/3/EllipticCurve/Q/11/a/')
# assert '1.140230868' in L.get_data(as_text=True)

# def test_Lsym4EC(self):
# L = self.tc.get('/L/SymmetricPower/4/EllipticCurve/Q/11/a/')
# assert '0.6058003920' in L.get_data(as_text=True)

# def test_LsymHighEC(self):
# L = self.tc.get('/L/SymmetricPower/5/EllipticCurve/Q/11/a/')
# assert '161051' in L.get_data(as_text=True)
# L = self.tc.get('/L/SymmetricPower/6/EllipticCurve/Q/11/a/')
# assert '1771561' in L.get_data(as_text=True)
# L = self.tc.get('/L/SymmetricPower/11/EllipticCurve/Q/11/a/')
# assert '11^{11}' in L.get_data(as_text=True)

# def test_Ldedekind(self):
# L = self.tc.get('/L/NumberField/3.1.23.1/')
# assert '0.2541547348' in L.get_data(as_text=True)
# L = self.tc.get('/L/Zeros/NumberField/3.1.23.1/')
# assert '5.1156833288' in L.get_data(as_text=True)
# L = self.tc.get('/L/NumberField/5.5.2337227518904161.1/')
# assert '3718837' in L.get_data(as_text=True)
# L = self.tc.get('L/NumberField/14.14.28152039412241052225421312.1/')
# assert 'chi_{172}' in L.get_data(as_text=True) and 'chi_{43}' in L.get_data(as_text=True)

# def test_Ldedekindabelian(self):
# L = self.tc.get('/L/NumberField/3.3.81.1/')
# assert 'Graph' in L.get_data(as_text=True)

def test_Lartin(self):
L = self.tc.get('/L/ArtinRepresentation/2.23.3t2.1c1/', follow_redirects=True)
assert '0.1740363269' in L.get_data(as_text=True)
# same in new labels
L = self.tc.get('/L/ArtinRepresentation/2.23.3t2.b.a/', follow_redirects=True)
assert '0.1740363269' in L.get_data(as_text=True)
L = self.tc.get('/L/Zeros/ArtinRepresentation/2.23.3t2.b.a/', follow_redirects=True)
L = self.tc.get('/L/Zeros/2/23/23.22/c0/0/0', follow_redirects=True)
assert '5.1156833288' in L.get_data(as_text=True)
L = self.tc.get('/L/ArtinRepresentation/4.1609.5t5.a.a/', follow_redirects=True)
assert '0.0755586459' in L.get_data(as_text=True)
L = self.tc.get('/L/Zeros/ArtinRepresentation/4.1609.5t5.1c1/', follow_redirects=True)
assert '3.50464340448' in L.get_data(as_text=True)
# L = self.tc.get('/L/ArtinRepresentation/4.1609.5t5.a.a/', follow_redirects=True)
# assert '0.0755586459' in L.get_data(as_text=True)
# L = self.tc.get('/L/Zeros/ArtinRepresentation/4.1609.5t5.1c1/', follow_redirects=True)
# assert '3.50464340448' in L.get_data(as_text=True)

def test_Lhgm(self):
L = self.tc.get('/L/Motive/Hypergeometric/Q/A4_B2.1/t-1.1')
assert 'Graph' in L.get_data(as_text=True)
# def test_Lhgm(self):
# L = self.tc.get('/L/Motive/Hypergeometric/Q/A4_B2.1/t-1.1')
# assert 'Graph' in L.get_data(as_text=True)

def test_Lgenus2(self):
L = self.tc.get('/L/Genus2Curve/Q/169/a/', follow_redirects=True)
Expand Down Expand Up @@ -537,13 +537,13 @@ def test_LcmfPlot(self):
L = self.tc.get('/L/Plot/2/14/1.1/c5/0/0/')
assert b'PNG' in L.get_data()

def test_LartinPlot(self):
L = self.tc.get('/L/Plot/ArtinRepresentation/2.68.4t3.b.a/')
assert b'PNG' in L.get_data()
# def test_LartinPlot(self):
# L = self.tc.get('/L/Plot/ArtinRepresentation/2.68.4t3.b.a/')
# assert b'PNG' in L.get_data()

def test_LHGMZeros(self):
L = self.tc.get('/L/Zeros/Motive/Hypergeometric/Q/A2.2.2.2_B1.1.1.1/t-1.1/')
assert '4.4977' in L.get_data(as_text=True)
# def test_LHGMZeros(self):
# L = self.tc.get('/L/Zeros/Motive/Hypergeometric/Q/A2.2.2.2_B1.1.1.1/t-1.1/')
# assert '4.4977' in L.get_data(as_text=True)

# ------------------------------------------------------
# Testing error messages
Expand All @@ -566,25 +566,25 @@ def test_errorMessages(self):
assert 'L-function for modular form ModularForm/GL3/Q/Maass/1/1/16.40312_0.171121/-0.421999/ not found' in L.get_data(as_text=True)

L = self.tc.get('/L/ModularForm/GL2/TotallyReal/2.2.5.1/holomorphic/2.2.5.1-31.1-a/2/0/')
assert 'L-function of Hilbert form of non-trivial character not implemented yet' in L.get_data(as_text=True)
assert 'not in the database' in L.get_data(as_text=True)

L = self.tc.get('/L/ModularForm/GL2/TotallyReal/2.2.5.1/holomorphic/2.2.5.1-31.5-a/0/0/')
assert 'No Hilbert modular form with label' in L.get_data(as_text=True)
assert 'not in the database' in L.get_data(as_text=True)

L = self.tc.get('/L/Genus2Curve/Q/247/a/')
assert 'L-function for genus 2 curve with label 247.a not found' in L.get_data(as_text=True)

L = self.tc.get('/L/NumberField/2.2.7.1/')
assert 'No data for the number field' in L.get_data(as_text=True)
assert 'not in the database' in L.get_data(as_text=True)

L = self.tc.get('/L/ArtinRepresentation/3.231.4t5.a.a/')
assert 'Error constructing Artin representation' in L.get_data(as_text=True)
assert 'not in the database' in L.get_data(as_text=True)

L = self.tc.get('/L/SymmetricPower/2/EllipticCurve/Q/37/d/')
assert 'No elliptic curve with label ' in L.get_data(as_text=True)
assert 'not in the database' in L.get_data(as_text=True)

L = self.tc.get('/L/SymmetricPower/2/EllipticCurve/Q/27/a/')
assert 'This Elliptic curve has complex multiplication and the symmetric power of its L-function is then not primitive.' in L.get_data(as_text=True)
assert 'not in the database' in L.get_data(as_text=True)

# ------------------------------------------------------
# Testing units not tested above
Expand Down
7 changes: 2 additions & 5 deletions lmfdb/number_fields/number_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,11 +599,8 @@ def render_field_webpage(args):
info['downloads_visible'] = True
info['downloads'] = [('worksheet', '/')]
info['friends'] = []
if nf.can_class_number():
# hide ones that take a long time to compute on the fly
# note that the first degree 4 number field missed the zero of the zeta function
if abs(D**n) < 50000000:
info['friends'].append(('L-function', url_for('l_functions.l_function_nf_page', label=label)))
if nf.degree() == 1:
info['friends'].append(('L-function', url_for('l_functions.by_full_label', label='1-1-1.1-r0-0-0')))
info['friends'].append(('Galois group', url_for("galois_groups.by_label", label="%dT%d" % (n, t))))
discrootfieldcoeffs = nf.discrootfieldcoeffs()[0]
rf_label = db.nf_fields.lucky({'coeffs': discrootfieldcoeffs}, 'label')
Expand Down

0 comments on commit 9c303c9

Please sign in to comment.