2017-08-03 131 views
0

我正在使用Python35。我想使用this question中使用的mpmath.invertlaplace函数。不幸的是我有一些麻烦:在python中找不到mpmath包

>>> import mpmath as mp 
>>> import numpy as np 
>>> def f(s): 
    return(1/s) 

>>> t = np.linspace(0.01,0.5,10) 
>>> G = [] 
>>> for i in range(0,10): 
    G.append(mp.invertlaplace(f, t[i], method = 'dehoog', degree = 18)) 


Traceback (most recent call last): 
    File "<pyshell#254>", line 2, in <module> 
    G.append(mp.invertlaplace(f, t[i], method = 'dehoog', degree = 18)) 
AttributeError: module 'mpmath' has no attribute 'invertlaplace' 

此功能是否最近添加为Python35拿起?我在这里错过了什么吗?我觉得这应该工作...

+0

更新包到最新版本? –

+0

我正在使用pip ...我该怎么做? – user32882

+0

'pip install mpmath --upgrade'? –

回答

0

对于mpmath.invertlaplace()函数,你需要点子

利用现有mpmath的版本在 https://github.com/klkuhlm/mpmath

这是一个不同的版本,一个安装

我试过你的代码与Python3.6和github版本的mpmath,并且它工作正常。

下载并解压缩zip文件,安装说明在README.rst文件(基本上,须藤蟒蛇的setup.py安装)