sagemath: patch doctests for scipy-1.15

This commit is contained in:
Gonzalo Tornaría 2025-01-03 19:26:17 -03:00 committed by Andrew J. Hesford
parent 32853f9eab
commit 724dbd034e
2 changed files with 37 additions and 0 deletions

View file

@ -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]

View file

@ -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"