From b60e81f323703f3d641cf5d78c519fd8701f1449 Mon Sep 17 00:00:00 2001 From: Gareth Ma Date: Thu, 12 Sep 2024 18:32:04 +0100 Subject: [PATCH] apply review changes --- .../schemes/elliptic_curves/ell_finite_field.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index b1f77da41e8..65b49cfe1bd 100755 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -1353,7 +1353,9 @@ def has_order(self, value, num_checks=8): - ``num_checks``-- integer (default: `8`); the number of times to check whether ``value`` times a random point on this curve equals the - identity + identity. If ``value`` is a prime and the curve is over a field of + order at least `5`, it is sufficient to pass in ``num_checks=1`` - + see the examples below. .. NOTE:: @@ -1403,14 +1405,20 @@ def has_order(self, value, num_checks=8): sage: E.has_order(N^2 + N) True + Due to the nature of the algorithm (testing multiple of points) and the Hasse-Weil bound, we see that for testing prime orders, ``num_checks=1`` is sufficient:: + + sage: p = random_prime(1000) + sage: E = EllipticCurve(GF(p), j=randrange(p)) + sage: q = random_prime(p + 20, lbound=p - 20) + sage: E.has_order(q, num_checks=20) == E.has_order(q, num_checks=1) + True + AUTHORS: - Mariah Lenox (2011-02-16): Initial implementation - Gareth Ma (2024-01-21): Fix bug for small curves """ - # This method does *not* use the cached value of `_order` even when - # available. q = self.base_field().order() a, b = Hasse_bounds(q, 1) if not a <= value <= b: @@ -2980,7 +2988,7 @@ def EllipticCurve_with_prime_order(N): Elliptic Curve defined by y^2 = x^3 + 20*x + 20 over Finite Field of size 23, Elliptic Curve defined by y^2 = x^3 + 10*x + 16 over Finite Field of size 23] sage: import itertools - sage: # These are the only primes, by the Weil-Hasse bound + sage: # These are the only primes, by the Hasse-Weil bound sage: for q in prime_range(17, 35): ....: K = GF(q) ....: for u in itertools.product(range(q), repeat=2):