From 2ab86ef72a3ddc7341ed76e4dc0dbd0ce7ee0162 Mon Sep 17 00:00:00 2001 From: John Cremona Date: Tue, 2 Feb 2021 11:39:29 +0000 Subject: [PATCH] #31317: more intelligent default for nap --- .../schemes/elliptic_curves/ell_rational_field.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index ab29f1f1618..8176d56486e 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -1106,6 +1106,8 @@ def _modular_symbol_normalize(self, sign, normalize, implementation, nap): if sign not in [1,-1]: raise ValueError("The sign of a modular symbol must be 1 or -1") sign = ZZ(sign) + if implementation == 'eclib' and nap == 0: + nap = min(100*self.conductor().isqrt(), 10000) if normalize is None: normalize = "L_ratio" if normalize not in ["L_ratio", "period", "none"]: @@ -1115,7 +1117,7 @@ def _modular_symbol_normalize(self, sign, normalize, implementation, nap): return (sign, normalize, implementation, nap) @cached_method(key = _modular_symbol_normalize) - def modular_symbol(self, sign=+1, normalize=None, implementation='eclib', nap=500): + def modular_symbol(self, sign=+1, normalize=None, implementation='eclib', nap=0): r"""Return the modular symbol map associated to this elliptic curve with given sign. @@ -1142,10 +1144,11 @@ def modular_symbol(self, sign=+1, normalize=None, implementation='eclib', nap=50 uses Wuthrich's implementation of numerical modular symbols. - - ``nap`` - (int, default 1000); ignored unless implementation - is 'eclib'. The number of ap of E to use in determining the - normalisation of the modular symbols. Using too small a - value can lead to incorrect normalisation. + - ``nap`` - (int, default 0); ignored unless implementation is + 'eclib'. The number of ap of E to use in determining the + normalisation of the modular symbols. If 0 (the default), + then the value of 100*E.conductor().isqrt() is used. Using + too small a value can lead to incorrect normalisation. DEFINITION: