1

我需要计算一个问题的互补误差函数 (erfc^(1)) 的倒数。

我正在研究它的 Python 工具,许多线程说 Enthought 拥有大部分所需的数学工具,所以我下载并安装在我的本地用户帐户中。但是我不太清楚如何使用它?

有任何想法吗?

4

2 回答 2

8

Enthought Python 发行版中包含的SciPy包含该特殊功能

In [1]: from scipy.special import erfcinv
In [2]: from numpy import linspace
In [3]: x = linspace(0, 1, 10)
In [4]: y = erfcinv(x)
In [5]: y
Out[5]: 
array([  1.27116101e+308,   1.12657583e+000,   8.63123068e-001,
         6.84070350e-001,   5.40731396e-001,   4.16808192e-001,
         3.04570194e-001,   1.99556951e-001,   9.87900997e-002,
         0.00000000e+000])
于 2009-07-29T21:05:17.633 回答
1

下面是一个在 Enthought Python Distribution (EPD) 中使用互补误差函数 ( ) 的逆计算的快速示例,该函数erfcinv包含在 EPD 附带的SciPy包中:

C:\>c:\Python25\python
EPD Py25 (4.1.30101) -- http://www.enthought.com/epd

Python 2.5.2 |EPD Py25 4.1.30101| (r252:60911, Dec 19 2008, 13:49:12) [MSC v.131
0 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy.special import erfcinv
>>> erfcinv(0.)
1.271161006153646e+308
>>> erfcinv(1.)
0.0
>>> erfcinv(2.)
-1.271161006153646e+308
>>> exit()

C:\>
于 2009-07-29T21:16:12.413 回答