0

我已经在我的 Windows 计算机上的 Anaconda 中安装了 mpmath 0.19 版,并且正在使用 Spyder。我运行了 runtests(),一切都被列为 OK。不过,我无法让 2017 invertlaplace() 函数工作。似乎python找不到命令,因为我得到了错误:NameError: name 'invertlaplace' is not defined

有任何想法吗 ?

我运行的代码几乎就是文档中的代码:

from mpmath import *
mp.dps = 15; mp.pretty = True
tt = [0.001, 0.01, 0.1, 1, 10] #evaluation points
fp = lambda p: 1/(p+1)**2
ft = lambda t: t*exp(-t)
invertlaplace(fp,tt[1],method='talbot')
ft(tt[2]),ft(tt[2])-invertlaplace(fp,tt[2],method='talbot')
print('The numerical inverse laplace transform  of fp at .001 is ', 
ft(tt[0]),ft(tt[0])-invertlaplace(fp,tt[0],method='talbot'))
4

1 回答 1

0

尝试升级 mpmath。你可以这样做: pip3 install --upgrade mpmath

于 2020-10-08T20:52:37.863 回答