Skip to content

Commit

Permalink
Merge pull request #222 from JohnCremona/2adic
Browse files Browse the repository at this point in the history
2adic
  • Loading branch information
JohnCremona committed Apr 7, 2015
2 parents af75af9 + 4106326 commit a88146e
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 12 deletions.
2 changes: 2 additions & 0 deletions lmfdb/elliptic_curves/elliptic_curve.py
Expand Up @@ -466,6 +466,8 @@ def render_curve_webpage_by_label(label):
except AttributeError:
return elliptic_curve_jump_error(label, {}, wellformed_label=False)

if data.twoadic_label:
credit = credit.replace(' and',',') + ' and Jeremy Rouse'
data.modform_display = url_for(".modular_form_display", label=lmfdb_label, number="")

return render_template("curve.html",
Expand Down
79 changes: 71 additions & 8 deletions lmfdb/elliptic_curves/import_ec_data.py
Expand Up @@ -40,7 +40,17 @@
- 'galois_images': (list of strings) Sutherland codes for the
images of the mod p Galois representations for the primes in
'non-surjective_primes' e.g. ['5B']
- 'isogeny_matrix': (list of lists of ints) isogeny matrix for curves in the class
- '2adic_index': (int) the index of the 2-adic representation in
GL(2,Z2) (or 0 for CM curves, which have infinite index)
- '2adic_log_level': (int) the smallest n such that the image
contains the kernel of reduction modulo 2^n (or None for CM curves)
- '2adic_gens': (list of lists of 4 ints) list of entries [a,b,c,d]
of matrices in GL(2,Z/2^nZ) generating the image where n is the
log_level (None for CM curves)
- '2adic_label': (string) Rouse label of the associated modular
curve (None for CM curves)
- 'isogeny_matrix': (list of lists of ints) isogeny matrix for
curves in the class
- 'sha_an': (float) analytic order of sha (approximate unless r=0)
- 'sha': (int) analytic order of sha (rounded value of sha_an)
- 'sha_primes': (list of ints) primes dividing sha
Expand Down Expand Up @@ -239,6 +249,49 @@ def allgens(line):
'torsion_generators': ["%s" % parse_tgens(tgens[1:-1]) for tgens in data[6 + rank:]],
}

def twoadic(line):
r""" Parses one line from a 2adic file. Returns the label and a dict
containing fields with keys '2adic_index', '2adic_log_level',
'2adic_gens' and '2adic_label'.
Input line fields:
conductor iso number ainvs index level gens label
Sample input lines:
110005 a 2 [1,-1,1,-185793,29503856] 12 4 [[3,0,0,1],[3,2,2,3],[3,0,0,3]] X24
27 a 1 [0,0,1,0,-7] inf inf [] CM
"""
data = split(line)
assert len(data)==8
label = data[0] + data[1] + data[2]
model = data[7]
if model == 'CM':
return label, {
'2adic_index': int(0),
'2adic_log_level': None,
'2adic_gens': None,
'2adic_label': None,
}

index = int(data[4])
level = ZZ(data[5])
log_level = int(level.valuation(2))
assert 2**log_level==level
if data[6]=='[]':
gens=[]
else:
gens = data[6][1:-1].replace('],[','];[').split(';')
gens = [[int(c) for c in g[1:-1].split(',')] for g in gens]

return label, {
'2adic_index': index,
'2adic_log_level': log_level,
'2adic_gens': gens,
'2adic_label': model,
}


