Path: blob/main/scripts/abvar/g1_char23_j_0.sage
1128 views
from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_0_char2, curves_with_j_0_char31from sage.databases.cremona import cremona_letter_code2from collections import defaultdict34output_filename = "output23_0_1728.txt"5counts_filename = "counts23_0_1728.txt"67qs = [2^r for r in range(1,11)] + [3^r for r in range(1,7)]89def signed_cremona_letter_code(m):10if m >= 0:11return cremona_letter_code(m)12else:13return 'a' + cremona_letter_code(-m)1415def get_label(f,q):16g=117return '%s.%s.%s' % (g, q, '_'.join(signed_cremona_letter_code(f[i]) for i in range(1,g+1)))181920def output_data():21with open(output_filename, "w") as file:22file.write("")2324with open(counts_filename, "w") as file:25file.write("")2627for q in qs:28with open(output_filename, "a") as file:29file.write("\n")30to_write = "(g,q) = %s,%s\n" % (1, q)31file.write(to_write)3233F.<a> = GF(q, name='a')34label_to_curves = defaultdict(set)3536if q%2 == 0:37curves = curves_with_j_0_char2(F)38else:39curves = curves_with_j_0_char3(F)4041for curve in curves:42Lpoly = curve.frobenius_polynomial()43to_output = (curve._equation_string()).replace(" ", "")44label_to_curves[get_label(Lpoly,q)].add(to_output)4546for label, equations in label_to_curves.items():47with open(output_filename, "a") as file:48to_write = "%s|{%s}\n" % (label, ','.join(equations))49file.write(to_write)5051with open(counts_filename, "a") as file:52to_write = "%s,%s\n" % (q, len(label_to_curves.keys()))53file.write(to_write)5455output_data()5657