Skip to content

Commit

Permalink
gh-35787: adjust random tests for generators of elliptic curves
Browse files Browse the repository at this point in the history
#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):
  • Loading branch information
Release Manager committed Jun 21, 2023
2 parents cf43e35 + 59a8980 commit 4fa9c1c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=1def339a9f1b9f34ee5fb82f38a95914876618d8
md5=520b4c716ee0ebc94fbb5d81f17efa85
cksum=2018559679
sha1=310e1602a96449fc1da190278048e89f63c71ef2
md5=20faa4d933ea72b0fc3ab323c8d5cc97
cksum=2486899926
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c418a82d8985d727cb63c5d3f62c60264b52fd13
a198b0e946fab4b5ff3b0a2bdc1dbad86f24d24c
43 changes: 35 additions & 8 deletions src/sage/schemes/elliptic_curves/ell_rational_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -2319,6 +2319,22 @@ def gens(self, proof=None, **kwds):
sage: E1.gens(algorithm="pari") #random
[(-400 : 8000 : 1), (0 : -8000 : 1)]
TESTS::
sage: E = EllipticCurve('389a')
sage: len(E.gens())
2
sage: E.saturation(E.gens())[1]
1
sage: len(E.gens(algorithm="pari"))
2
sage: E.saturation(E.gens(algorithm="pari"))[1]
1
sage: E = EllipticCurve([-3/8,-2/3])
sage: P = E.lift_x(10/9)
sage: set(E.gens()) <= set([P,-P])
True
"""
if proof is None:
from sage.structure.proof.proof import get_flag
Expand Down Expand Up @@ -2370,23 +2386,29 @@ def _compute_gens(self, proof,
sage: proved
True
TESTS::
sage: E = EllipticCurve([-127^2,0])
sage: E.gens(use_database=False, algorithm="pari")
Traceback (most recent call last):
...
RuntimeError: generators could not be determined. So far we found []. Hint: increase pari_effort.
sage: E.gens(use_database=False, algorithm="pari",pari_effort=4)
sage: E.gens(use_database=False, algorithm="pari",pari_effort=4) # random
[(611429153205013185025/9492121848205441 : 15118836457596902442737698070880/924793900700594415341761 : 1)]
TESTS::
sage: P = E.lift_x(611429153205013185025/9492121848205441)
sage: set(E.gens(use_database=False, algorithm="pari",pari_effort=4)) <= set([P+T for T
....: in E.torsion_points()] + [-P+T for T in E.torsion_points()])
True
sage: E = EllipticCurve([-157^2,0])
sage: E.gens(use_database=False, algorithm="pari")
Traceback (most recent call last):
...
RuntimeError: generators could not be determined. So far we found []. Hint: increase pari_effort.
sage: E.gens(use_database=False, algorithm="pari",pari_effort=10) # long time
sage: ge = E.gens(use_database=False, algorithm="pari",pari_effort=10)
sage: ge #random
[(-166136231668185267540804/2825630694251145858025 : 167661624456834335404812111469782006/150201095200135518108761470235125 : 1)]
sage: P = E.lift_x(-166136231668185267540804/2825630694251145858025)
sage: set(E.gens(use_database=False, algorithm="pari",pari_effort=4)) <= set([P+T for T
....: in E.torsion_points()] + [-P+T for T in E.torsion_points()])
True
"""
# If the optional extended database is installed and an
Expand Down Expand Up @@ -2532,6 +2554,11 @@ def gens_certain(self):
TESTS::
sage: E = EllipticCurve('37a1')
sage: P = E([0,-1])
sage: set(E.gens()) <= set([P,-P])
True
sage: E = EllipticCurve([2, 4, 6, 8, 10])
sage: E.gens_certain()
Traceback (most recent call last):
Expand Down

0 comments on commit 4fa9c1c

Please sign in to comment.