Sympy installed but sympy.mpmath not found

I want to use the jacobDN function in sympy, so I load it and python setup.py install , successfully.

When I want to use it, as in the documentation , follow these steps:

 >>> from sympy.mpmath import * Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named mpmath >>> 

Import everything from sympy successfully:

 >>> from sympy import * >>> 

Then I installed mpmath separately, then I can use the elliphone from mpmath. However, annoying mpf shown:

 >>> from mpmath import * >>> ellipfun('dn',0.5,0.5) mpf('0.94297242577738571') >>> 

The question is how to use ellipfun under sympy.mpmath? How to check my installation defects?

The solution to the above is the best! If it fails, how can I use ellipfun in mpmath in the same way as with regular functions?

confirmation of successful sympy installation

 -> ~$ pip show sympy --- Name: sympy Version: 0.7.7.dev Location: /usr/local/lib/python2.7/dist-packages/sympy-0.7.7.dev-py2.7.egg Requires: mpmath -> ~$ pip install --upgrade sympy Requirement already up-to-date: sympy in /usr/local/lib/python2.7/dist-packages/sympy-0.7.7.dev-py2.7.egg Requirement already up-to-date: mpmath>=0.19 in /usr/local/lib/python2.7/dist-packages/mpmath-0.19-py2.7.egg (from sympy) Cleaning up... 
+5
source share
2 answers

In the SymPy development version that you installed, sympy.mpmath been removed. mpmath is now an external library, so you need to install and import it separately, as you did.

The two versions are the same (there were no mpmath releases at that time).

As I know,

mpmath does not support numpy arrays. You need to use scipy.special if you want to do this. You should use mpmath only if you are interested in multi-point floats (beyond the accuracy of the machine). If you are interested in this, you can also use sympy.Float , which is a wrapper around mpf that mpf great with SymPy objects.

+3
source

I would recommend using a version without development. SymPy 0.7.6 is the latest version to have mpmath packaged with SymPy. In the future it will be addiction. Since you installed the development version, you need to install mpmath yourself.

+1
source

Source: https://habr.com/ru/post/1237892/


All Articles