From 6367f3a6ffafec0eb44118c2dd89cf2b6d60c74c Mon Sep 17 00:00:00 2001 From: Caleb Van't Land Date: Fri, 21 Feb 2025 14:22:30 -0700 Subject: [PATCH 1/6] Corrected Documentation of monsky_washnitzer.SpecialCubicQuotientRing.gens() --- src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py index 36d629888b5..23766b59996 100644 --- a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +++ b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py @@ -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:: From 0ac1e7ea633fa1f1e448f1debca95c752a329c17 Mon Sep 17 00:00:00 2001 From: Caleb Van't Land Date: Fri, 21 Feb 2025 14:41:15 -0700 Subject: [PATCH 2/6] Modified EllipticCurve_number_field.gens() to return tuple, changed doctests accordingly --- .../elliptic_curves/ell_number_field.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index 518fda03481..cafa2eaee3e 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -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): @@ -2328,9 +2328,9 @@ def gens(self, **kwds): sage: K. = 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`):: @@ -2338,11 +2338,11 @@ def gens(self, **kwds): sage: K. = 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:: @@ -2356,7 +2356,7 @@ def gens(self, **kwds): sage: K. = 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 @@ -2368,7 +2368,7 @@ def gens(self, **kwds): sage: EK.rank() 0 sage: EK.gens() - [] + () IMPLEMENTATION: @@ -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""" From 721a15284d762e205d146fffd6849d05dd2377c2 Mon Sep 17 00:00:00 2001 From: Caleb Van't Land Date: Fri, 21 Feb 2025 14:45:12 -0700 Subject: [PATCH 3/6] Changed RealField_class.gens() to return a tuple, modified documentation and examples accordingly --- src/sage/rings/real_mpfr.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 31d0bb96aed..0c92c716988 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -909,14 +909,14 @@ cdef class RealField_class(sage.rings.abc.RealField): def gens(self): """ - Return a list of generators. + Return a tuple of generators. EXAMPLES:: sage: RR.gens() - [1.00000000000000] + (1.00000000000000,) """ - return [self.gen()] + return (self.gen(),) def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): """ From 2480b6111a6640df3648be33de1f7dea872b4987 Mon Sep 17 00:00:00 2001 From: Caleb Van't Land Date: Fri, 21 Feb 2025 14:47:11 -0700 Subject: [PATCH 4/6] Changed RealIntervalField_class.gens() to return a tuple, modified documentation and examples accordingly --- src/sage/rings/real_mpfi.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index bbe72c26ba2..e5e8f7df114 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -952,14 +952,14 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField): def gens(self): """ - Return a list of generators. + Return a tuple of generators. EXAMPLES:: sage: RIF.gens() - [1] + (1,) """ - return [self.gen()] + return (self.gen(),) def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): """ From 027875c76464008df7eae04fc1e894edc5492def Mon Sep 17 00:00:00 2001 From: Caleb Van't Land Date: Fri, 21 Feb 2025 14:50:41 -0700 Subject: [PATCH 5/6] Changed SymmetricReductionStrategy.gens() to return a tuple, modified documentation and examples accordingly --- src/sage/rings/polynomial/symmetric_reduction.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/polynomial/symmetric_reduction.pyx b/src/sage/rings/polynomial/symmetric_reduction.pyx index 0794ca8a941..a57c52a9ad0 100644 --- a/src/sage/rings/polynomial/symmetric_reduction.pyx +++ b/src/sage/rings/polynomial/symmetric_reduction.pyx @@ -256,7 +256,7 @@ cdef class SymmetricReductionStrategy: def gens(self): """ - Return the list of Infinite Polynomials modulo which ``self`` reduces. + Return the tuple of Infinite Polynomials modulo which ``self`` reduces. EXAMPLES:: @@ -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): """ From b9275d72eaa71dc3f1084d86eb6df88d720b41cb Mon Sep 17 00:00:00 2001 From: Caleb Van't Land Date: Sat, 22 Feb 2025 20:41:51 -0700 Subject: [PATCH 6/6] Change function to expect tuple instead of list --- src/sage/rings/polynomial/symmetric_reduction.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/polynomial/symmetric_reduction.pyx b/src/sage/rings/polynomial/symmetric_reduction.pyx index 98133d617df..0da8d656830 100644 --- a/src/sage/rings/polynomial/symmetric_reduction.pyx +++ b/src/sage/rings/polynomial/symmetric_reduction.pyx @@ -254,7 +254,7 @@ 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 tuple of Infinite Polynomials modulo which ``self`` reduces.