我正在尝试集成这个函数:
作为一个例子。
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
File "siestats.py", line 349, in NormalDistro
P_inner = scipy.integrate(NDfx,-dev,dev)
TypeError: 'module' object is not callable
我的代码运行如下:
# Definition of the mathematical function:
def NDfx(x):
return((1/math.sqrt((2*math.pi)))*(math.e**((-.5)*(x**2))))
# This Function normailizes x, u, and o2 (position of interest, mean and st dev)
# and then calculates the probability up to position 'x'
def NormalDistro(u,o2,x):
dev = abs((x-u)/o2)
P_inner = scipy.integrate(NDfx,-dev,dev)
P_outer = 1 - P_inner
P = P_inner + P_outer/2
return(P)
NormalDistro函数是用来导入和使用的,格式如下:
foo.NormalDistro(30,2.5,1.25)
作为一个例子。
scipy
,那么您在NDfx
中使用python
的math
函数的理由是什么? - eat