sagemath: update to 10.5.

This commit is contained in:
Gonzalo Tornaría 2024-12-19 22:51:49 -03:00 committed by Leah Neukirchen
parent 8723ed4ae0
commit cfd28073b2
21 changed files with 2912 additions and 1177 deletions

View file

@ -1,76 +0,0 @@
diff --git a/build/pkgs/sympy/requirements.txt b/build/pkgs/sympy/requirements.txt
new file mode 100644
index 00000000000..3ef8f90b550
diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py
index 7e9eab2ff2e..43365cd645e 100644
--- a/src/sage/doctest/forker.py
+++ b/src/sage/doctest/forker.py
@@ -150,14 +150,15 @@ def init_sage(controller=None):
sage: from sympy.printing.pretty.pretty import PrettyPrinter
sage: s = sympify('+x^'.join(str(i) for i in range(30)))
sage: print(PrettyPrinter(settings={'wrap_line': True}).doprint(s))
- 29 28 27 26 25 24 23 22 21 20 19 18 17
- x + x + x + x + x + x + x + x + x + x + x + x + x +
+ 29 28 27 26 25 24 23 22 21 20 19 18 17 ↪
+ x + x + x + x + x + x + x + x + x + x + x + x + x + ↪
<BLANKLINE>
- 16 15 14 13 12 11 10 9 8 7 6 5 4 3
- x + x + x + x + x + x + x + x + x + x + x + x + x + x + x
+ ↪ 16 15 14 13 12 11 10 9 8 7 6 5 4 3 ↪
+ ↪ x + x + x + x + x + x + x + x + x + x + x + x + x + x + ↪
<BLANKLINE>
- 2
- + x
+ ↪ 2
+ ↪ x + x
+
The displayhook sorts dictionary keys to simplify doctesting of
dictionary output::
diff --git a/src/sage/functions/hypergeometric.py b/src/sage/functions/hypergeometric.py
index 010c61febe0..bbccbd20032 100644
--- a/src/sage/functions/hypergeometric.py
+++ b/src/sage/functions/hypergeometric.py
@@ -124,7 +124,7 @@
sage: maxima(hypergeometric([1, 1, 1], [3, 3, 3], x)) # needs sage.symbolic
hypergeometric([1,1,1],[3,3,3],_SAGE_VAR_x)
sage: hypergeometric((5, 4), (4, 4), 3)._sympy_() # needs sympy sage.symbolic
- hyper((5, 4), (4, 4), 3)
+ hyper((5,), (4,), 3)
sage: hypergeometric((5, 4), (4, 4), 3)._mathematica_init_() # needs sage.symbolic
'HypergeometricPFQ[{5,4},{4,4},3]'
diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
index a92fe241355..f62311423be 100644
--- a/src/sage/symbolic/expression.pyx
+++ b/src/sage/symbolic/expression.pyx
@@ -1167,7 +1167,7 @@ cdef class Expression(Expression_abc):
sage: unicode_art(SR(13 - I))
13 -
sage: unicode_art(SR(1.3 - I))
- 1.3 -
+ 1.3 - 1.0⋅ⅈ
sage: unicode_art(cos(I))
cosh(1)
diff --git a/src/sage/typeset/ascii_art.py b/src/sage/typeset/ascii_art.py
index 28024405d27..458fa8724a3 100644
--- a/src/sage/typeset/ascii_art.py
+++ b/src/sage/typeset/ascii_art.py
@@ -44,11 +44,12 @@
sage: shell.run_cell('%display ascii_art')
sage: shell.run_cell("i = var('i')") # needs sage.symbolic
sage: shell.run_cell('sum(factorial(i)*x^i, i, 0, 10)') # needs sage.symbolic
- 10 9 8 7 6 5 4 3
- 3628800*x + 362880*x + 40320*x + 5040*x + 720*x + 120*x + 24*x + 6*x
+ 10 9 8 7 6 5 4 3 >
+ 3628800*x + 362880*x + 40320*x + 5040*x + 720*x + 120*x + 24*x + 6*x >
<BLANKLINE>
- 2
- + 2*x + x + 1
+ > 2
+ > + 2*x + x + 1
+
sage: shell.run_cell('3/(7*x)') # needs sage.symbolic
3
---

View file

