Skip to content

Commit

Permalink
sagemath: fix pari patch
Browse files Browse the repository at this point in the history
  • Loading branch information
tornaria committed Nov 3, 2024
1 parent 91cd4f0 commit 63ff858
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 21 deletions.
89 changes: 89 additions & 0 deletions srcpkgs/sagemath/patches/38749-00-prepare_backport.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
commit 95d7f3070d46c971fe1ea1fceb3cc6d8039c1d66
Author: Gonzalo Tornaría <[email protected]>
Date: Sun Nov 3 13:09:51 2024 -0300

prepare for backport of #38749

diff --git a/src/sage/modular/dirichlet.py b/src/sage/modular/dirichlet.py
index e579c5090e3..efc533c51f0 100644
--- a/src/sage/modular/dirichlet.py
+++ b/src/sage/modular/dirichlet.py
@@ -2388,7 +2388,8 @@ class DirichletGroupFactory(UniqueFactory):

::

- sage: r4 = CyclotomicField(4).ring_of_integers()
+ sage: K = CyclotomicField(4)
+ sage: r4 = K.ring_of_integers()
sage: G = DirichletGroup(60, r4)
sage: G.gens()
(Dirichlet character modulo 60 of conductor 4
@@ -2401,8 +2402,7 @@ class DirichletGroupFactory(UniqueFactory):
zeta4
sage: parent(val)
Gaussian Integers generated by zeta4 in Cyclotomic Field of order 4 and degree 2
- sage: r4_29_0 = r4.residue_field(r4.ideal(29).factor()[0][0]); r4_29_0(val)
- doctest:warning ... DeprecationWarning: ...
+ sage: r4_29_0 = r4.residue_field(K(29).factor()[0][0]); r4_29_0(val)
17
sage: r4_29_0(val) * GF(29)(3)
22
diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py
index 49b4030b2e9..2a650138291 100644
--- a/src/sage/rings/number_field/selmer_group.py
+++ b/src/sage/rings/number_field/selmer_group.py
@@ -73,7 +73,6 @@ def _ideal_generator(I):
sage: K.<a> = QuadraticField(-11)
sage: [_ideal_generator(K.prime_above(p)) for p in primes(25)]
[2, 1/2*a - 1/2, -1/2*a - 3/2, 7, -a, 13, 17, 19, 1/2*a + 9/2]
-
"""
try:
return I.gens_reduced()[0]
diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py
index 39a60361ec6..f258961f685 100644
--- a/src/sage/schemes/elliptic_curves/gp_simon.py
+++ b/src/sage/schemes/elliptic_curves/gp_simon.py
@@ -57,6 +57,9 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
sage: import sage.schemes.elliptic_curves.gp_simon
sage: E = EllipticCurve('389a1')
sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E)
+ doctest:warning...:
+ DeprecationWarning: please use the 2-descent algorithm over QQ inside pari
+ See https://github.com/sagemath/sage/issues/38461 for details.
(2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)])

TESTS::
diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py
index 393b77bc1ff..af946d05fb7 100644
--- a/src/sage/schemes/plane_conics/con_number_field.py
+++ b/src/sage/schemes/plane_conics/con_number_field.py
@@ -123,9 +123,9 @@ class ProjectiveConic_number_field(ProjectiveConic_field):
sage: C = Conic(K, [1, 3, -5])
sage: C.has_rational_point(point=True, obstruction=True)
(False, Fractional ideal (-i - 2))
- sage: C.has_rational_point(algorithm="rnfisnorm")
+ sage: C.has_rational_point(algorithm='rnfisnorm')
False
- sage: C.has_rational_point(algorithm="rnfisnorm", obstruction=True,
+ sage: C.has_rational_point(algorithm='rnfisnorm', obstruction=True,
....: read_cache=False)
Traceback (most recent call last):
...
diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py
index 339406cd9d6..2baab7e5cda 100644
--- a/src/sage/schemes/projective/projective_morphism.py
+++ b/src/sage/schemes/projective/projective_morphism.py
@@ -1764,10 +1764,10 @@ class SchemeMorphism_polynomial_projective_space_field(SchemeMorphism_polynomial
Scheme morphism:
From: Projective Space of dimension 1 over Number Field in a
with defining polynomial y^4 + 3*y^2 + 1
- with a = 0.?e-151 + 0.618033988749895?*I
+ with a = 0.?e-113 + 0.618033988749895?*I
To: Projective Space of dimension 2 over Number Field in a
with defining polynomial y^4 + 3*y^2 + 1
- with a = 0.?e-151 + 0.618033988749895?*I
+ with a = 0.?e-113 + 0.618033988749895?*I
Defn: Defined on coordinates by sending (x : y) to
(x^2 + (a^3 + 2*a)*x*y + 3*y^2 : y^2 : (2*a^2 + 3)*x*y)

42 changes: 21 additions & 21 deletions srcpkgs/sagemath/patches/38749-pari_2.17.patch
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,20 @@ index 1f6a7a94444..1cf3ccdb611 100644
--- a/src/sage/modular/dirichlet.py
+++ b/src/sage/modular/dirichlet.py
@@ -2395,13 +2395,13 @@ class DirichletGroupFactory(UniqueFactory):
sage: parent(val)
Gaussian Integers generated by zeta4 in Cyclotomic Field of order 4 and degree 2
sage: r4_29_0 = r4.residue_field(r4.ideal(29).factor()[0][0]); r4_29_0(val)
doctest:warning ... DeprecationWarning: ...
sage: r4_29_0 = r4.residue_field(K(29).factor()[0][0]); r4_29_0(val)
- 17
+ 17
+ 12
sage: r4_29_0(val) * GF(29)(3)
- 22
+ 22
+ 7
sage: r4_29_0(G.gens()[2].values_on_gens()[2]) * 3
- 22
+ 22
+ 7
sage: parent(r4_29_0(G.gens()[2].values_on_gens()[2]) * 3)
- Residue field of Fractional ideal (-2*zeta4 + 5)
+ Residue field of Fractional ideal (2*zeta4 - 5)
+ Residue field of Fractional ideal (-2*zeta4 - 5)

::

Expand Down Expand Up @@ -1358,7 +1358,7 @@ index 55db3bbbcbf..8b69baf5464 100644
Class group of order 22 with structure C22 of Number Field in a with defining polynomial x^2 + 5077
sage: G.0 ^ -9
- Fractional ideal class (43, a + 13)
+ Fractional ideal class (43, a + 13)
+ Fractional ideal class (67, a + 45)
sage: Ok = k.maximal_order(); Ok
Maximal Order generated by a in Number Field in a with defining polynomial x^2 + 5077
sage: Ok * (11, a + 7)
Expand All @@ -1376,7 +1376,7 @@ index 55db3bbbcbf..8b69baf5464 100644
with omega = -0.50000000000000000? + 0.866025403784439?*I
sage: factor(3 + omega)
- (-1) * (-omega - 3)
+ (-omega - 1) * (2*omega - 1)
+ (omega + 1) * (-2*omega + 1)
sage: CC(omega)
-0.500000000000000 + 0.866025403784439*I
sage: omega.minpoly()
Expand All @@ -1390,9 +1390,9 @@ index acdf2954fdf..7da6b58a209 100644
sage: [_ideal_generator(K.prime_above(p)) for p in primes(25)]
- [2, 1/2*a - 1/2, -1/2*a - 3/2, 7, -a, 13, 17, 19, 1/2*a + 9/2]
+ [2, 1/2*a - 1/2, -1/2*a - 3/2, 7, a, 13, 17, 19, 1/2*a + 9/2]

"""
try:
return I.gens_reduced()[0]
diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py
index e12977e8464..c5bf39a1c73 100644
--- a/src/sage/rings/polynomial/polynomial_quotient_ring.py
Expand Down Expand Up @@ -1778,7 +1778,7 @@ index eea2e5cc243..cceab500959 100755
"""
r = len(points)
diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py
index 0da080ffdbe..34615bb46b8 100755
index 0da080ffdbe..61b016ca08e 100755
--- a/src/sage/schemes/elliptic_curves/ell_point.py
+++ b/src/sage/schemes/elliptic_curves/ell_point.py
@@ -142,7 +142,6 @@
Expand All @@ -1789,7 +1789,7 @@ index 0da080ffdbe..34615bb46b8 100755
except ImportError:
PariError = ()

@@ -2672,10 +2672,10 @@ def has_good_reduction(self, P=None):
@@ -2672,10 +2671,10 @@ def has_good_reduction(self, P=None):
sage: K.<i> = NumberField(x^2 + 1)
sage: E = EllipticCurve(K, [0,1,0,-160,308])
sage: P = E(26, -120)
Expand All @@ -1804,7 +1804,7 @@ index 0da080ffdbe..34615bb46b8 100755
Fractional ideal (3)]
sage: [E.tamagawa_exponent(p) for p in E.discriminant().support()]
[1, 4, 4, 4]
@@ -3705,7 +3705,7 @@ def elliptic_logarithm(self, embedding=None, precision=100,
@@ -3705,7 +3704,7 @@ def elliptic_logarithm(self, embedding=None, precision=100,
E_pari = E_work.pari_curve()
log_pari = E_pari.ellpointtoz(pt_pari, precision=working_prec)

Expand Down Expand Up @@ -1858,9 +1858,9 @@ index 6be377e2f74..4134ae1b7a6 100644
--- a/src/sage/schemes/elliptic_curves/gp_simon.py
+++ b/src/sage/schemes/elliptic_curves/gp_simon.py
@@ -49,7 +49,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
sage: import sage.schemes.elliptic_curves.gp_simon
sage: E = EllipticCurve('389a1')
sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E)
doctest:warning...:
DeprecationWarning: please use the 2-descent algorithm over QQ inside pari
See https://github.com/sagemath/sage/issues/38461 for details.
- (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)])
+ (2, 2, [(-3/4 : 7/8 : 1), (5/4 : 5/8 : 1)])

Expand Down Expand Up @@ -1946,9 +1946,9 @@ index e09a1f60262..69fe9960c3d 100755
sage: C.has_rational_point(point=True, obstruction=True)
- (False, Fractional ideal (-i - 2))
+ (False, Fractional ideal (i + 2))
sage: C.has_rational_point(algorithm="rnfisnorm")
sage: C.has_rational_point(algorithm='rnfisnorm')
False
sage: C.has_rational_point(algorithm="rnfisnorm", obstruction=True,
sage: C.has_rational_point(algorithm='rnfisnorm', obstruction=True,
@@ -135,7 +135,7 @@ def has_rational_point(self, point=False, obstruction=False,
sage: L.<b> = NumberField(x^3 - 5)
sage: C = Conic(L, [1, 2, -3])
Expand Down Expand Up @@ -1990,12 +1990,12 @@ index 20031e81a41..fcbb0c01e82 100755
Scheme morphism:
From: Projective Space of dimension 1 over Number Field in a
with defining polynomial y^4 + 3*y^2 + 1
- with a = 0.?e-151 + 0.618033988749895?*I
+ with a = 0.?e-165 + 1.618033988749895?*I
- with a = 0.?e-113 + 0.618033988749895?*I
+ with a = 0.?e-166 + 1.618033988749895?*I
To: Projective Space of dimension 2 over Number Field in a
with defining polynomial y^4 + 3*y^2 + 1
- with a = 0.?e-151 + 0.618033988749895?*I
+ with a = 0.?e-165 + 1.618033988749895?*I
- with a = 0.?e-113 + 0.618033988749895?*I
+ with a = 0.?e-166 + 1.618033988749895?*I
Defn: Defined on coordinates by sending (x : y) to
- (x^2 + (a^3 + 2*a)*x*y + 3*y^2 : y^2 : (2*a^2 + 3)*x*y)
+ (x^2 + (-a^3 - 2*a)*x*y + 3*y^2 : y^2 : (-2*a^2 - 3)*x*y)
Expand Down
83 changes: 83 additions & 0 deletions srcpkgs/sagemath/patches/38749-zz-fixup_backport.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
commit d04ef7c387ccf50e8c8daab4034aa2812c64f872
Author: Gonzalo Tornaría <[email protected]>
Date: Sun Nov 3 18:23:36 2024 -0300

fixup backport of #38749

diff --git a/src/sage/rings/number_field/number_field_ideal_rel.py b/src/sage/rings/number_field/number_field_ideal_rel.py
index 75b2ecc69d8..4f52eba6279 100644
--- a/src/sage/rings/number_field/number_field_ideal_rel.py
+++ b/src/sage/rings/number_field/number_field_ideal_rel.py
@@ -380,6 +380,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):

EXAMPLES::

+ sage: pari.setrand(3)
sage: R.<x> = QQ[]
sage: K.<a> = NumberField(x^2 + 6)
sage: L.<b> = K.extension(K['x'].gen()^4 + a)
diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py
index c499bc2812c..c28e3b0a7a9 100644
--- a/src/sage/rings/number_field/order.py
+++ b/src/sage/rings/number_field/order.py
@@ -590,7 +590,7 @@ class Order(IntegralDomain, sage.rings.abc.Order):
sage: k.<a> = NumberField(x^2 + 5077); G = k.class_group(); G
Class group of order 22 with structure C22 of Number Field in a with defining polynomial x^2 + 5077
sage: G.0 ^ -9
- Fractional ideal class (67, a + 45)
+ Fractional ideal class (43, a + 13)
sage: Ok = k.maximal_order(); Ok
Maximal Order generated by a in Number Field in a with defining polynomial x^2 + 5077
sage: Ok * (11, a + 7)
@@ -2994,7 +2994,7 @@ def EisensteinIntegers(names="omega"):
with defining polynomial x^2 + x + 1
with omega = -0.50000000000000000? + 0.866025403784439?*I
sage: factor(3 + omega)
- (omega + 1) * (-2*omega + 1)
+ (-omega - 1) * (2*omega - 1)
sage: CC(omega)
-0.500000000000000 + 0.866025403784439*I
sage: omega.minpoly()
diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
index 0e60ef0f6a2..4c615e75ac9 100644
--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
+++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
@@ -2603,6 +2603,7 @@ class EllipticCurve_number_field(EllipticCurve_field):

EXAMPLES::

+ sage: pari.setrand(1)
sage: K.<i> = QuadraticField(-1)
sage: E = EllipticCurve(K, [0,0,0,0,1])
sage: C = E.isogeny_class(); C
diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py
index fdf6f0852e8..046b635cca8 100644
--- a/src/sage/schemes/elliptic_curves/gp_simon.py
+++ b/src/sage/schemes/elliptic_curves/gp_simon.py
@@ -57,9 +57,6 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
sage: import sage.schemes.elliptic_curves.gp_simon
sage: E = EllipticCurve('389a1')
sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E)
- doctest:warning...:
- DeprecationWarning: please use the 2-descent algorithm over QQ inside pari
- See https://github.com/sagemath/sage/issues/38461 for details.
(2, 2, [(-3/4 : 7/8 : 1), (5/4 : 5/8 : 1)])

TESTS::
diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py
index 5f4512f5be6..2c1c6aef618 100644
--- a/src/sage/schemes/projective/projective_morphism.py
+++ b/src/sage/schemes/projective/projective_morphism.py
@@ -1764,10 +1764,10 @@ class SchemeMorphism_polynomial_projective_space_field(SchemeMorphism_polynomial
Scheme morphism:
From: Projective Space of dimension 1 over Number Field in a
with defining polynomial y^4 + 3*y^2 + 1
- with a = 0.?e-166 + 1.618033988749895?*I
+ with a = 0.?e-165 + 1.618033988749895?*I
To: Projective Space of dimension 2 over Number Field in a
with defining polynomial y^4 + 3*y^2 + 1
- with a = 0.?e-166 + 1.618033988749895?*I
+ with a = 0.?e-165 + 1.618033988749895?*I
Defn: Defined on coordinates by sending (x : y) to
(x^2 + (-a^3 - 2*a)*x*y + 3*y^2 : y^2 : (-2*a^2 - 3)*x*y)

0 comments on commit 63ff858

Please sign in to comment.