Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions lmfdb/genus2_curves/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,26 +539,30 @@ def genus2_jump(info):
errmsg = f"unable to find equation {eqn_str} (interpreted from %s) in the genus 2 curve database"
elif jump.count('=') == 1:
lhs_str, rhs_str = jump.split('=')
errmsg = "Unable to parse input %s into a polynomial"
try:
rhs_poly = coeff_to_poly_multi(rhs_str)
main_poly_str = lhs_str + "+" + str(-rhs_poly)
main_poly = coeff_to_poly_multi(main_poly_str)
except Exception:
errmsg = "Unable to parse input %s into a polynomial"
flash_error(errmsg, main_poly_str)
return redirect(url_for(".index"))
try:
f,h = unpack_hyperelliptic_polys(main_poly)
except ValueError as e:
flash_error(str(e), main_poly)
return redirect(url_for(".index"))
new_input = str(f) + "," + str(h)
label, eqn_str = genus2_lookup_equation(new_input)
if label:
return redirect(url_for_curve_label(label), 301)
elif label is None:
# the input was parsed
errmsg = f"unable to find equation {eqn_str} (interpreted from %s) in the genus 2 curve database"
jump = rhs_str
else:
try:
main_poly_str = lhs_str + "+" + str(-rhs_poly)
main_poly = coeff_to_poly_multi(main_poly_str)
except Exception:
jump = main_poly_str
else:
try:
f,h = unpack_hyperelliptic_polys(main_poly)
except ValueError as e:
errmsg, jump = str(e), main_poly
else:
new_input = str(f) + "," + str(h)
label, eqn_str = genus2_lookup_equation(new_input)
if label:
return redirect(url_for_curve_label(label), 301)
elif label is None:
# the input was parsed
errmsg = f"unable to find equation {eqn_str} (interpreted from %s) in the genus 2 curve database"
else:
errmsg = "%s is not valid input. Expected a label, e.g., 169.a.169.1"
errmsg += ", or a univariate polynomial, e.g., x^5 + 1"
Expand Down
Loading