@ -1,203 +0,0 @@
diff --git a/src/sage/algebras/fusion_rings/fusion_double.py b/src/sage/algebras/fusion_rings/fusion_double.py
index 7ce086f70d0..954513572c3 100644
--- a/src/sage/algebras/fusion_rings/fusion_double.py
+++ b/src/sage/algebras/fusion_rings/fusion_double.py
@@ -133,7 +133,7 @@ class FusionDouble(CombinatorialFreeModule):
sage: G = SmallPermutationGroup(16,9)
sage: F = FusionDouble(G, prefix="b",inject_variables=True)
sage: b13^2 # long time (4s)
- b0 + b2 + b4 + b15 + b16 + b17 + b18 + b24 + b26 + b27
+ b0 + b3 + b4
"""
@staticmethod
diff --git a/src/sage/categories/simplicial_sets.py b/src/sage/categories/simplicial_sets.py
index e714a4571c4..a2b87a729d1 100644
--- a/src/sage/categories/simplicial_sets.py
+++ b/src/sage/categories/simplicial_sets.py
@@ -593,9 +593,9 @@ def _canonical_twisting_operator(self):
sage: X = simplicial_sets.Torus()
sage: d = X._canonical_twisting_operator()
sage: d
- {(s_0 v_0, sigma_1): f3, (sigma_1, s_0 v_0): f2*f3^-1, (sigma_1, sigma_1): f2}
+ {(s_0 v_0, sigma_1): f2, (sigma_1, s_0 v_0): f1*f2^-1, (sigma_1, sigma_1): f1}
sage: list(d.values())[0].parent()
- Multivariate Laurent Polynomial Ring in f2, f3 over Integer Ring
+ Multivariate Laurent Polynomial Ring in f1, f2 over Integer Ring
sage: Y = simplicial_sets.RealProjectiveSpace(2)
sage: d2 = Y._canonical_twisting_operator()
sage: d2
@@ -677,10 +677,10 @@ def twisted_chain_complex(self, twisting_operator=None, dimensions=None, augment
sage: X = simplicial_sets.Torus()
sage: C = X.twisted_chain_complex()
sage: C.differential(1)
- [ f3 - 1 f2*f3^-1 - 1 f2 - 1]
+ [ f2 - 1 f1*f2^-1 - 1 f1 - 1]
sage: C.differential(2)
- [ 1 f2*f3^-1]
- [ f3 1]
+ [ 1 f1*f2^-1]
+ [ f2 1]
[ -1 -1]
sage: C.differential(3)
[]
@@ -848,29 +848,29 @@ def twisted_homology(self, n, reduced=False):
sage: # needs sage.graphs
sage: Y = simplicial_sets.Torus()
sage: Y.twisted_homology(1)
- Quotient module by Submodule of Ambient free module of rank 5 over the integral domain Multivariate Polynomial Ring in f2, f2inv, f3, f3inv over Integer Ring
+ Quotient module by Submodule of Ambient free module of rank 5 over the integral domain Multivariate Polynomial Ring in f1, f1inv, f2, f2inv over Integer Ring
Generated by the rows of the matrix:
[ 1 0 0 0 0]
[ 0 1 0 0 0]
[ 0 0 1 0 0]
[ 0 0 0 1 0]
[ 0 0 0 0 1]
+ [f1*f1inv - 1 0 0 0 0]
+ [ 0 f1*f1inv - 1 0 0 0]
+ [ 0 0 f1*f1inv - 1 0 0]
+ [ 0 0 0 f1*f1inv - 1 0]
+ [ 0 0 0 0 f1*f1inv - 1]
[f2*f2inv - 1 0 0 0 0]
[ 0 f2*f2inv - 1 0 0 0]
[ 0 0 f2*f2inv - 1 0 0]
[ 0 0 0 f2*f2inv - 1 0]
[ 0 0 0 0 f2*f2inv - 1]
- [f3*f3inv - 1 0 0 0 0]
- [ 0 f3*f3inv - 1 0 0 0]
- [ 0 0 f3*f3inv - 1 0 0]
- [ 0 0 0 f3*f3inv - 1 0]
- [ 0 0 0 0 f3*f3inv - 1]
sage: Y.twisted_homology(2)
- Quotient module by Submodule of Ambient free module of rank 0 over the integral domain Multivariate Polynomial Ring in f2, f2inv, f3, f3inv over Integer Ring
+ Quotient module by Submodule of Ambient free module of rank 0 over the integral domain Multivariate Polynomial Ring in f1, f1inv, f2, f2inv over Integer Ring
Generated by the rows of the matrix:
[]
sage: Y.twisted_homology(1, reduced=True)
- Quotient module by Submodule of Ambient free module of rank 5 over the integral domain Multivariate Polynomial Ring in f2, f2inv, f3, f3inv over Integer Ring
+ Quotient module by Submodule of Ambient free module of rank 5 over the integral domain Multivariate Polynomial Ring in f1, f1inv, f2, f2inv over Integer Ring
Generated by the rows of the matrix:
[1 0 0 0 0]
[0 1 0 0 0]
diff --git a/src/sage/combinat/matrices/latin.py b/src/sage/combinat/matrices/latin.py
index 936edcc6ea4..c06a53d9afd 100644
--- a/src/sage/combinat/matrices/latin.py
+++ b/src/sage/combinat/matrices/latin.py
@@ -2453,7 +2453,7 @@ def p3_group_bitrade_generators(p):
EXAMPLES::
sage: from sage.combinat.matrices.latin import *
- sage: p3_group_bitrade_generators(3)
+ sage: p3_group_bitrade_generators(3) # random output
((2,6,7)(3,8,9),
(1,2,3)(4,7,8)(5,6,9),
(1,9,2)(3,7,4)(5,8,6),
diff --git a/src/sage/groups/cubic_braid.py b/src/sage/groups/cubic_braid.py
index 257b400f1c7..36423c756aa 100644
--- a/src/sage/groups/cubic_braid.py
+++ b/src/sage/groups/cubic_braid.py
@@ -282,7 +282,7 @@ def _richcmp_(self, other, op):
EXAMPLES::
sage: CBG3 = CubicBraidGroup(3)
- sage: sorted(CBG3) # indirect doctest
+ sage: sorted(CBG3) # indirect doctest, random output
[(c0*c1^-1)^2, c0*c1^-1*c0, c0^-1*c1*c0^-1, c0^-1*c1^-1*c0,
c1*c0^-1*c1, c0^-1*c1^-1*c0^-1, c0^-1*c1^-1, c1^-1*c0*c1^-1,
c0*c1^-1*c0^-1, c0^-1*c1, c0^-1*c1*c0, c0*c1^-1, c1*c0^-1,
diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py
index 4bb52ee4efb..85f572fac6c 100644
--- a/src/sage/groups/finitely_presented.py
+++ b/src/sage/groups/finitely_presented.py
@@ -1344,8 +1344,8 @@ def abelianization_map(self):
sage: H = G.quotient([g1^2, g2*g1*g2^(-1)*g1^(-1), g1*g3^(-2), g0^4])
sage: H.abelianization_map()
Group morphism:
- From: Finitely presented group < g0, g1, g2, g3 | g1^2, g2*g1*g2^-1*g1^-1, g1*g3^-2, g0^4 >
- To: Finitely presented group < f2, f3, f4 | f2^-1*f3^-1*f2*f3, f2^-1*f4^-1*f2*f4, f3^-1*f4^-1*f3*f4, f2^4, f3^4 >
+ From: Finitely presented group < g0, g1, g2, g3 | g1^2, g2*g1*g2^-1*g1^-1, g1*g3^-2, g0^4 >
+ To: Finitely presented group < f1, f2, f3 | f1^4, f2^-1*f1^-1*f2*f1, f2^4, f3^-1*f1^-1*f3*f1, f3^-1*f2^-1*f3*f2 >
sage: g = FreeGroup(0) / []
sage: g.abelianization_map()
Group endomorphism of Finitely presented group < | >
@@ -1394,10 +1394,10 @@ def abelianization_to_algebra(self, ring=QQ):
Defining g0, g1, g2, g3
sage: H = G.quotient([g1^2, g2*g1*g2^(-1)*g1^(-1), g1*g3^(-2), g0^4])
sage: H.abelianization_to_algebra()
- (Finitely presented group < f2, f3, f4 | f2^-1*f3^-1*f2*f3, f2^-1*f4^-1*f2*f4,
- f3^-1*f4^-1*f3*f4, f2^4, f3^4 >,
- Multivariate Laurent Polynomial Ring in f2, f3, f4 over Rational Field,
- [f2^4 - 1, f3^4 - 1], [f2^-1*f3^-2, f3^-2, f4, f3])
+ (Finitely presented group < f1, f2, f3 | f1^4, f2^-1*f1^-1*f2*f1, f2^4, f3^-1*f1^-1*f3*f1, f3^-1*f2^-1*f3*f2 >,
+ Multivariate Laurent Polynomial Ring in f1, f2, f3 over Rational Field,
+ [f1^4 - 1, f2^4 - 1],
+ [f1^3*f2^2, f2^2, f3, f2])
sage: g=FreeGroup(0) / []
sage: g.abelianization_to_algebra()
(Finitely presented group < | >, Rational Field, [], [])
@@ -1673,7 +1673,7 @@ def abelian_alexander_matrix(self, ring=QQ, simplified=True):
[]
sage: G = FreeGroup(3)/[(2, 1, 1), (1, 2, 2, 3, 3)]
sage: A, ideal = G.abelian_alexander_matrix(simplified=True); A
- [-f3^2 - f3^4 - f3^6 f3^3 + f3^6]
+ [-f1^2 - f1^4 - f1^6 f1^3 + f1^6]
sage: g = FreeGroup(1) / []
sage: g.abelian_alexander_matrix()
([], [])
@@ -1773,11 +1773,11 @@ def characteristic_varieties(self, ring=QQ, matrix_ideal=None, groebner=False):
3: Ideal (1) of Multivariate Laurent Polynomial Ring in f1, f2 over Integer Ring}
sage: G = FreeGroup(2)/[(1,2,1,-2,-1,-2)]
sage: G.characteristic_varieties()
- {0: Ideal (0) of Univariate Laurent Polynomial Ring in f2 over Rational Field,
- 1: Ideal (-1 + 2*f2 - 2*f2^2 + f2^3) of Univariate Laurent Polynomial Ring in f2 over Rational Field,
- 2: Ideal (1) of Univariate Laurent Polynomial Ring in f2 over Rational Field}
+ {0: Ideal (0) of Univariate Laurent Polynomial Ring in f1 over Rational Field,
+ 1: Ideal (-1 + 2*f1 - 2*f1^2 + f1^3) of Univariate Laurent Polynomial Ring in f1 over Rational Field,
+ 2: Ideal (1) of Univariate Laurent Polynomial Ring in f1 over Rational Field}
sage: G.characteristic_varieties(groebner=True)
- {0: [0], 1: [-1 + f2, 1 - f2 + f2^2], 2: []}
+ {0: [0], 1: [-1 + f1, 1 - f1 + f1^2], 2: []}
sage: G = FreeGroup(2)/[3 * (1, ), 2 * (2, )]
sage: G.characteristic_varieties(groebner=True)
{0: [-1 + F1, 1 + F1, 1 - F1 + F1^2, 1 + F1 + F1^2], 1: [1 - F1 + F1^2], 2: []}
diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py
index c1f2683907b..d219e104a2c 100644
--- a/src/sage/groups/perm_gps/permgroup_named.py
+++ b/src/sage/groups/perm_gps/permgroup_named.py
@@ -3468,16 +3468,14 @@ class SmallPermutationGroup(PermutationGroup_generic):
sage: G = SmallPermutationGroup(12,4); G
Group of order 12 and GAP Id 4 as a permutation group
sage: G.gens()
- ((1,2)(3,5)(4,10)(6,8)(7,12)(9,11),
- (1,3)(2,5)(4,7)(6,9)(8,11)(10,12),
- (1,4,8)(2,6,10)(3,7,11)(5,9,12))
+ ((4,5), (1,2), (3,4,5))
sage: G.character_table() # needs sage.rings.number_field
[ 1 1 1 1 1 1]
- [ 1 -1 -1 1 1 -1]
+ [ 1 -1 1 -1 1 -1]
[ 1 -1 1 1 -1 1]
- [ 1 1 -1 1 -1 -1]
- [ 2 0 -2 -1 0 1]
- [ 2 0 2 -1 0 -1]
+ [ 1 1 1 -1 -1 -1]
+ [ 2 0 -1 -2 0 1]
+ [ 2 0 -1 2 0 -1]
sage: def numgps(n): return ZZ(libgap.NumberSmallGroups(n))
sage: all(SmallPermutationGroup(n,k).id() == [n,k]
....: for n in [1..64] for k in [1..numgps(n)])
@@ -3486,11 +3484,11 @@ class SmallPermutationGroup(PermutationGroup_generic):
sage: H.is_abelian()
False
sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()]
- [Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of
+ [Subgroup generated by [(1,3), (2,3)] of
(Group of order 6 and GAP Id 1 as a permutation group),
- Subgroup generated by [(1,2)(3,6)(4,5)] of
+ Subgroup generated by [(2,3)] of
(Group of order 6 and GAP Id 1 as a permutation group),
- Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of
+ Subgroup generated by [(1,2,3)] of
(Group of order 6 and GAP Id 1 as a permutation group)]
"""

View file

