Mpmath 1.4 alpha update, setup.py and meson compatible#40669
Mpmath 1.4 alpha update, setup.py and meson compatible#40669kiwifb wants to merge 17 commits intosagemath:developfrom
Conversation
…dle mpmath types without Sage backend
…ion_doctest.py: Update class name in doctest output
|
Documentation preview for this PR (built with commit e7f5fb5; changes) is ready! 🎉 |
|
The big problem here is that no other distros are going to switch to an alpha release without a very good reason. I think for there to be any hope of it getting merged before the official 1.4.0, we would need to support 1.3.x as well. (Debian et al. may remain on 1.3.x for a while anyway). It doesn't look like there are too many tests to worry about. Just code that needs to be enabled/disabled. With meson, we could check for the version being used, and then add e.g. |
|
Actually for the deleted functions like |
|
1.4 is out, this needs rebasing |
|
There are still a few issues with 1.4: The first two are just numerical noise. The last one is due to some constants (kinchin, twinprime, glaisher, mertens) no longer being evaluated. The third one is a coercion error: |
|
This fixes the remaining issues diff --git a/src/sage/functions/error.py b/src/sage/functions/error.py
index 78eb4992aa6..8822b3ed584 100644
--- a/src/sage/functions/error.py
+++ b/src/sage/functions/error.py
@@ -257,7 +257,7 @@ class Function_erf(BuiltinFunction):
sage: erf(2).n(200) # needs sage.symbolic
0.99532226501895273416206925636725292861089179704006007673835
sage: erf(pi - 1/2*I).n(100) # needs sage.symbolic
- 1.0000111669099367825726058952 + 1.6332655417638522934072124547e-6*I
+ 1.0000111669099367825726058952 + 1.633265541763852293407212454...e-6*I
TESTS:
diff --git a/src/sage/functions/exp_integral.py b/src/sage/functions/exp_integral.py
index e074c430808..09d2bbda71b 100644
--- a/src/sage/functions/exp_integral.py
+++ b/src/sage/functions/exp_integral.py
@@ -993,7 +993,7 @@ class Function_cos_integral(BuiltinFunction):
sage: N(cos_integral(10^-10), digits=30) # needs sage.symbolic
-22.4486352650389239795759024568
sage: cos_integral(ComplexField(100)(I)) # needs sage.symbolic
- 0.83786694098020824089467857943 + 1.5707963267948966192313216916*I
+ 0.8378669409802082408946785794... + 1.5707963267948966192313216916*I
"""
return _mpmath_utils_call(_mpmath_ci, z, parent=parent)
diff --git a/src/sage/libs/mpmath/all.py b/src/sage/libs/mpmath/all.py
index ea35faeb721..14a4be971e6 100644
--- a/src/sage/libs/mpmath/all.py
+++ b/src/sage/libs/mpmath/all.py
@@ -22,5 +22,5 @@ _constants_funcs = {
def eval_constant(name, ring):
- prec = ring.precision() + 20
+ prec = int(ring.precision() + 20)
return ring(_constants_funcs[name](prec)) >> prec
diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx
index 11f58008fcf..ba26d194b1f 100644
--- a/src/sage/rings/complex_mpfr.pyx
+++ b/src/sage/rings/complex_mpfr.pyx
@@ -54,6 +54,7 @@ from sage.rings.integer_ring import ZZ
cimport gmpy2
gmpy2.import_gmpy2()
+from mpmath import mp
try:
from cypari2.gen import Gen as pari_gen
@@ -984,7 +985,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement):
real, imag = real
elif isinstance(real, complex):
real, imag = real.real, real.imag
- elif type(real) is gmpy2.mpc:
+ elif isinstance(real, (gmpy2.mpc, mp.mpc)):
real, imag = (<gmpy2.mpc>real).real, (<gmpy2.mpc>real).imag
else:
imag = 0 |
|
Thanks for the extra work @antonio-rojas I am not sure when I will have time to act on this. I am bit swamped in my real job and life in general. |
|
split and rebased the sagelib changes in #41728. The mpmath update requires patching sympy, and I personally no longer want to spend any time on sage-the-distro (and, in general, I think it's good to separate the sagelib changes from the sage-the-distro version upgrades whenever possible) |
sagemathgh-41728: Make sagelib compatible with mpmath 1.4 pick sagelib changes from sagemath#40669 and sagemath#38565 for mpmath 1.4 compatibility URL: sagemath#41728 Reported by: Antonio Rojas Reviewer(s):
|
Looks like the most recent PR will make it in |
sagemathgh-41728: Make sagelib compatible with mpmath 1.4 pick sagelib changes from sagemath#40669 and sagemath#38565 for mpmath 1.4 compatibility URL: sagemath#41728 Reported by: Antonio Rojas Reviewer(s):
sagemathgh-41728: Make sagelib compatible with mpmath 1.4 pick sagelib changes from sagemath#40669 and sagemath#38565 for mpmath 1.4 compatibility URL: sagemath#41728 Reported by: Antonio Rojas Reviewer(s):
sagemathgh-41728: Make sagelib compatible with mpmath 1.4 pick sagelib changes from sagemath#40669 and sagemath#38565 for mpmath 1.4 compatibility URL: sagemath#41728 Reported by: Antonio Rojas Reviewer(s):
sagemathgh-41728: Make sagelib compatible with mpmath 1.4 pick sagelib changes from sagemath#40669 and sagemath#38565 for mpmath 1.4 compatibility URL: sagemath#41728 Reported by: Antonio Rojas Reviewer(s):
This branch takes over from #38565 and include fix for the meson build.
It also update to the latest mpmath 1.4.0 alpha release. Releases beyond 1.4.0.a1 have some fix for sagemath but some test may still be broken.
📝 Checklist