Skip to content

Commit

Permalink
ECNF: fixing the global period adjustment fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCremona committed Dec 9, 2024
1 parent ec8312b commit 81ac07e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lmfdb/ecnf/WebEllipticCurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,18 +651,24 @@ def make_E(self):
BSDsha_numerator = BSDrootdisc * BSDntors**2
BSDsha_denominator = BSDReg * BSDomega * BSDprodcp
BSDsha_from_formula = BSDLvalue * BSDsha_numerator / BSDsha_denominator
BSDok = BSDsha_from_formula.round() == BSDsha
BSDsha_from_formula_rounded = BSDsha_from_formula.round()
BSDok = (BSDsha_from_formula_rounded == BSDsha) and ((BSDsha_from_formula_rounded -BSDsha_from_formula).abs() < 0.001)
#print(f"{BSDsha_from_formula=}")
#print(f"{BSDsha_from_formula_rounded=}")
#print(f"{BSDsha=}")
#print(f"{BSDok=}")
if not BSDok:
# this means that we doubled BSDomega when we should
# not have, so BSDsha_denominator is doubled and
# BSDsha_from formula is halved
print(f"BSD normalization: adjusting Omega for {self.label}: stored Sha = {BSDsha} but formula gives {BSDsha_from_formula} which rounds to {BSDsha_from_formula.round()}")
print(f"BSD normalization: adjusting Omega for {self.label}: stored Sha = {BSDsha} but formula gives {BSDsha_from_formula}")
BSDok = ((BSDsha/BSDsha_from_formula)-2).abs() < 0.01
if not BSDok:
print(f"BSD normalization issue with {self.label}: stored Sha = {BSDsha} but formula gives {BSDsha_from_formula}")
BSDomega /= 2
BSDsha_denominator /= 2
BSDsha_from_formula *= 2
BSDsha_from_formula_rounded = BSDsha_from_formula.round()
BSDLvalue_from_formula = BSDsha * BSDsha_denominator / BSDsha_numerator
self.BSDsha = web_latex(BSDsha_from_formula)
self.BSDLvalue = web_latex(BSDLvalue_from_formula)
Expand Down

0 comments on commit 81ac07e

Please sign in to comment.