@ -1,587 +0,0 @@
diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py
index 28f81d7b798..d184c52bf19 100644
--- a/src/sage/arith/misc.py
+++ b/src/sage/arith/misc.py
@@ -2277,7 +2277,7 @@ def power_mod(a, n, m):
sage: from numpy import int32 # needs numpy
sage: power_mod(int32(2), int32(390), int32(391)) # needs numpy
- 285
+ ...285...
sage: from gmpy2 import mpz
sage: power_mod(mpz(2), mpz(390), mpz(391))
mpz(285)
diff --git a/src/sage/calculus/interpolators.pyx b/src/sage/calculus/interpolators.pyx
index 221b52369e2..bb0be7bab0c 100644
--- a/src/sage/calculus/interpolators.pyx
+++ b/src/sage/calculus/interpolators.pyx
@@ -27,6 +27,9 @@ Development supported by NSF award No. 0702939.
import numpy as np
cimport numpy as np
+if int(np.version.short_version[0]) > 1:
+ np.set_printoptions(legacy="1.25")
+
from math import pi
cdef double TWOPI = 2*pi
diff --git a/src/sage/calculus/riemann.pyx b/src/sage/calculus/riemann.pyx
index 6ec80d89aa7..c09d93c4260 100644
--- a/src/sage/calculus/riemann.pyx
+++ b/src/sage/calculus/riemann.pyx
@@ -44,6 +44,9 @@ from sage.calculus.integration import numerical_integral
import numpy as np
cimport numpy as np
+if int(np.version.short_version[0]) > 1:
+ np.set_printoptions(legacy="1.25")
+
from math import pi
from math import sin
from math import cos
diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py
index b198fed0c0d..b3ebd206cd2 100644
--- a/src/sage/combinat/fully_packed_loop.py
+++ b/src/sage/combinat/fully_packed_loop.py
@@ -66,6 +66,9 @@ def _make_color_list(n, colors=None, color_map=None, randomize=False):
r"""
TESTS::
+ sage: import numpy as np
+ sage: if int(np.version.short_version[0]) > 1:
+ ....: np.set_printoptions(legacy="1.25")
sage: from sage.combinat.fully_packed_loop import _make_color_list
sage: _make_color_list(5)
sage: _make_color_list(5, ['blue', 'red'])
diff --git a/src/sage/env.py b/src/sage/env.py
index 722649ab3da..abb9b19f9e3 100644
--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -296,7 +296,7 @@ def sage_include_directories(use_sources=False):
sage: import sage.env
sage: sage.env.sage_include_directories()
['...',
- '.../numpy/core/include',
+ '.../numpy/...core/include',
'.../include/python...']
To check that C/C++ files are correctly found, we verify that we can
diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py
index e100ba3ee23..2a03bb68f67 100644
--- a/src/sage/functions/special.py
+++ b/src/sage/functions/special.py
@@ -217,6 +217,9 @@ class SphericalHarmonic(BuiltinFunction):
sage: spherical_harmonic(1, 1, pi/2, pi).n() # abs tol 1e-14 # needs sage.symbolic
0.345494149471335
sage: from scipy.special import sph_harm # NB: arguments x and y are swapped # needs scipy
+ sage: import numpy as np # needs scipy
+ sage: if int(np.version.short_version[0]) > 1: # needs scipy
+ ....: np.set_printoptions(legacy="1.25") # needs scipy
sage: sph_harm(1, 1, pi.n(), (pi/2).n()) # abs tol 1e-14 # needs scipy sage.symbolic
(0.3454941494713355-4.231083042742082e-17j)
diff --git a/src/sage/graphs/generators/classical_geometries.py b/src/sage/graphs/generators/classical_geometries.py
index da04362eef3..957f88d2061 100644
--- a/src/sage/graphs/generators/classical_geometries.py
+++ b/src/sage/graphs/generators/classical_geometries.py
@@ -1315,7 +1315,7 @@ def CossidentePenttilaGraph(q):
from sage.libs.gap.libgap import libgap
adj_list = libgap.function_factory("""function(q)
- local z, e, so, G, nu, G1, G0, B, T, s, O1, O2, x;
+ local z, e, so, G, nu, G1, G0, B, T, s, O1, O2, x, sqo;
LoadPackage("grape");
G0:=SO(3,q^2);
so:=GeneratorsOfGroup(G0);
diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py
index 063931ae274..0bafbd00564 100644
--- a/src/sage/graphs/generic_graph.py
+++ b/src/sage/graphs/generic_graph.py
@@ -18420,6 +18420,9 @@ def shortest_path_all_pairs(self, by_weight=False, algorithm=None,
M = self.adjacency_matrix(vertices=int_to_vertex)
# We call the Floyd-Warshall method from SciPy
+ import numpy # to ensure numpy 2.0 compatibility
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
from numpy import array as np_array
from scipy.sparse.csgraph import floyd_warshall
dd, pp = floyd_warshall(np_array(M), directed=self.is_directed(),
diff --git a/src/sage/graphs/graph_generators_pyx.pyx b/src/sage/graphs/graph_generators_pyx.pyx
index 033e8b22adc..04b20d3229b 100644
--- a/src/sage/graphs/graph_generators_pyx.pyx
+++ b/src/sage/graphs/graph_generators_pyx.pyx
@@ -57,7 +57,7 @@ def RandomGNP(n, p, bint directed=False, bint loops=False, seed=None):
sage: from numpy import mean # needs numpy
sage: abs(mean([RandomGNP(200, .2).density() for i in range(30)]) - .2) < .001 # needs numpy
- True
+ ...True...
sage: RandomGNP(150, .2, loops=True)
Traceback (most recent call last):
...
diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx
index a810418389c..c38df5412f0 100644
--- a/src/sage/matrix/matrix1.pyx
+++ b/src/sage/matrix/matrix1.pyx
@@ -705,12 +705,15 @@ cdef class Matrix(Matrix0):
Type ``numpy.typecodes`` for a list of the possible
typecodes::
- sage: import numpy # needs numpy
- sage: sorted(numpy.typecodes.items()) # needs numpy
+ sage: import numpy # needs numpy
+ sage: numpy.typecodes.items() # needs numpy # random
[('All', '?bhilqpBHILQPefdgFDGSUVOMm'), ('AllFloat', 'efdgFDG'),
- ('AllInteger', 'bBhHiIlLqQpP'), ('Character', 'c'), ('Complex', 'FDG'),
- ('Datetime', 'Mm'), ('Float', 'efdg'), ('Integer', 'bhilqp'),
- ('UnsignedInteger', 'BHILQP')]
+ ...
+
+ For instance, you can see possibilities for real floating point numbers::
+
+ sage: numpy.typecodes['Float'] # needs numpy
+ 'efdg'
Alternatively, numpy automatically calls this function (via
the magic :meth:`__array__` method) to convert Sage matrices
diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx
index d71d22ac1f7..b6f297a3510 100644
--- a/src/sage/modules/free_module_element.pyx
+++ b/src/sage/modules/free_module_element.pyx
@@ -555,7 +555,11 @@ def vector(arg0, arg1=None, arg2=None, sparse=None, immutable=False):
R = None
try:
+ import numpy
from numpy import ndarray
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
+
except ImportError:
pass
else:
@@ -1188,7 +1192,11 @@ cdef class FreeModuleElement(Vector): # abstract base class
over Rational Field to numpy array of type <... 'float'>:
setting an array element with a sequence.
"""
+ import numpy
from numpy import array
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
+
try:
return array(self, dtype=dtype)
except ValueError as e:
diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py
index e3d94d1746e..7ae8ca4966f 100644
--- a/src/sage/numerical/optimize.py
+++ b/src/sage/numerical/optimize.py
@@ -155,6 +155,10 @@ def find_root(f, a, b, xtol=10e-13, rtol=2.0**-50, maxiter=100, full_output=Fals
b = max(s_1, s_2)
import scipy.optimize
+ import numpy
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
+
g = lambda x: float(f(x))
brentqRes = scipy.optimize.brentq(g, a, b,
full_output=full_output, xtol=xtol, rtol=rtol, maxiter=maxiter)
@@ -288,6 +292,10 @@ def find_local_minimum(f, a, b, tol=1.48e-08, maxfun=500):
a = float(a)
b = float(b)
import scipy.optimize
+ import numpy
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
+
xmin, fval, iter, funcalls = scipy.optimize.fminbound(f, a, b, full_output=1, xtol=tol, maxfun=maxfun)
return fval, xmin
@@ -376,6 +384,8 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default",
sage: def rosen(x): # The Rosenbrock function
....: return sum(100.0r*(x[1r:]-x[:-1r]**2.0r)**2.0r + (1r-x[:-1r])**2.0r)
sage: import numpy
+ sage: if int(numpy.version.short_version[0]) > 1:
+ ....: numpy.set_printoptions(legacy="1.25")
sage: from numpy import zeros
sage: def rosen_der(x):
....: xm = x[1r:-1r]
@@ -393,6 +403,9 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default",
from sage.structure.element import Expression
from sage.ext.fast_callable import fast_callable
import numpy
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
+
from scipy import optimize
if isinstance(func, Expression):
var_list = func.variables()
@@ -530,6 +543,8 @@ def minimize_constrained(func,cons,x0,gradient=None,algorithm='default', **args)
from sage.structure.element import Expression
from sage.ext.fast_callable import fast_callable
import numpy
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
from scipy import optimize
function_type = type(lambda x,y: x+y)
@@ -652,6 +667,8 @@ def find_fit(data, model, initial_guess=None, parameters=None, variables=None, s
``lmdif`` and ``lmder`` algorithms.
"""
import numpy
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
if not isinstance(data, numpy.ndarray):
try:
diff --git a/src/sage/plot/arrow.py b/src/sage/plot/arrow.py
index ac1dc79d802..23e2517ca56 100644
--- a/src/sage/plot/arrow.py
+++ b/src/sage/plot/arrow.py
@@ -53,6 +53,9 @@ def get_minmax_data(self):
EXAMPLES::
+ sage: import numpy # to ensure numpy 2.0 compatibility
+ sage: if int(numpy.version.short_version[0]) > 1:
+ ....: numpy.set_printoptions(legacy="1.25")
sage: from sage.plot.arrow import CurveArrow
sage: b = CurveArrow(path=[[(0,0),(.5,.5),(1,0)],[(.5,1),(0,0)]],
....: options={})
diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
index f1f2671a803..4d71414e1c2 100644
--- a/src/sage/plot/complex_plot.pyx
+++ b/src/sage/plot/complex_plot.pyx
@@ -1282,15 +1282,13 @@ def rgb_to_hls(rgb):
raise ValueError("Last dimension of input array must be 3; "
"shape {} was found.".format(rgb.shape))
in_shape = rgb.shape
- rgb = np.array(
- rgb, copy=False, dtype=np.dtype(float), ndmin=2
- )
+ rgb = np.asarray(rgb, dtype=np.dtype(float))
rgb_max = rgb.max(-1)
rgb_min = rgb.min(-1)
l = (rgb_max + rgb_min)/2.0 # lightness
hls = np.zeros_like(rgb)
- delta = rgb.ptp(-1)
+ delta = np.ptp(rgb, -1)
s = np.zeros_like(delta)
ipos = delta > 0
diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py
index a84d162cb56..94f5db09d83 100644
--- a/src/sage/plot/graphics.py
+++ b/src/sage/plot/graphics.py
@@ -2754,7 +2754,7 @@ def matplotlib(self, filename=None,
sage: xmin, xmax = sub.get_xlim()
sage: ymin, ymax = sub.get_ylim()
sage: xmin > xmax, ymin > ymax
- (True, True)
+ (...True..., ...True...)
"""
if not isinstance(ticks, (list, tuple)):
ticks = (ticks, None)
diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
index fa86a44bd0a..a585cacf9cd 100644
--- a/src/sage/plot/histogram.py
+++ b/src/sage/plot/histogram.py
@@ -92,6 +92,8 @@ def get_minmax_data(self):
{'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
"""
import numpy
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
# Extract these options (if they are not None) and pass them to
# histogram()
diff --git a/src/sage/plot/multigraphics.py b/src/sage/plot/multigraphics.py
index b583be32317..6be448f1e04 100644
--- a/src/sage/plot/multigraphics.py
+++ b/src/sage/plot/multigraphics.py
@@ -784,6 +784,9 @@ def _add_subplot(self, figure, index, **options):
True
sage: G.position(1)
(0.2, 0.3, 0.4, 0.1)
+ sage: import numpy # to ensure numpy 2.0 compatibility
+ sage: if int(numpy.version.short_version[0]) > 1:
+ ....: numpy.set_printoptions(legacy="1.25")
sage: ax1.get_position().bounds # tol 1.0e-13
(0.2, 0.3, 0.4000000000000001, 0.10000000000000003)
@@ -1295,6 +1298,9 @@ def position(self, index):
sage: g1 = plot(sin(x), (x, -pi, pi))
sage: g2 = circle((0,1), 1.)
sage: G = graphics_array([g1, g2])
+ sage: import numpy # to ensure numpy 2.0 compatibility
+ sage: if int(numpy.version.short_version[0]) > 1:
+ ....: numpy.set_printoptions(legacy="1.25")
sage: G.position(0) # tol 5.0e-3
(0.025045451349937315,
0.03415488992713045,
diff --git a/src/sage/plot/plot3d/implicit_surface.pyx b/src/sage/plot/plot3d/implicit_surface.pyx
index ce0da48a4e0..f4d5059b620 100644
--- a/src/sage/plot/plot3d/implicit_surface.pyx
+++ b/src/sage/plot/plot3d/implicit_surface.pyx
@@ -468,6 +468,7 @@ cdef class MarchingCubesTriangles(MarchingCubes):
sage: cube_marcher.y_vertices.tolist()
[[[<1.0, 0.5, 0.0>, None]], [[None, None]]]
sage: cube_marcher.x_vertices.any() # This shouldn't affect the X vertices.
+ ...
"""
(self.y_vertices, self.y_vertices_swapped) = \
(self.y_vertices_swapped, self.y_vertices)
@@ -574,6 +575,7 @@ cdef class MarchingCubesTriangles(MarchingCubes):
sage: cube_marcher.x_vertices.tolist()
[[None, None], [None, <1.5, 1.0, 1.0>]]
sage: cube_marcher.y_vertices.any() or cube_marcher.z_vertices.any() # This shouldn't affect the Y or Z vertices.
+ ...
"""
cdef bint has_prev = (_prev is not None)
cdef bint has_next = (_next is not None)
diff --git a/src/sage/plot/scatter_plot.py b/src/sage/plot/scatter_plot.py
index 4ad418f040b..781854d372c 100644
--- a/src/sage/plot/scatter_plot.py
+++ b/src/sage/plot/scatter_plot.py
@@ -63,9 +63,9 @@ def get_minmax_data(self):
sage: s = scatter_plot([[0,1],[2,4],[3.2,6]])
sage: d = s.get_minmax_data()
sage: d['xmin']
- 0.0
+ ...0.0...
sage: d['ymin']
- 1.0
+ ...1.0...
"""
return {'xmin': self.xdata.min(),
'xmax': self.xdata.max(),
diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py
index 663d3aee70b..d2cb11088c7 100644
--- a/src/sage/plot/streamline_plot.py
+++ b/src/sage/plot/streamline_plot.py
@@ -71,6 +71,9 @@ def get_minmax_data(self):
EXAMPLES::
sage: x, y = var('x y')
+ sage: import numpy # to ensure numpy 2.0 compatibility
+ sage: if int(numpy.version.short_version[0]) > 1:
+ ....: numpy.set_printoptions(legacy="1.25")
sage: d = streamline_plot((.01*x, x+y), (x,10,20), (y,10,20))[0].get_minmax_data()
sage: d['xmin']
10.0
diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx
index e2c71af9c25..59ba4a95ab6 100644
--- a/src/sage/probability/probability_distribution.pyx
+++ b/src/sage/probability/probability_distribution.pyx
@@ -140,6 +140,9 @@ cdef class ProbabilityDistribution:
1.8,
2.0]
"""
+ import numpy as np
+ if int(np.version.short_version[0]) > 1:
+ np.set_printoptions(legacy="1.25")
import pylab
ell = [float(self.get_random_element()) for _ in range(num_samples)]
S = pylab.hist(ell, bins, density=True)
diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx
index c59a2b46d6f..b4dddebb4dc 100644
--- a/src/sage/rings/complex_double.pyx
+++ b/src/sage/rings/complex_double.pyx
@@ -2558,10 +2558,10 @@ cdef class ComplexToCDF(Morphism):
sage: # needs numpy
sage: import numpy
- sage: f = CDF.coerce_map_from(numpy.complex_)
- sage: f(numpy.complex_(I))
+ sage: f = CDF.coerce_map_from(numpy.complex128)
+ sage: f(numpy.complex128(I))
1.0*I
- sage: f(numpy.complex_(I)).parent()
+ sage: f(numpy.complex128(I)).parent()
Complex Double Field
"""
def __init__(self, R):
@@ -2578,7 +2578,7 @@ cdef class ComplexToCDF(Morphism):
EXAMPLES::
sage: import numpy # needs numpy
- sage: CDF(numpy.complex_(I)) # indirect doctest # needs numpy
+ sage: CDF(numpy.complex128(I)) # indirect doctest # needs numpy
1.0*I
"""
cdef ComplexDoubleElement z = <ComplexDoubleElement>ComplexDoubleElement.__new__(ComplexDoubleElement)
@@ -2592,7 +2592,7 @@ cdef class ComplexToCDF(Morphism):
EXAMPLES::
sage: import numpy # needs numpy
- sage: f = sage.rings.complex_double.ComplexToCDF(numpy.complex_) # needs numpy
+ sage: f = sage.rings.complex_double.ComplexToCDF(numpy.complex128) # needs numpy
sage: f._repr_type() # needs numpy
'Native'
"""
diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx
index b4a1fa5039b..38c30f7627b 100644
--- a/src/sage/rings/integer.pyx
+++ b/src/sage/rings/integer.pyx
@@ -593,6 +593,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
Test comparisons with numpy types (see :issue:`13386` and :issue:`18076`)::
sage: import numpy # needs numpy
+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
sage: numpy.int8('12') == 12 # needs numpy
True
sage: 12 == numpy.int8('12') # needs numpy
diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx
index dcf2af7cdf2..c87eccd44f1 100644
--- a/src/sage/rings/polynomial/polynomial_element.pyx
+++ b/src/sage/rings/polynomial/polynomial_element.pyx
@@ -8851,7 +8851,7 @@ cdef class Polynomial(CommutativePolynomial):
'you expect.')
import numpy
- from numpy.linalg.linalg import LinAlgError
+ from numpy.linalg import LinAlgError
from sage.rings.complex_double import CDF
numpy_dtype = ('complex' if input_complex else 'double')
diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx
index 95b472e912c..76fbfedab95 100644
--- a/src/sage/rings/real_mpfi.pyx
+++ b/src/sage/rings/real_mpfi.pyx
@@ -231,6 +231,8 @@ specified if given a non-interval and an interval::
TESTS::
sage: import numpy # needs numpy
+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
sage: RIF(2) == numpy.int8('2') # needs numpy
True
sage: numpy.int8('2') == RIF(2) # needs numpy
diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
index 8f240627e77..70ce616f92f 100644
--- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
+++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
@@ -77,6 +77,8 @@ cdef class PeriodicRegion:
EXAMPLES::
sage: import numpy as np
+ sage: if int(np.version.short_version[0]) > 1:
+ ....: np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((4, 4))
sage: PeriodicRegion(CDF(2), CDF(2*I), data).is_empty()
@@ -295,6 +297,8 @@ cdef class PeriodicRegion:
EXAMPLES::
sage: import numpy as np
+ sage: if int(np.version.short_version[0]) > 1:
+ ....: np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((10, 10))
sage: data[1:4,1:4] = True
@@ -317,6 +321,8 @@ cdef class PeriodicRegion:
EXAMPLES::
sage: import numpy as np
+ sage: if int(np.version.short_version[0]) > 1:
+ ....: np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((4, 4))
sage: data[1,1] = True
@@ -370,6 +376,8 @@ cdef class PeriodicRegion:
EXAMPLES::
sage: import numpy as np
+ sage: if int(np.version.short_version[0]) > 1:
+ ....: np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((20, 20))
@@ -520,6 +528,8 @@ cdef class PeriodicRegion:
TESTS::
sage: import numpy as np
+ sage: if int(np.version.short_version[0]) > 1:
+ ....: np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((4, 4))
sage: data[1, 1] = True
diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py
index b2e6b301bf7..6937f6cb410 100644
--- a/src/sage/stats/basic_stats.py
+++ b/src/sage/stats/basic_stats.py
@@ -227,6 +227,8 @@ def std(v, bias=False):
sage: # needs numpy
sage: import numpy
+ sage: if int(numpy.version.short_version[0]) > 1:
+ ....: numpy.set_printoptions(legacy="1.25")
sage: x = numpy.array([1,2,3,4,5])
sage: std(x, bias=False)
1.5811388300841898
@@ -304,6 +306,8 @@ def variance(v, bias=False):
sage: variance([RIF(1.0103, 1.0103), RIF(2)])
0.4897530450000000?
sage: import numpy # needs numpy
+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
sage: x = numpy.array([1,2,3,4,5]) # needs numpy
sage: variance(x, bias=False) # needs numpy
2.5
diff --git a/src/sage/stats/time_series.pyx b/src/sage/stats/time_series.pyx
index 2e22ec45c69..23adae84fb4 100644
--- a/src/sage/stats/time_series.pyx
+++ b/src/sage/stats/time_series.pyx
@@ -1718,6 +1718,8 @@ cdef class TimeSeries:
if len(v0) == 1:
return v1[0]/v0[0]
import numpy
+ if int(numpy.version.short_version[0]) > 1:
+ numpy.set_printoptions(legacy="1.25")
coeffs = numpy.polyfit(v0,v1,1)
return coeffs[0]
diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx
index dfbd5ff82fa..955a256e9b4 100644
--- a/src/sage/structure/coerce.pyx
+++ b/src/sage/structure/coerce.pyx
@@ -520,6 +520,8 @@ cdef class CoercionModel:
Check that :issue:`8426` is fixed (see also :issue:`18076`)::
sage: import numpy # needs numpy
+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
sage: # needs sage.rings.real_mpfr
sage: x = polygen(RR)
diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
index 2cb2f09c715..cd89ad2a256 100644
--- a/src/sage/symbolic/function.pyx
+++ b/src/sage/symbolic/function.pyx
@@ -964,6 +964,9 @@ cdef class BuiltinFunction(Function):
mpc(real='0.83373002513114902', imag='-0.98889770576286506')
sage: import numpy # needs numpy
+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+
sage: sin(numpy.int32(0)) # needs numpy
0.0
sage: type(_) # needs numpy
diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx
index 501b0920898..5b007d9e5fd 100644
--- a/src/sage/symbolic/ring.pyx
+++ b/src/sage/symbolic/ring.pyx
@@ -1162,6 +1162,8 @@ cdef class NumpyToSRMorphism(Morphism):
We check that :issue:`8949` and :issue:`9769` are fixed (see also :issue:`18076`)::
sage: import numpy # needs numpy
+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy
sage: f(x) = x^2
sage: f(numpy.int8('2')) # needs numpy
4

View file

@ -1,43 +0,0 @@
diff --git a/src/sage/interfaces/ecm.py b/src/sage/interfaces/ecm.py
index 99287dec718..98011970404 100644
--- a/src/sage/interfaces/ecm.py
+++ b/src/sage/interfaces/ecm.py
@@ -508,7 +508,6 @@ def _find_factor(self, n, factor_digits, B1, **kwds):
"""
n = self._validate(n)
kwds.setdefault('c', 1000000000)
- kwds.setdefault('I', 1)
if factor_digits is not None:
B1 = self.recommended_B1(factor_digits)
kwds['one'] = True
diff --git a/src/sage/libs/libecm.pyx b/src/sage/libs/libecm.pyx
index 886a9b816e4..83fb7adaf8d 100644
--- a/src/sage/libs/libecm.pyx
+++ b/src/sage/libs/libecm.pyx
@@ -149,11 +149,13 @@ def ecmfactor(number, double B1, verbose=False, sigma=0):
Some special cases::
sage: ecmfactor(1, 100)
- (True, 1, ...)
+ Traceback (most recent call last):
+ ...
+ ValueError: Input number (1) must be greater than 1
sage: ecmfactor(0, 100)
Traceback (most recent call last):
...
- ValueError: Input number (0) must be positive
+ ValueError: Input number (0) must be greater than 1
"""
cdef mpz_t n, f
cdef int res
@@ -164,8 +166,8 @@ def ecmfactor(number, double B1, verbose=False, sigma=0):
sage_int_number = Integer(number)
sage_int_sigma = Integer(sigma)
- if number <= 0:
- raise ValueError("Input number (%s) must be positive"%number)
+ if number <= 1:
+ raise ValueError("Input number (%s) must be greater than 1"%number)
if verbose:
print("Performing one curve with B1=%1.0f" % B1)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,73 @@
diff --git a/src/sage/categories/simplicial_sets.py b/src/sage/categories/simplicial_sets.py
index 76030be831b..f30ed0ffeb2 100644
--- a/src/sage/categories/simplicial_sets.py
+++ b/src/sage/categories/simplicial_sets.py
@@ -444,29 +444,31 @@ def covering_map(self, character):
sage: # needs sage.graphs sage.groups
sage: S1 = simplicial_sets.Sphere(1)
- sage: W = S1.wedge(S1)
+ sage: S1_ = simplicial_sets.Sphere(1)
+ sage: S1_.n_cells(1)[0].rename("sigma_1'")
+ sage: W = S1.wedge(S1_)
sage: G = CyclicPermutationGroup(3)
sage: a, b = W.n_cells(1)
sage: C = W.covering_map({a : G.gen(0), b : G.one()}); C
Simplicial set morphism:
From: Simplicial set with 9 non-degenerate simplices
To: Wedge: (S^1 v S^1)
- Defn: [(*, ()), (*, (1,2,3)), (*, (1,3,2)), (sigma_1, ()),
- (sigma_1, ()), (sigma_1, (1,2,3)), (sigma_1, (1,2,3)),
- (sigma_1, (1,3,2)), (sigma_1, (1,3,2))]
- --> [*, *, *, sigma_1, sigma_1, sigma_1, sigma_1, sigma_1, sigma_1]
+ Defn: [(*, ()), (*, (1,2,3)), (*, (1,3,2)), (sigma_1', ()),
+ (sigma_1', (1,2,3)), (sigma_1', (1,3,2)), (sigma_1, ()),
+ (sigma_1, (1,2,3)), (sigma_1, (1,3,2))]
+ --> [*, *, *, sigma_1', sigma_1', sigma_1', sigma_1, sigma_1, sigma_1]
sage: C.domain()
Simplicial set with 9 non-degenerate simplices
sage: C.domain().face_data()
{(*, ()): None,
(*, (1,2,3)): None,
(*, (1,3,2)): None,
+ (sigma_1', ()): ((*, ()), (*, ())),
+ (sigma_1', (1,2,3)): ((*, (1,2,3)), (*, (1,2,3))),
+ (sigma_1', (1,3,2)): ((*, (1,3,2)), (*, (1,3,2))),
(sigma_1, ()): ((*, (1,2,3)), (*, ())),
- (sigma_1, ()): ((*, ()), (*, ())),
(sigma_1, (1,2,3)): ((*, (1,3,2)), (*, (1,2,3))),
- (sigma_1, (1,2,3)): ((*, (1,2,3)), (*, (1,2,3))),
- (sigma_1, (1,3,2)): ((*, ()), (*, (1,3,2))),
- (sigma_1, (1,3,2)): ((*, (1,3,2)), (*, (1,3,2)))}
+ (sigma_1, (1,3,2)): ((*, ()), (*, (1,3,2)))}
"""
from sage.topology.simplicial_set import AbstractSimplex, SimplicialSet
from sage.topology.simplicial_set_morphism import SimplicialSetMorphism
@@ -530,7 +532,9 @@ def cover(self, character):
sage: # needs sage.graphs sage.groups
sage: S1 = simplicial_sets.Sphere(1)
- sage: W = S1.wedge(S1)
+ sage: S1_ = simplicial_sets.Sphere(1)
+ sage: S1_.n_cells(1)[0].rename("sigma_1'")
+ sage: W = S1.wedge(S1_)
sage: G = CyclicPermutationGroup(3)
sage: (a, b) = W.n_cells(1)
sage: C = W.cover({a : G.gen(0), b : G.gen(0)^2})
@@ -538,12 +542,12 @@ def cover(self, character):
{(*, ()): None,
(*, (1,2,3)): None,
(*, (1,3,2)): None,
+ (sigma_1', ()): ((*, (1,3,2)), (*, ())),
+ (sigma_1', (1,2,3)): ((*, ()), (*, (1,2,3))),
+ (sigma_1', (1,3,2)): ((*, (1,2,3)), (*, (1,3,2))),
(sigma_1, ()): ((*, (1,2,3)), (*, ())),
- (sigma_1, ()): ((*, (1,3,2)), (*, ())),
(sigma_1, (1,2,3)): ((*, (1,3,2)), (*, (1,2,3))),
- (sigma_1, (1,2,3)): ((*, ()), (*, (1,2,3))),
- (sigma_1, (1,3,2)): ((*, ()), (*, (1,3,2))),
- (sigma_1, (1,3,2)): ((*, (1,2,3)), (*, (1,3,2)))}
+ (sigma_1, (1,3,2)): ((*, ()), (*, (1,3,2)))}
sage: C.homology(1) # needs sage.modules
Z x Z x Z x Z
sage: C.fundamental_group()

View file

@ -0,0 +1,70 @@
diff --git a/src/sage/libs/eclib/__init__.pxd b/src/sage/libs/eclib/__init__.pxd
index d44d4fba865..2673af0613f 100644
--- a/src/sage/libs/eclib/__init__.pxd
+++ b/src/sage/libs/eclib/__init__.pxd
@@ -55,7 +55,6 @@ cdef extern from "eclib/matrix.h":
cdef cppclass mat:
mat()
mat(mat m)
- scalar* get_entries()
scalar sub(long, long)
long nrows()
long ncols()
@@ -67,7 +66,6 @@ cdef extern from "eclib/smatrix.h":
cdef cppclass smat:
smat()
smat(smat m)
- scalar* get_entries()
scalar sub(long, long)
long nrows()
long ncols()
diff --git a/src/sage/libs/eclib/mat.pyx b/src/sage/libs/eclib/mat.pyx
index bfdeb6ae5c1..989d9d1a70c 100644
--- a/src/sage/libs/eclib/mat.pyx
+++ b/src/sage/libs/eclib/mat.pyx
@@ -11,7 +11,6 @@ from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse
from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense
from sage.rings.integer cimport Integer
-
cdef class Matrix:
"""
A Cremona Matrix.
@@ -212,8 +211,7 @@ cdef class Matrix:
<class 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
"""
cdef long n = self.nrows()
- cdef long i, j, k
- cdef scalar* v = <scalar*> self.M.get_entries() # coercion needed to deal with const
+ cdef long i, j
cdef Matrix_integer_dense Td
cdef Matrix_integer_sparse Ts
@@ -221,21 +219,19 @@ cdef class Matrix:
# Ugly code...
if sparse:
Ts = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
- k = 0
for i from 0 <= i < n:
for j from 0 <= j < n:
- if v[k]:
- Ts.set_unsafe(i, j, Integer(v[k]))
- k += 1
+ Mij = Integer(self.M.sub(i+1,j+1))
+ if Mij:
+ Ts.set_unsafe(i, j, Mij)
return Ts
else:
Td = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
- k = 0
for i from 0 <= i < n:
for j from 0 <= j < n:
- if v[k]:
- Td.set_unsafe(i, j, Integer(v[k]))
- k += 1
+ Mij = Integer(self.M.sub(i+1,j+1))
+ if Mij:
+ Td.set_unsafe(i, j, Mij)
return Td

View file

@ -0,0 +1,39 @@
diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
index d02ae43149f..447b548c1b8 100644
--- a/src/sage/interfaces/singular.py
+++ b/src/sage/interfaces/singular.py
@@ -1401,7 +1401,7 @@ def _repr_(self):
# this is our cue that singular uses `rp` instead of `ip`
if singular_name_mapping['invlex'] == 'rp' and 'doctest' in str(get_display_manager()):
s = re.sub('^(// .*block.* : ordering )rp$', '\\1ip',
- s, 0, re.MULTILINE)
+ s, flags=re.MULTILINE)
return s
def __copy__(self):
diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py
index c542e0d1919..241078d5f2c 100644
--- a/src/sage/misc/cython.py
+++ b/src/sage/misc/cython.py
@@ -380,7 +380,7 @@ def cython(filename, verbose=0, compile_message=False,
cython_messages = re.sub(
"^.*The keyword 'nogil' should appear at the end of the function signature line. "
"Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.\n",
- "", cython_messages, 0, re.MULTILINE)
+ "", cython_messages, flags=re.MULTILINE)
sys.stderr.write(cython_messages)
sys.stderr.flush()
diff --git a/src/sage/rings/ring_extension_morphism.pyx b/src/sage/rings/ring_extension_morphism.pyx
index d4aad7f8253..7294e90c319 100644
--- a/src/sage/rings/ring_extension_morphism.pyx
+++ b/src/sage/rings/ring_extension_morphism.pyx
@@ -461,7 +461,7 @@ cdef class RingExtensionHomomorphism(RingMap):
if self.base_map() is not None:
s += "with map on base ring"
ss = self.base_map()._repr_defn()
- ss = re.sub('\nwith map on base ring:?$', '', ss, 0, re.MULTILINE)
+ ss = re.sub('\nwith map on base ring:?$', '', ss, flags=re.MULTILINE)
if ss != "": s += ":\n" + ss
if s != "" and s[-1] == "\n":
s = s[:-1]

View file

@ -0,0 +1,58 @@
diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py
index bf6d49906de..6c36ab47baf 100644
--- a/src/sage/doctest/forker.py
+++ b/src/sage/doctest/forker.py
@@ -553,6 +553,8 @@ def __init__(self, *args, **kwds):
self.total_walltime_skips = 0
self.total_performed_tests = 0
self.total_walltime = 0
+ if sys.version_info < (3,13):
+ self._stats = self._name2ft
def _run(self, test, compileflags, out):
"""
@@ -830,7 +832,10 @@ def compiler(example):
self.optionflags = original_optionflags
# Record and return the number of failures and tries.
- self._DocTestRunner__record_outcome(test, failures, tries)
+ if sys.version_info < (3,13):
+ self._DocTestRunner__record_outcome(test, failures, tries)
+ else:
+ self._DocTestRunner__record_outcome(test, failures, tries, walltime_skips)
self.total_walltime_skips += walltime_skips
self.total_performed_tests += tries
return TestResults(failures, tries)
@@ -931,7 +936,7 @@ def summarize(self, verbose=None):
sage: from sage.doctest.control import DocTestDefaults; DD = DocTestDefaults()
sage: import doctest, sys, os
sage: DTR = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
- sage: DTR._name2ft['sage.doctest.forker'] = (1,120)
+ sage: DTR._stats['sage.doctest.forker'] = (1,120)
sage: results = DTR.summarize()
**********************************************************************
1 item had failures:
@@ -946,8 +951,8 @@ def summarize(self, verbose=None):
passed = []
failed = []
totalt = totalf = 0
- for x in self._name2ft.items():
- name, (f, t) = x
+ for x in self._stats.items():
+ name, (f, t, *_) = x
assert f <= t
totalt += t
totalf += f
@@ -972,10 +977,10 @@ def summarize(self, verbose=None):
print(self.DIVIDER, file=m)
print(count_noun(len(failed), "item"), "had failures:", file=m)
failed.sort()
- for thing, (f, t) in failed:
+ for thing, (f, t, *_) in failed:
print(" %3d of %3d in %s" % (f, t, thing), file=m)
if verbose:
- print(count_noun(totalt, "test") + " in " + count_noun(len(self._name2ft), "item") + ".", file=m)
+ print(count_noun(totalt, "test") + " in " + count_noun(len(self._stats), "item") + ".", file=m)
print("%s passed and %s failed." % (totalt - totalf, totalf), file=m)
if totalf:
print("***Test Failed***", file=m)

View file

@ -0,0 +1,20 @@
diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
index 65279b16504..7c32771bee8 100644
--- a/src/sage/libs/giac/giac.pyx
+++ b/src/sage/libs/giac/giac.pyx
@@ -382,13 +382,8 @@ def _giac(s):
sage: (1+2*sin(3*x)).solve(x).simplify()
...list[-pi/18,7*pi/18]
- sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
- Traceback (most recent call last):
- ...
- RuntimeError: Unable to find numeric values solving equation. For
- trigonometric equations this may be solved using assumptions, e.g.
- assume(x>-pi && x<pi) Error: Bad Argument Value
-
+ sage: libgiac.solve('x^3-x>x',x)
+ list[((x>(-sqrt(2))) and (x<0)),x>(sqrt(2))]
You can also add some hypothesis to a giac symbol::

View file

@ -0,0 +1,28 @@
diff --git a/src/sage/matroids/extension.pyx b/src/sage/matroids/extension.pyx
index 778e6d6ef70..83b792e8d2b 100644
--- a/src/sage/matroids/extension.pyx
+++ b/src/sage/matroids/extension.pyx
@@ -211,6 +211,9 @@ cdef class LinearSubclassesIter:
self._nodes = [first_cut]
+ def __iter__(self):
+ return self
+
def __next__(self):
"""
Return the next linear subclass.
diff --git a/src/sage/matroids/set_system.pyx b/src/sage/matroids/set_system.pyx
index d9a2f631fbf..0bf9cb2b7fa 100644
--- a/src/sage/matroids/set_system.pyx
+++ b/src/sage/matroids/set_system.pyx
@@ -772,6 +772,9 @@ cdef class SetSystemIterator:
self._pointer = -1
self._len = len(H)
+ def __iter__(self):
+ return self
+
def __next__(self):
"""
Return the next subset of a SetSystem.

View file

@ -0,0 +1,54 @@
diff --git a/src/sage/misc/latex_macros.py b/src/sage/misc/latex_macros.py
index fc389b32a72..1cce2fa6f14 100644
--- a/src/sage/misc/latex_macros.py
+++ b/src/sage/misc/latex_macros.py
@@ -43,6 +43,8 @@
contain '\newcommand' lines for each of the entries in ``macros``.
"""
+import importlib
+
def produce_latex_macro(name, *sample_args):
r"""
@@ -69,7 +71,7 @@ def produce_latex_macro(name, *sample_args):
sage: produce_latex_macro('GF', 37)
'\\newcommand{\\GF}[1]{\\Bold{F}_{#1}}'
- If the Sage object is not in the global name space, describe it
+ If the Sage object is not in the global namespace, describe it
like so::
sage: produce_latex_macro('sage.rings.finite_rings.finite_field_constructor.FiniteField', 3)
@@ -84,22 +86,16 @@ def produce_latex_macro(name, *sample_args):
else:
module, real_name = names_split
newcommand = '\\newcommand{\\' + real_name + '}'
- count = 0
- args = "("
- for x in sample_args:
- count += 1
- args += str(x) + ','
- args += ')'
- exec('from ' + module + ' import ' + real_name)
- if count:
- defn = '[' + str(count) + ']{'
- defn += eval('str(LatexCall()(' + real_name + args + '))') + '}'
+ sage_object = getattr(importlib.import_module(module), real_name)
+ if sample_args:
+ defn = '[' + str(len(sample_args)) + ']{'
+ defn += str(LatexCall()(sage_object(*sample_args))) + '}'
else:
- defn = '{' + eval('str(LatexCall()(' + real_name + '))') + '}'
- count = 0
- for x in sample_args:
- count += 1
- defn = defn.replace(str(x), "#" + str(count))
+ defn = '{' + str(LatexCall()(sage_object)) + '}'
+ for i, x in enumerate(sample_args):
+ s = str(x)
+ assert s in defn
+ defn = defn.replace(s, "#" + str(i+1))
return newcommand + defn

View file

@ -0,0 +1,22 @@
diff --git a/src/sage/misc/replace_dot_all.py b/src/sage/misc/replace_dot_all.py
index ea51a9b3159..a43d6c0a929 100644
--- a/src/sage/misc/replace_dot_all.py
+++ b/src/sage/misc/replace_dot_all.py
@@ -194,14 +194,15 @@ def find_replacements(location, package_regex=None, verbose=False):
to_exec = to_exec.replace("'", '').replace('"', '')
if (to_exec[-1] == ','):
to_exec = to_exec[:-1]
- exec(to_exec)
+ glob = dict()
+ exec(to_exec, glob)
except ModuleNotFoundError as err:
print(f'ModuleNotFoundError: {err} found when trying to execute {to_exec}')
except ImportError as err:
print(f'ImportError: {err} found when trying to execute {to_exec}')
try: # try to evaluate the list of module names to get a list of the modules themselves which we can call import_statements on
- modules = eval(to_eval)
+ modules = eval(to_eval, glob)
except NameError as err:
print(f'NameError: {err} found when trying to evaluate {to_eval} at {location}:{row_index + 1}')
except SyntaxError as err:

View file

@ -0,0 +1,142 @@
diff --git a/src/sage/categories/map.pyx b/src/sage/categories/map.pyx
index 43e476847d0..0007555326a 100644
--- a/src/sage/categories/map.pyx
+++ b/src/sage/categories/map.pyx
@@ -275,7 +275,7 @@ cdef class Map(Element):
maps::
sage: phi.domain # needs sage.rings.number_field
- <weakref at ...; to 'NumberField_quadratic_with_category' at ...>
+ <weakref at ...; to '...NumberField_quadratic_with_category' at ...>
sage: phi._make_strong_references() # needs sage.rings.number_field
sage: print(phi.domain) # needs sage.rings.number_field
The constant function (...) -> Number Field in a
@@ -343,7 +343,7 @@ cdef class Map(Element):
maps::
sage: phi.domain # needs sage.rings.number_field
- <weakref at ...; to 'NumberField_quadratic_with_category' at ...>
+ <weakref at ...; to '...NumberField_quadratic_with_category' at ...>
sage: phi._make_strong_references() # needs sage.rings.number_field
sage: print(phi.domain) # needs sage.rings.number_field
The constant function (...) -> Number Field in a
diff --git a/src/sage/misc/bindable_class.py b/src/sage/misc/bindable_class.py
index 743b5a19da6..c23ba0c2c43 100644
--- a/src/sage/misc/bindable_class.py
+++ b/src/sage/misc/bindable_class.py
@@ -113,7 +113,7 @@ class BindableClass(metaclass=ClasscallMetaclass):
Still, documentation works as usual::
sage: outer.Inner.__doc__
- ' some documentation '
+ '...some documentation '
TESTS::
diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py
index 0505f6039a9..6147ec4983b 100644
--- a/src/sage/misc/sagedoc.py
+++ b/src/sage/misc/sagedoc.py
@@ -694,7 +694,7 @@ def format(s, embedded=False):
We check that the todo Sphinx extension is correctly activated::
sage: sage.misc.sagedoc.format(sage.combinat.ranker.on_fly.__doc__) # needs sphinx
- " Return ... Todo: add tests as in combinat::rankers\n"
+ "...Return ...Todo: add tests as in combinat::rankers\n"
In the following use case, the ``nodetex`` directive would have been ignored prior
to :issue:`11815`::
@@ -1135,10 +1135,11 @@ def search_src(string, extra1='', extra2='', extra3='', extra4='',
The following produces an error because the string 'fetch(' is a
malformed regular expression::
- sage: print(search_src(" fetch(", "def", interact=False))
- Traceback (most recent call last):
- ...
- error: missing ), unterminated subpattern at position 6
+ sage: try:
+ ....: print(search_src(" fetch(", "def", interact=False))
+ ....: except Exception as e:
+ ....: print(e)
+ missing ), unterminated subpattern at position 6
To fix this, *escape* the parenthesis with a backslash::
@@ -1186,7 +1187,6 @@ def search_src(string, extra1='', extra2='', extra3='', extra4='',
misc/sagedoc.py:... len(search_src("matrix", interact=False).splitlines())...
misc/sagedoc.py:... len(search_src("matrix", module="sage.calculus", interact=False).splitlines())...
misc/sagedoc.py:... len(search_src("matrix", path_re="calc"...
- misc/sagedoc.py:... print(search_src(" fetch(", "def", interact=False))...
misc/sagedoc.py:... print(search_src(r" fetch\(", "def", interact=False))...
misc/sagedoc.py:... print(search_src(r" fetch\(", "def", "pyx", interact=False))...
misc/sagedoc.py:... s = search_src('Matrix', path_re='matrix', interact=False); s.find('x') > 0...
@@ -1456,7 +1456,7 @@ class _sage_doc:
sage: browse_sage_doc._open("reference", testing=True)[0] # needs sagemath_doc_html
'http://localhost:8000/doc/live/reference/index.html'
sage: browse_sage_doc(identity_matrix, 'rst')[-107:-47] # needs sage.modules
- 'Full MatrixSpace of 3 by 3 sparse matrices over Integer Ring'
+ '...Full MatrixSpace of 3 by 3 sparse matrices...'
"""
def __init__(self):
"""
diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
index 585112b5061..12f319fc8e3 100644
--- a/src/sage/misc/sageinspect.py
+++ b/src/sage/misc/sageinspect.py
@@ -1986,7 +1986,7 @@ def sage_getdoc(obj, obj_name='', embedded=False):
sage: from sage.misc.sageinspect import sage_getdoc
sage: sage_getdoc(identity_matrix)[87:124] # needs sage.modules
- 'Return the n x n identity matrix over'
+ '...the n x n identity matrix...'
sage: def f(a, b, c, d=1): return a+b+c+d
...
sage: import functools
diff --git a/src/sage/modular/modsym/modsym.py b/src/sage/modular/modsym/modsym.py
index fb46d0edafa..ed7c9285169 100644
--- a/src/sage/modular/modsym/modsym.py
+++ b/src/sage/modular/modsym/modsym.py
@@ -369,7 +369,7 @@ def ModularSymbols(group=1,
{}
sage: M = ModularSymbols(11,use_cache=True)
sage: sage.modular.modsym.modsym._cache
- {(Congruence Subgroup Gamma0(11), 2, 0, Rational Field): <weakref at ...; to 'ModularSymbolsAmbient_wt2_g0_with_category' at ...>}
+ {(Congruence Subgroup Gamma0(11), 2, 0, Rational Field): <weakref at ...; to '...ModularSymbolsAmbient_wt2_g0_with_category' at ...>}
sage: M is ModularSymbols(11,use_cache=True)
True
sage: M is ModularSymbols(11,use_cache=False)
diff --git a/src/sage/repl/attach.py b/src/sage/repl/attach.py
index b3e20fe61d8..b9997d8f2df 100644
--- a/src/sage/repl/attach.py
+++ b/src/sage/repl/attach.py
@@ -40,7 +40,7 @@
....: traceback.print_exc(file=sys.stdout)
Traceback (most recent call last):
...
- exec(preparse_file(f.read()) + "\n", globals)
+ exec(preparse_file(f.read()) + "\n", globals)...
File "<string>", line 3, in <module>
ValueError: third
sage: detach(src)
@@ -52,7 +52,7 @@
....: traceback.print_exc(file=sys.stdout)
Traceback (most recent call last):
...
- exec(code, globals)
+ exec(code, globals)...
File ".../foobar...sage.py", line ..., in <module>
raise ValueError("third") # this should appear in the source snippet...
ValueError: third
diff --git a/src/sage/repl/rich_output/pretty_print.py b/src/sage/repl/rich_output/pretty_print.py
index 93833e01cd8..8e00e3d70e4 100644
--- a/src/sage/repl/rich_output/pretty_print.py
+++ b/src/sage/repl/rich_output/pretty_print.py
@@ -160,7 +160,7 @@ def pretty_print(self):
sage: seq._concatenate_graphs().show(edge_labels=True) # needs sage.graphs sage.plot
Traceback (most recent call last):
...
- TypeError: ...matplotlib() got an unexpected keyword argument 'edge_labels'
+ TypeError: ...matplotlib() got an unexpected keyword argument 'edge_labels'...
"""
try:
from sage.plot.plot import Graphics

View file

@ -0,0 +1,36 @@
diff --git a/src/sage/misc/temporary_file.py b/src/sage/misc/temporary_file.py
index 998260be8eb..820d5cf2e95 100644
--- a/src/sage/misc/temporary_file.py
+++ b/src/sage/misc/temporary_file.py
@@ -32,7 +32,9 @@
# as the parent for all temporary files & directories created by them.
# This lets us clean up after those two functions when sage exits normally
# using an atexit hook
-TMP_DIR_FILENAME_BASE = tempfile.TemporaryDirectory()
+# Note that `TemporaryDirectory()` will cleanup on program exit;
+# we keep the atexit hook to be redundant, in case that fails.
+TMP_DIR_FILENAME_BASE = tempfile.TemporaryDirectory(prefix='sage_')
atexit.register(lambda: TMP_DIR_FILENAME_BASE.cleanup())
@@ -533,14 +535,15 @@ def spyx_tmp() -> str:
We cache the result of this function "by hand" so that the same
temporary directory will always be returned. A function is used to
delay creating a directory until (if) it is needed. The temporary
- directory is removed when sage terminates by way of an atexit
- hook.
+ directory is automatically removed when sage terminates.
"""
global _spyx_tmp
if _spyx_tmp:
return _spyx_tmp
- d = tempfile.TemporaryDirectory()
- _spyx_tmp = os.path.join(d.name, 'spyx')
- atexit.register(lambda: d.cleanup())
+ # We don't use `tempfile.TemporaryDirectory()` here because it
+ # will be cleaned up on child exit (e.g. for parallel testing)
+ # For some reason this doesn't affect the `TemporaryDirectory`
+ # stored in the global `TMP_DIR_FILENAME_BASE`.
+ _spyx_tmp = tmp_dir(name='spyx_')
return _spyx_tmp

View file

@ -27,10 +27,21 @@ get_pr() {
# run from patches dir
cd $(dirname "$0")
get_pr 36641 "sympy 1.13"
get_pr 37884 "gap 4.13.1"
get_pr 38250 "numpy 2.0"
get_pr 38344 "ecm 7.0.6"
#get_pr 37645 "fix doctest"
#get_pr 37885 "cython warnings"
get_pr 39145 "python 3.13 re.sub"
get_pr 39147 "python 3.13 doctest"
get_pr 39182 "python 3.13 iter"
get_pr 39184 "python 3.13 produce_latex_macro"
get_pr 39185 "python 3.13 find_replacements"
get_pr 39187 "python 3.13 tests output"
get_pr 39201 "python 3.13 fix spyx_tmp"
get_pr 38749 "pari 2.17"
get_pr 38962 "eclib 20241112"
get_pr 39178 "giac 1.9.0.998"
get_pr 38940 "fix flaky simplicial set test"
#get_pr 39142 "fix alarm tests"

View file

@ -1,28 +0,0 @@
commit 241dc39bd0ba1c056f88bee46a0345d59093eaff
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
Date: Mon Aug 19 23:25:32 2024 -0300
add copy parameter to numpy (needed for v2.1)
diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx
index c38df5412f0..f587cef651a 100644
--- a/src/sage/matrix/matrix1.pyx
+++ b/src/sage/matrix/matrix1.pyx
@@ -671,7 +671,7 @@ cdef class Matrix(Matrix0):
entries = [[sib(v, 2) for v in row] for row in self.rows()]
return sib.name('matrix')(self.base_ring(), entries)
- def numpy(self, dtype=None):
+ def numpy(self, dtype=None, copy=True):
"""
Return the Numpy matrix associated to this matrix.
@@ -732,7 +732,7 @@ cdef class Matrix(Matrix0):
(3, 4)
"""
import numpy
- A = numpy.matrix(self.list(), dtype=dtype)
+ A = numpy.matrix(self.list(), dtype=dtype, copy=copy)
return numpy.resize(A,(self.nrows(), self.ncols()))
# Define the magic "__array__" function so that numpy.array(m) can convert

View file

@ -1,229 +0,0 @@
commit 8b32fdb87725c1d67ffb51dadec1c331c7c35f3c
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
Date: Tue Aug 20 00:05:33 2024 -0300
silence np.set_printoptions (for numpy 2.1)
diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py
index b3ebd206cd2..48866824224 100644
--- a/src/sage/combinat/fully_packed_loop.py
+++ b/src/sage/combinat/fully_packed_loop.py
@@ -68,7 +68,7 @@ def _make_color_list(n, colors=None, color_map=None, randomize=False):
sage: import numpy as np
sage: if int(np.version.short_version[0]) > 1:
- ....: np.set_printoptions(legacy="1.25")
+ ....: _token = np.set_printoptions(legacy="1.25")
sage: from sage.combinat.fully_packed_loop import _make_color_list
sage: _make_color_list(5)
sage: _make_color_list(5, ['blue', 'red'])
diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py
index 2a03bb68f67..30b56722e66 100644
--- a/src/sage/functions/special.py
+++ b/src/sage/functions/special.py
@@ -219,7 +219,7 @@ class SphericalHarmonic(BuiltinFunction):
sage: from scipy.special import sph_harm # NB: arguments x and y are swapped # needs scipy
sage: import numpy as np # needs scipy
sage: if int(np.version.short_version[0]) > 1: # needs scipy
- ....: np.set_printoptions(legacy="1.25") # needs scipy
+ ....: _token = np.set_printoptions(legacy="1.25") # needs scipy
sage: sph_harm(1, 1, pi.n(), (pi/2).n()) # abs tol 1e-14 # needs scipy sage.symbolic
(0.3454941494713355-4.231083042742082e-17j)
diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py
index 7ae8ca4966f..4cba22efdba 100644
--- a/src/sage/numerical/optimize.py
+++ b/src/sage/numerical/optimize.py
@@ -385,7 +385,7 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default",
....: return sum(100.0r*(x[1r:]-x[:-1r]**2.0r)**2.0r + (1r-x[:-1r])**2.0r)
sage: import numpy
sage: if int(numpy.version.short_version[0]) > 1:
- ....: numpy.set_printoptions(legacy="1.25")
+ ....: _token = numpy.set_printoptions(legacy="1.25")
sage: from numpy import zeros
sage: def rosen_der(x):
....: xm = x[1r:-1r]
diff --git a/src/sage/plot/arrow.py b/src/sage/plot/arrow.py
index 23e2517ca56..7375dcd5d1c 100644
--- a/src/sage/plot/arrow.py
+++ b/src/sage/plot/arrow.py
@@ -55,7 +55,7 @@ class CurveArrow(GraphicPrimitive):
sage: import numpy # to ensure numpy 2.0 compatibility
sage: if int(numpy.version.short_version[0]) > 1:
- ....: numpy.set_printoptions(legacy="1.25")
+ ....: _token = numpy.set_printoptions(legacy="1.25")
sage: from sage.plot.arrow import CurveArrow
sage: b = CurveArrow(path=[[(0,0),(.5,.5),(1,0)],[(.5,1),(0,0)]],
....: options={})
diff --git a/src/sage/plot/multigraphics.py b/src/sage/plot/multigraphics.py
index 6be448f1e04..004594b77c4 100644
--- a/src/sage/plot/multigraphics.py
+++ b/src/sage/plot/multigraphics.py
@@ -786,7 +786,7 @@ class MultiGraphics(WithEqualityById, SageObject):
(0.2, 0.3, 0.4, 0.1)
sage: import numpy # to ensure numpy 2.0 compatibility
sage: if int(numpy.version.short_version[0]) > 1:
- ....: numpy.set_printoptions(legacy="1.25")
+ ....: _token = numpy.set_printoptions(legacy="1.25")
sage: ax1.get_position().bounds # tol 1.0e-13
(0.2, 0.3, 0.4000000000000001, 0.10000000000000003)
@@ -1300,7 +1300,7 @@ class GraphicsArray(MultiGraphics):
sage: G = graphics_array([g1, g2])
sage: import numpy # to ensure numpy 2.0 compatibility
sage: if int(numpy.version.short_version[0]) > 1:
- ....: numpy.set_printoptions(legacy="1.25")
+ ....: _token = numpy.set_printoptions(legacy="1.25")
sage: G.position(0) # tol 5.0e-3
(0.025045451349937315,
0.03415488992713045,
diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py
index d2cb11088c7..6d88517cc15 100644
--- a/src/sage/plot/streamline_plot.py
+++ b/src/sage/plot/streamline_plot.py
@@ -73,7 +73,7 @@ class StreamlinePlot(GraphicPrimitive):
sage: x, y = var('x y')
sage: import numpy # to ensure numpy 2.0 compatibility
sage: if int(numpy.version.short_version[0]) > 1:
- ....: numpy.set_printoptions(legacy="1.25")
+ ....: _token = numpy.set_printoptions(legacy="1.25")
sage: d = streamline_plot((.01*x, x+y), (x,10,20), (y,10,20))[0].get_minmax_data()
sage: d['xmin']
10.0
diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx
index 38c30f7627b..cfb8a5ff5f7 100644
--- a/src/sage/rings/integer.pyx
+++ b/src/sage/rings/integer.pyx
@@ -594,7 +594,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
sage: import numpy # needs numpy
sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
- ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy
sage: numpy.int8('12') == 12 # needs numpy
True
sage: 12 == numpy.int8('12') # needs numpy
diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx
index 76fbfedab95..57de30c9d18 100644
--- a/src/sage/rings/real_mpfi.pyx
+++ b/src/sage/rings/real_mpfi.pyx
@@ -232,7 +232,7 @@ TESTS::
sage: import numpy # needs numpy
sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
- ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy
sage: RIF(2) == numpy.int8('2') # needs numpy
True
sage: numpy.int8('2') == RIF(2) # needs numpy
diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
index 70ce616f92f..f604c6d3785 100644
--- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
+++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
@@ -78,7 +78,7 @@ cdef class PeriodicRegion:
sage: import numpy as np
sage: if int(np.version.short_version[0]) > 1:
- ....: np.set_printoptions(legacy="1.25")
+ ....: _token = np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((4, 4))
sage: PeriodicRegion(CDF(2), CDF(2*I), data).is_empty()
@@ -298,7 +298,7 @@ cdef class PeriodicRegion:
sage: import numpy as np
sage: if int(np.version.short_version[0]) > 1:
- ....: np.set_printoptions(legacy="1.25")
+ ....: _token = np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((10, 10))
sage: data[1:4,1:4] = True
@@ -322,7 +322,7 @@ cdef class PeriodicRegion:
sage: import numpy as np
sage: if int(np.version.short_version[0]) > 1:
- ....: np.set_printoptions(legacy="1.25")
+ ....: _token = np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((4, 4))
sage: data[1,1] = True
@@ -377,7 +377,7 @@ cdef class PeriodicRegion:
sage: import numpy as np
sage: if int(np.version.short_version[0]) > 1:
- ....: np.set_printoptions(legacy="1.25")
+ ....: _token = np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((20, 20))
@@ -529,7 +529,7 @@ cdef class PeriodicRegion:
sage: import numpy as np
sage: if int(np.version.short_version[0]) > 1:
- ....: np.set_printoptions(legacy="1.25")
+ ....: _token = np.set_printoptions(legacy="1.25")
sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion
sage: data = np.zeros((4, 4))
sage: data[1, 1] = True
diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py
index 6937f6cb410..fb296e00fb6 100644
--- a/src/sage/stats/basic_stats.py
+++ b/src/sage/stats/basic_stats.py
@@ -228,7 +228,7 @@ def std(v, bias=False):
sage: # needs numpy
sage: import numpy
sage: if int(numpy.version.short_version[0]) > 1:
- ....: numpy.set_printoptions(legacy="1.25")
+ ....: _token = numpy.set_printoptions(legacy="1.25")
sage: x = numpy.array([1,2,3,4,5])
sage: std(x, bias=False)
1.5811388300841898
@@ -307,7 +307,7 @@ def variance(v, bias=False):
0.4897530450000000?
sage: import numpy # needs numpy
sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
- ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy
sage: x = numpy.array([1,2,3,4,5]) # needs numpy
sage: variance(x, bias=False) # needs numpy
2.5
diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx
index 955a256e9b4..e5ed6160b79 100644
--- a/src/sage/structure/coerce.pyx
+++ b/src/sage/structure/coerce.pyx
@@ -521,7 +521,7 @@ cdef class CoercionModel:
sage: import numpy # needs numpy
sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
- ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy
sage: # needs sage.rings.real_mpfr
sage: x = polygen(RR)
diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
index cd89ad2a256..6fdf6d8ef23 100644
--- a/src/sage/symbolic/function.pyx
+++ b/src/sage/symbolic/function.pyx
@@ -965,7 +965,7 @@ cdef class BuiltinFunction(Function):
sage: import numpy # needs numpy
sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
- ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy
sage: sin(numpy.int32(0)) # needs numpy
0.0
diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx
index 5b007d9e5fd..4a096d317e7 100644
--- a/src/sage/symbolic/ring.pyx
+++ b/src/sage/symbolic/ring.pyx
@@ -1163,7 +1163,7 @@ cdef class NumpyToSRMorphism(Morphism):
sage: import numpy # needs numpy
sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
- ....: numpy.set_printoptions(legacy="1.25") # needs numpy
+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy
sage: f(x) = x^2
sage: f(numpy.int8('2')) # needs numpy
4

View file

@ -0,0 +1,30 @@
A couple of tests that give different (correct) output on 32-bit
diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py
index 45f08aa4711..b88b315fd01 100644
--- a/src/sage/rings/number_field/bdd_height.py
+++ b/src/sage/rings/number_field/bdd_height.py
@@ -236,7 +236,8 @@ def bdd_norm_pr_ideal_gens(K, norm_list):
sage: from sage.rings.number_field.bdd_height import bdd_norm_pr_ideal_gens
sage: K.<g> = QuadraticField(123)
sage: bdd_norm_pr_ideal_gens(K, range(5))
- {0: [0], 1: [1], 2: [g + 11], 3: [], 4: [2]}
+ {0: [0], 1: [1], 2: [g + 11], 3: [], 4: [2]} # 64-bit
+ {0: [0], 1: [1], 2: [g - 11], 3: [], 4: [2]} # 32-bit
::
diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py
index 61d0b98509a..dab3186cea4 100644
--- a/src/sage/rings/number_field/number_field.py
+++ b/src/sage/rings/number_field/number_field.py
@@ -4827,7 +4827,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: K.<a> = NumberField(2*x^2 - 1/3)
sage: K._S_class_group_and_units(tuple(K.primes_above(2) + K.primes_above(3)))
- ([6*a + 2, -6*a + 3, -1, -12*a - 5], [])
+ ([6*a + 2, -6*a + 3, -1, -12*a - 5], []) # 64-bit
+ ([6*a + 2, -6*a - 3, -1, -12*a - 5], []) # 32-bit
"""
K_pari = self.pari_bnf(proof=proof)
S_pari = [p.pari_prime() for p in sorted(set(S))]

View file

@ -0,0 +1,17 @@
--- a/src/sage/rings/number_field/galois_group.py
+++ b/src/sage/rings/number_field/galois_group.py
@@ -994,9 +994,11 @@ class GaloisGroup_v2(GaloisGroup_perm):
sage: x = polygen(ZZ, 'x')
sage: K.<b> = NumberField(x^4 - 2*x^2 + 2, 'a').galois_closure()
sage: G = K.galois_group()
- sage: [G.artin_symbol(P) for P in K.primes_above(7)]
- [(1,5)(2,6)(3,7)(4,8), (1,5)(2,6)(3,7)(4,8),
- (1,4)(2,3)(5,8)(6,7), (1,4)(2,3)(5,8)(6,7)]
+ sage: sorted([G.artin_symbol(P) for P in K.primes_above(7)])
+ [(1,4)(2,3)(5,8)(6,7),
+ (1,4)(2,3)(5,8)(6,7),
+ (1,5)(2,6)(3,7)(4,8),
+ (1,5)(2,6)(3,7)(4,8)]
sage: G.artin_symbol(17)
Traceback (most recent call last):
...

View file

@ -1,12 +1,14 @@
# Template file for 'sagemath'
pkgname=sagemath
version=10.4
revision=4
version=10.5
revision=1
_pypi_version=${version/.beta/b}
_pypi_version=${_pypi_version/.rc/rc}
build_style=python3-pep517
hostmakedepends="pkg-config python3-Cython python3-Jinja2
python3-pkgconfig python3-setuptools python3-wheel"
python3-pkgconfig python3-setuptools python3-wheel
python3-gmpy2 python3-memory_allocator python3-numpy ecl
python3-cypari2 python3-cysignals python3-devel"
makedepends="boost-devel brial-devel cliquer-devel ecl eclib-devel
ecm-devel fflas-ffpack flintlib-devel gap-devel gd-devel giac-devel glpk-devel
gsl-devel iml-devel lcalc-devel libbraiding-devel libhomfly-devel libmpc-devel
@ -24,7 +26,9 @@ depends="eclib-devel fflas-ffpack flintlib-devel gcc-fortran meson gd-devel
python3-pplpy python3-primecountpy python3-requests python3-scipy
python3-sympy python3-traitlets sage-data-combinatorial_designs
python3-conway-polynomials sage-data-elliptic_curves sage-data-graphs
sage-data-polytopes_db sympow tachyon threejs-sage"
sage-data-polytopes_db sympow tachyon threejs-sage
python3-six python3-gmpy2 python3-numpy python3-pexpect python3-Sphinx
python3-Pillow python3-mpmath python3-jupyter_client python3-ptyprocess"
checkdepends="$depends python3-pytest pythran python3-Sphinx gdb"
short_desc="Open source mathematics software"
maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
@ -32,7 +36,7 @@ license="GPL-2.0-or-later"
homepage="https://www.sagemath.org/"
changelog="https://github.com/sagemath/sage/releases"
distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz"
checksum=f6579e85f33bd9bb6e9b991bfc4c49dab1e649858ed9ee41c7cec75cb92d4c62
checksum=fa0e91cc12754db3cbdf843dbe30252b4378c030825530bc6858ddbcac701096
nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima"
# main repo `.../src/sage/` is `.../sage/` here
@ -47,7 +51,7 @@ post_install() {
mv -T ${DESTDIR}/usr/bin ${DESTDIR}/usr/libexec/sagemath
# copy configuration
cp ${FILESDIR}/sage-env-config ${DESTDIR}/usr/libexec/sagemath
vinstall ${FILESDIR}/sage-env-config 644 usr/libexec/sagemath
# symlink main binary
vmkdir usr/bin