def genus1_lookup_equation_nf(rec): assert rec['g'] == 1 # make base field nf_matches = list(db.nf_fields.search({'coeffs': rec['base_field']})) if len(nf_matches) == 0: return None else: nf_rec = nf_matches[0] # make curve f, h = curve_string_parser(rec) ainvs = hyperelliptic_polys_to_ainvs(f, h) E = EllipticCurve(ainvs) K = E.base_field() j = E.j_invariant() j_str = NFelt(j) j_matches = list( db.ec_nfcurves.search({ "field_label": nf_rec['label'], "jinv": j_str })) for r in j_matches: ainvs2 = parse_ainvs(K, r['ainvs']) E2 = EllipticCurve(ainvs2) assert E.base_field() == E2.base_field() if E.is_isomorphic(E2): return r['label'] #print("Curve not found in database") return None
def genus1_lookup_equation_QQ(rec): assert rec['g'] == 1 f, h = curve_string_parser(rec) ainvs = hyperelliptic_polys_to_ainvs(f, h) E = EllipticCurve(ainvs) j = E.j_invariant() for r in db.ec_curves.search({"jinv": str(j)}): ainvs2 = r['ainvs'] E2 = EllipticCurve(ainvs2) if E.is_isomorphic(E2): return r['lmfdb_label'] #print("Curve not found in database") return None