Repository: LMFDB/lmfdb

Issue:
Missing elliptic curve L-function?
From the feedback page:

In reference to http://www.lmfdb.org/L/EllipticCurve/3.3.148.1/61.1/a/ , paweleckrzysztof1@gmail.com says:

Unable to render L-function page due to the following problem(s):
No L-function instance data for "EllipticCurve/3.3.148.1/61.1/a" was found in the database.

==== End of quote

I can see that that url produces the error as described, but if I remove the "L", I get an elliptic curve, and the link to the L-function takes it to a different, and functioning, page.  Probably the first step is to contact the person and ask how they got to that url.



Discussion:
I can get to this link by going to the elliptic curve
  http://www.lmfdb.org/EllipticCurve/3.3.148.1/61.1/a/1
and then clicking "L-function".

Something is not right in handling L-functions here.

Starting at the isogeny class
  http://www.lmfdb.org/EllipticCurve/3.3.148.1/61.1/a/
when I click "L-function" it sends me to the HMF L-function
  http://www.lmfdb.org/L/ModularForm/GL2/TotallyReal/3.3.148.1/holomorphic/3.3.148.1-61.1-a/0/0/
The conductor here is 1336144, so we shouldn't trust much on this page (e.g., it looks like the Riemann hypothesis is false).  Indeed, from the HMF page
  http://www.lmfdb.org/ModularForm/GL2/TotallyReal/3.3.148.1/holomorphic/3.3.148.1-61.1-a
we have the L-function turned off because we did not want to display wrong information.

This L-function is not precomputed, if I understand correctly.  

One possible fix is to decide when we display the non-precomputed L-function, based on the conductor and number of L-coefficients available.  It would be helpful to have mathematical input here.  

Perhaps a better fix would be to always go to the L-function page, but only display data when it is correct, under the same criterion.  (Things like the conductor and the friends links are OK, for example.)

JV
I was the one that introduced this bug in #2246.

In short, we need to add a clause to for real field of degree >2
https://github.com/edgarcosta/lmfdb/blob/master/lmfdb/ecnf/WebEllipticCurve.py#L510
In those cases, we should have:
```
self.urls['Lfunction'] = url_for("l_functions.l_function_hmf_page", field=self.field_label, label=self.hmf_label, character='0', number='0')
```



Resolving patch:
diff --git a/lmfdb/ecnf/WebEllipticCurve.py b/lmfdb/ecnf/WebEllipticCurve.py
--- a/lmfdb/ecnf/WebEllipticCurve.py
+++ b/lmfdb/ecnf/WebEllipticCurve.py
@@ -512,18 +512,23 @@ def make_E(self):
         if totally_real:
             self.hmf_label = "-".join([self.field.label, self.conductor_label, self.iso_label])
             self.urls['hmf'] = url_for('hmf.render_hmf_webpage', field_label=self.field.label, label=self.hmf_label)
-            self.urls['Lfunction'] = url_for("l_functions.l_function_ecnf_page", field_label=self.field_label, conductor_label=self.conductor_label, isogeny_class_label=self.iso_label)
+            if sig[0] <= 2:
+                self.urls['Lfunction'] = url_for("l_functions.l_function_ecnf_page", field_label=self.field_label, conductor_label=self.conductor_label, isogeny_class_label=self.iso_label)
+            elif self.abs_disc ** 2 * self.conductor_norm < 70000:
+                # we shouldn't trust the Lfun computed on the fly for large conductor
+                self.urls['Lfunction'] = url_for("l_functions.l_function_hmf_page", field=self.field_label, label=self.hmf_label, character='0', number='0')
 
         if imag_quadratic:
             self.bmf_label = "-".join([self.field.label, self.conductor_label, self.iso_label])
             self.bmf_url = url_for('bmf.render_bmf_webpage', field_label=self.field_label, level_label=self.conductor_label, label_suffix=self.iso_label)
+            self.urls['Lfunction'] = url_for("l_functions.l_function_ecnf_page", field_label=self.field_label, conductor_label=self.conductor_label, isogeny_class_label=self.iso_label)
 
         self.friends = []
         self.friends += [('Isogeny class ' + self.short_class_label, self.urls['class'])]
         self.friends += [('Twists', url_for('ecnf.index', field=self.field_label, jinv=rename_j(j)))]
         if totally_real:
             self.friends += [('Hilbert Modular Form ' + self.hmf_label, self.urls['hmf'])]
-            self.friends += [('L-function', self.urls['Lfunction'])]
+
         if imag_quadratic:
             if "CM" in self.label:
                 self.friends += [('Bianchi Modular Form is not cuspidal', '')]
@@ -533,6 +538,11 @@ def make_E(self):
                 else:
                     self.friends += [('Bianchi Modular Form %s not available' % self.bmf_label, '')]
 
+        if 'Lfunction' in self.urls:
+            self.friends += [('L-function', self.urls['Lfunction'])]
+        else:
+            self.friends += [('L-function not available', "")]
+
         self.properties = [
             ('Base field', self.field.field_pretty()),
             ('Label', self.label)]
diff --git a/lmfdb/ecnf/isog_class.py b/lmfdb/ecnf/isog_class.py
--- a/lmfdb/ecnf/isog_class.py
+++ b/lmfdb/ecnf/isog_class.py
@@ -104,20 +104,31 @@ def curve_url(c):
         if totally_real:
             self.hmf_label = "-".join([self.field_label, self.conductor_label, self.iso_label])
             self.urls['hmf'] = url_for('hmf.render_hmf_webpage', field_label=self.field_label, label=self.hmf_label)
-            self.urls['Lfunction'] = url_for("l_functions.l_function_hmf_page", field=self.field_label, label=self.hmf_label, character='0', number='0')
+            if sig[0] <= 2:
+                self.urls['Lfunction'] = url_for("l_functions.l_function_ecnf_page", field_label=self.field_label, conductor_label=self.conductor_label, isogeny_class_label=self.iso_label)
+            elif self.abs_disc ** 2 * self.conductor_norm < 40000:
+                # we shouldn't trust the Lfun computed on the fly for large conductor
+                self.urls['Lfunction'] = url_for("l_functions.l_function_hmf_page", field=self.field_label, label=self.hmf_label, character='0', number='0')
 
         if imag_quadratic:
             self.bmf_label = "-".join([self.field_label, self.conductor_label, self.iso_label])
             self.bmf_url = url_for('bmf.render_bmf_webpage', field_label=self.field_label, level_label=self.conductor_label, label_suffix=self.iso_label)
+            self.urls['Lfunction'] = url_for("l_functions.l_function_ecnf_page", field_label=self.field_label, conductor_label=self.conductor_label, isogeny_class_label=self.iso_label)
 
         self.friends = []
         if totally_real:
             self.friends += [('Hilbert Modular Form ' + self.hmf_label, self.urls['hmf'])]
-            self.friends += [('L-function', self.urls['Lfunction'])]
+
         if imag_quadratic:
             #self.friends += [('Bianchi Modular Form %s not available' % self.bmf_label, '')]
             self.friends += [('Bianchi Modular Form %s' % self.bmf_label, self.bmf_url)]
 
+        if 'Lfunction' in self.urls:
+            self.friends += [('L-function', self.urls['Lfunction'])]
+        else:
+            self.friends += [('L-function not available', "")]
+
+
         self.properties = [('Base field', self.field_name),
                            ('Label', self.class_label),
                            (None, self.graph_link),


Test patch: