From 724dbd034e6ad2876267b107b8c98bfc4f5a2d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Fri, 3 Jan 2025 19:26:17 -0300 Subject: [PATCH] sagemath: patch doctests for scipy-1.15 --- .../sagemath/patches/39261-scipy_1.15.patch | 36 +++++++++++++++++++ srcpkgs/sagemath/patches/get_patches | 1 + 2 files changed, 37 insertions(+) create mode 100644 srcpkgs/sagemath/patches/39261-scipy_1.15.patch diff --git a/srcpkgs/sagemath/patches/39261-scipy_1.15.patch b/srcpkgs/sagemath/patches/39261-scipy_1.15.patch new file mode 100644 index 00000000000..02ad169c070 --- /dev/null +++ b/srcpkgs/sagemath/patches/39261-scipy_1.15.patch @@ -0,0 +1,36 @@ +diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py +index 308171af3cd..f511190aeff 100644 +--- a/src/sage/functions/special.py ++++ b/src/sage/functions/special.py +@@ -216,11 +216,16 @@ 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 ++ sage: import scipy.version ++ sage: if scipy.version.version < '1.15.0': ++ ....: from scipy.special import sph_harm # NB: arguments x and y are swapped # needs scipy ++ ....: sph_harm(1, 1, pi.n(), (pi/2).n()) # abs tol 1e-14 # needs scipy sage.symbolic ++ ....: else: ++ ....: from scipy.special import sph_harm_y # needs scipy ++ ....: sph_harm_y(1, 1, (pi/2).n(), pi.n()).item() # abs tol 1e-9 # needs scipy sage.symbolic + (0.3454941494713355-4.231083042742082e-17j) + + Note that this convention differs from the one in Maxima, as revealed by +diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx +index dec25a76e54..31aaf8b8234 100644 +--- a/src/sage/matrix/matrix2.pyx ++++ b/src/sage/matrix/matrix2.pyx +@@ -15901,7 +15901,7 @@ cdef class Matrix(Matrix1): + sage: a.exp() # needs sage.symbolic + [ 1/11882424341266*((11*sqrt(227345670387496707609) + 5941212170633)*e^(3/1275529100*sqrt(227345670387496707609)) - 11*sqrt(227345670387496707609) + 5941212170633)*e^(-3/2551058200*sqrt(227345670387496707609) + 101/200) 445243650/75781890129165569203*(sqrt(227345670387496707609)*e^(3/1275529100*sqrt(227345670387496707609)) - sqrt(227345670387496707609))*e^(-3/2551058200*sqrt(227345670387496707609) + 101/200)] + [ 10000/53470909535697*(sqrt(227345670387496707609)*e^(3/1275529100*sqrt(227345670387496707609)) - sqrt(227345670387496707609))*e^(-3/2551058200*sqrt(227345670387496707609) + 101/200) -1/11882424341266*((11*sqrt(227345670387496707609) - 5941212170633)*e^(3/1275529100*sqrt(227345670387496707609)) - 11*sqrt(227345670387496707609) - 5941212170633)*e^(-3/2551058200*sqrt(227345670387496707609) + 101/200)] +- sage: a.change_ring(RDF).exp() # rel tol 6e-14 # needs sage.symbolic ++ sage: a.change_ring(RDF).exp() # rel tol 1e-13 # needs sage.symbolic + [42748127.31532951 7368259.244159399] + [234538976.1381042 40426191.45156228] + diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index 97bf36df52e..571d8939163 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -41,6 +41,7 @@ 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 39261 "scipy 1.15" get_pr 38940 "fix flaky simplicial set test"