Skip to content

Incompatibilities in Sage mpmath cause downstream issues in SymPy #25445

Open
passagemath/passagemath
#22
@asmeurer

Description

@asmeurer

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 of mpf and mpc 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:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions