Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change some instances of "gens" method to return tuples #39572

Merged
merged 7 commits into from
Feb 28, 2025
8 changes: 4 additions & 4 deletions src/sage/rings/polynomial/symmetric_reduction.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ cdef class SymmetricReductionStrategy:
return richcmp((left._parent, left._lm, left._tail),
(right._parent, right._lm, right._tail), op)

def gens(self) -> list:
def gens(self) -> tuple:
"""
Return the list of Infinite Polynomials modulo which ``self`` reduces.
Return the tuple of Infinite Polynomials modulo which ``self`` reduces.

EXAMPLES::

Expand All @@ -269,9 +269,9 @@ cdef class SymmetricReductionStrategy:
y_2*y_1^2,
y_2^2*y_1
sage: S.gens()
[y_2*y_1^2, y_2^2*y_1]
(y_2*y_1^2, y_2^2*y_1)
"""
return self._lm
return tuple(self._lm)

def setgens(self, L):
"""
Expand Down
18 changes: 9 additions & 9 deletions src/sage/schemes/elliptic_curves/ell_number_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def base_extend(self, R):
[(52 : 111 : 1)]
sage: EK = E.base_extend(K)
sage: EK.gens()
[(52 : 111 : 1)]
((52 : 111 : 1),)
"""
E = super().base_extend(R)
if isinstance(E, EllipticCurve_number_field):
Expand Down Expand Up @@ -2328,21 +2328,21 @@ def gens(self, **kwds):
sage: K.<a> = NumberField(x^2 + 23, 'a')
sage: E = EllipticCurve(K,[0,0,0,101,0])
sage: E.gens()
[(23831509/8669448*a - 2867471/8669448 : 76507317707/18049790736*a - 424166479633/18049790736 : 1),
((23831509/8669448*a - 2867471/8669448 : 76507317707/18049790736*a - 424166479633/18049790736 : 1),
(-2031032029/969232392*a + 58813561/969232392 : -15575984630401/21336681877488*a + 451041199309/21336681877488 : 1),
(-186948623/4656964 : 549438861195/10049728312*a : 1)]
(-186948623/4656964 : 549438861195/10049728312*a : 1))
It can happen that no points are found if the height bounds
used in the search are too small (see :issue:`10745`)::
sage: K.<t> = NumberField(x^4 + x^2 - 7)
sage: E = EllipticCurve(K, [1, 0, 5*t^2 + 16, 0, 0])
sage: E.gens(lim1=1, lim3=1)
[]
()
sage: E.rank()
1
sage: gg=E.gens(lim3=13); gg # long time (about 4s)
[(... : 1)]
((... : 1),)
Check that the point found has infinite order, and that it is on the curve::
Expand All @@ -2356,7 +2356,7 @@ def gens(self, **kwds):
sage: K.<t> = NumberField(x^2 - 17)
sage: E = EllipticCurve(K, [-4, 0])
sage: E.gens()
[(-1/2*t + 1/2 : -1/2*t + 1/2 : 1), (-t + 3 : -2*t + 10 : 1)]
((-1/2*t + 1/2 : -1/2*t + 1/2 : 1), (-t + 3 : -2*t + 10 : 1))
sage: E.rank()
2
Expand All @@ -2368,7 +2368,7 @@ def gens(self, **kwds):
sage: EK.rank()
0
sage: EK.gens()
[]
()
IMPLEMENTATION:
Expand All @@ -2378,10 +2378,10 @@ def gens(self, **kwds):
PARI/GP scripts from http://www.math.unicaen.fr/~simon/.
"""
try:
return self.gens_quadratic(**kwds)
return tuple(self.gens_quadratic(**kwds))
except ValueError:
self.simon_two_descent(**kwds)
return self._known_points
return tuple(self._known_points)

def period_lattice(self, embedding):
r"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def poly_ring(self):

def gens(self):
"""
Return a list [x, T] where x and T are the generators of the ring
Return a tuple (x, T) where x and T are the generators of the ring
(as element *of this ring*).
.. NOTE::
Expand Down
Loading