Skip to content

Commit 4fa9c1c

Browse files
author
Release Manager
committed
gh-35787: adjust random tests for generators of elliptic curves
#35626 introduced a test failure on some machines as some tests return random choices of generators of Mordell-Weil groups for elliptic curves. This adds "random" to these tests and add some tests that do test if the returned answer is correct. This is only possible when the rank is 1 (and the returned point must be in a finite set). For larger ranks at best we can test if the number of generators is ok and if the points are saturated. URL: #35787 Reported by: Chris Wuthrich Reviewer(s):
2 parents cf43e35 + 59a8980 commit 4fa9c1c

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=1def339a9f1b9f34ee5fb82f38a95914876618d8
3-
md5=520b4c716ee0ebc94fbb5d81f17efa85
4-
cksum=2018559679
2+
sha1=310e1602a96449fc1da190278048e89f63c71ef2
3+
md5=20faa4d933ea72b0fc3ab323c8d5cc97
4+
cksum=2486899926
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c418a82d8985d727cb63c5d3f62c60264b52fd13
1+
a198b0e946fab4b5ff3b0a2bdc1dbad86f24d24c

src/sage/schemes/elliptic_curves/ell_rational_field.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,6 +2319,22 @@ def gens(self, proof=None, **kwds):
23192319
sage: E1.gens(algorithm="pari") #random
23202320
[(-400 : 8000 : 1), (0 : -8000 : 1)]
23212321
2322+
TESTS::
2323+
2324+
sage: E = EllipticCurve('389a')
2325+
sage: len(E.gens())
2326+
2
2327+
sage: E.saturation(E.gens())[1]
2328+
1
2329+
sage: len(E.gens(algorithm="pari"))
2330+
2
2331+
sage: E.saturation(E.gens(algorithm="pari"))[1]
2332+
1
2333+
sage: E = EllipticCurve([-3/8,-2/3])
2334+
sage: P = E.lift_x(10/9)
2335+
sage: set(E.gens()) <= set([P,-P])
2336+
True
2337+
23222338
"""
23232339
if proof is None:
23242340
from sage.structure.proof.proof import get_flag
@@ -2370,23 +2386,29 @@ def _compute_gens(self, proof,
23702386
sage: proved
23712387
True
23722388
2373-
TESTS::
2374-
23752389
sage: E = EllipticCurve([-127^2,0])
2376-
sage: E.gens(use_database=False, algorithm="pari")
2377-
Traceback (most recent call last):
2378-
...
2379-
RuntimeError: generators could not be determined. So far we found []. Hint: increase pari_effort.
2380-
sage: E.gens(use_database=False, algorithm="pari",pari_effort=4)
2390+
sage: E.gens(use_database=False, algorithm="pari",pari_effort=4) # random
23812391
[(611429153205013185025/9492121848205441 : 15118836457596902442737698070880/924793900700594415341761 : 1)]
23822392
2393+
TESTS::
2394+
2395+
sage: P = E.lift_x(611429153205013185025/9492121848205441)
2396+
sage: set(E.gens(use_database=False, algorithm="pari",pari_effort=4)) <= set([P+T for T
2397+
....: in E.torsion_points()] + [-P+T for T in E.torsion_points()])
2398+
True
2399+
23832400
sage: E = EllipticCurve([-157^2,0])
23842401
sage: E.gens(use_database=False, algorithm="pari")
23852402
Traceback (most recent call last):
23862403
...
23872404
RuntimeError: generators could not be determined. So far we found []. Hint: increase pari_effort.
2388-
sage: E.gens(use_database=False, algorithm="pari",pari_effort=10) # long time
2405+
sage: ge = E.gens(use_database=False, algorithm="pari",pari_effort=10)
2406+
sage: ge #random
23892407
[(-166136231668185267540804/2825630694251145858025 : 167661624456834335404812111469782006/150201095200135518108761470235125 : 1)]
2408+
sage: P = E.lift_x(-166136231668185267540804/2825630694251145858025)
2409+
sage: set(E.gens(use_database=False, algorithm="pari",pari_effort=4)) <= set([P+T for T
2410+
....: in E.torsion_points()] + [-P+T for T in E.torsion_points()])
2411+
True
23902412
23912413
"""
23922414
# If the optional extended database is installed and an
@@ -2532,6 +2554,11 @@ def gens_certain(self):
25322554
25332555
TESTS::
25342556
2557+
sage: E = EllipticCurve('37a1')
2558+
sage: P = E([0,-1])
2559+
sage: set(E.gens()) <= set([P,-P])
2560+
True
2561+
25352562
sage: E = EllipticCurve([2, 4, 6, 8, 10])
25362563
sage: E.gens_certain()
25372564
Traceback (most recent call last):

0 commit comments

Comments
 (0)