Description
The Sage mpmath has some incompatibilities with non-sage mpmath, which causes some issues in SymPy, since mpmath always uses the Sage backend if Sage is installed.
You can get a full idea of the issues by running the SymPy tests in Sage (import sympy;sympy.test()). A few failures are also due to some gmpy2 issues (gmpy2 types fail on Sage integers).
The issues I've noticed so far are:
-
The sage mpmath types do not subclass from
mpmath.ctx_mp.mpnumeric
, which is the base class ofmpf
andmpc
according to its own docstring. -
The sage
mpf
type does not have a context attribute.
Another issue, reported in sympy/sympy#19690:
import sympy.physics
from sympy.physics.units import meter
import copy
copy.deepcopy(3.7*meter)
[...]
File "sage/rings/integer.pyx", line 7143, in sage.rings.integer.mpz_set_str_python (build/cythonized/sage/rings/inte
ger.c:43554)
TypeError: unable to convert '0xecccccccccccd' to an integer
(fixed in sympy/sympy#21996, merged for inclusion in Sympy 1.9)
References:
- Install Sage on Travis using conda-forge sympy/sympy#14703
- doctesting
sage-9.3.beta
failures cschwan/sage-on-gentoo#628 - Enable sage backend by default only if SAGE_ROOT is set mpmath/mpmath#466
- sage-devel, 2021-03, pointy python question related to sage
- sage-devel, 2021-03, Running MathicsSession inside Sage
- Explicitly set MPMATH_SAGE env variable #32799: Explicitly set MPMATH_SAGE env variable
CC: @antonio-rojas @kiwifb @fredrik-johansson @isuruf @nbruin @saraedum @slel @soehms @strogdon @videlec
Component: distribution
Keywords: mpmath
Issue created by migration from https://trac.sagemath.org/ticket/25445