def intpts(line):
r""" Parses one line from an intpts file. Returns the label and a
Expand Down Expand Up @@ -356,28 +409,38 @@ def cmp_label(lab1, lab2):
def comp_dict_by_label(d1, d2):
return cmp_label(d1['label'], d2['label'])

# To run this go into the top-level lmfdb directory, run sage and give
# the command
# %runfile lmfdb/elliptic_curves/import_ec_data.py
#

def upload_to_db(base_path, min_N, max_N):
# allcurves data all exists also in allgens
# allcurves_filename = 'allcurves/allcurves.%s-%s'%(min_N,max_N)
allbsd_filename = 'allbsd/allbsd.%s-%s' % (min_N, max_N)
allgens_filename = 'allgens/allgens.%s-%s' % (min_N, max_N)
intpts_filename = 'intpts/intpts.%s-%s' % (min_N, max_N)
alldegphi_filename = 'alldegphi/alldegphi.%s-%s' % (min_N, max_N)
alllabels_filename = 'alllabels/alllabels.%s-%s' % (min_N, max_N)
galreps_filename = 'galrep/galrep.%s-%s' % (min_N, max_N)
file_list = [allbsd_filename, allgens_filename, intpts_filename, alldegphi_filename, alllabels_filename, galreps_filename]
# file_list = [galreps_filename]
# file_list = [allgens_filename]
twoadic_filename = '2adic/2adic.%s-%s' % (min_N, max_N)
file_list = [allbsd_filename, allgens_filename, intpts_filename, alldegphi_filename, alllabels_filename, galreps_filename,twoadic_filename]
# file_list = [twoadic_filename]

parsing_dict = {}
for f in file_list:
prefix = f[f.find('/')+1:f.find('.')]
if prefix == '2adic':
parsing_dict[f] = twoadic
else:
parsing_dict[f] = globals()[prefix]


data_to_insert = {} # will hold all the data to be inserted

for f in file_list:
h = open(os.path.join(base_path, f))
print "opened %s" % os.path.join(base_path, f)

parse = globals()[f[f.find('/')+1:f.find('.')]]

parse=parsing_dict[f]
t = time.time()
count = 0
for line in h.readlines():
Expand Down
29 changes: 25 additions & 4 deletions lmfdb/elliptic_curves/templates/curve.html
Expand Up @@ -337,18 +337,39 @@ <h2> Local data </h2>
</table>


<h2> {{KNOWL('ec.q.galois_rep', title='Galois Representations')}} </h2>
<h2> {{KNOWL('ec.galois_rep', title='Galois Representations')}} </h2>

{% if data.data.CMD %} {% else %}
{% if data.twoadic_index == 1 %}
The {{KNOWL('ec.galois_rep',title='2-adic representation')}} attached to this elliptic curve is
surjective.
{% else %}

<p>
The image of the {{KNOWL('ec.galois_rep',title='2-adic representation')}} attached to this elliptic curve
is the subgroup of $\GL(2,\Z_2)$ with {{KNOWL('ec.rouse_label', title='Rouse label')}}
<a href="{{data.data.twoadic_rouse_url}}">{{data.twoadic_label}}</a>.
</p>
<p>
This subgroup is the pull-back of the subgroup of
$\GL(2,\Z_2/2^{{data.twoadic_log_level}}\Z_2)$ generated by
${{data.data.twoadic_gen_matrices}}$ and has index {{
data.twoadic_index }}.
</p>
{% endif %}
{% endif %}


{% if data.data.galois_data %}
<p>
{% if data.data.CMD %}
The mod \( p \) {{KNOWL('ec.q.galois_rep', title='Galois
The mod \( p \) {{KNOWL('ec.galois_rep', title='Galois
Representations')}} of an elliptic curve with {{
KNOWL('ec.complex_multiplication', title='Complex Multiplication') }}
are non-surjective for all primes \( p \). We only show the image for
primes \( p\le 37 \).
{% else %}
The mod \( p \) {{KNOWL('ec.q.galois_rep', title='Galois
The mod \( p \) {{KNOWL('ec.galois_rep', title='Galois
Representation')}} is surjective for all primes \( p \) except those
listed.
{% endif %}
Expand All @@ -367,7 +388,7 @@ <h2> {{KNOWL('ec.q.galois_rep', title='Galois Representations')}} </h2>
</table>
{% else %}
<p>
The mod \( p \) {{KNOWL('ec.q.galois_rep', title='Galois
The mod \( p \) {{KNOWL('ec.galois_rep', title='Galois
Representation')}} is surjective for all primes \( p \).
</p>
{% endif %}
Expand Down
12 changes: 12 additions & 0 deletions lmfdb/elliptic_curves/web_ec.py
Expand Up @@ -11,6 +11,8 @@
import sage.all
from sage.all import EllipticCurve, latex, matrix, ZZ, QQ

ROUSE_URL_PREFIX = "http://users.wfu.edu/rouseja/2adic/" # Needs to be changed whenever J. Rouse and D. Zureick-Brown move their data

cremona_label_regex = re.compile(r'(\d+)([a-z]+)(\d*)')
lmfdb_label_regex = re.compile(r'(\d+)\.([a-z]+)(\d*)')
lmfdb_iso_label_regex = re.compile(r'([a-z]+)(\d*)')
Expand Down Expand Up @@ -105,6 +107,12 @@ def __init__(self, dbdata):
# Next lines because the hyphens make trouble
self.xintcoords = parse_list(dbdata['x-coordinates_of_integral_points'])
self.non_surjective_primes = dbdata['non-surjective_primes']
# Next lines because the python identifiers cannot start with 2
self.twoadic_index = dbdata['2adic_index']
self.twoadic_log_level = dbdata['2adic_log_level']
self.twoadic_gens = dbdata['2adic_gens']
self.twoadic_label = dbdata['2adic_label']
# All other fields are handled here
self.make_curve()

@staticmethod
Expand Down Expand Up @@ -242,6 +250,10 @@ def make_curve(self):
for p,im in zip(data['non_surjective_primes'],
data['galois_images'])]

if self.twoadic_gens:
from sage.matrix.all import Matrix
data['twoadic_gen_matrices'] = ','.join([latex(Matrix(2,2,M)) for M in self.twoadic_gens])
data['twoadic_rouse_url'] = ROUSE_URL_PREFIX + self.twoadic_label + ".html"
# Leading term of L-function & BSD data

bsd = self.bsd = {}
Expand Down

0 comments on commit a88146e

Please sign in to comment.