zxq997

2019-06-13   阅读量: 612

scipy.special

扫码加入数据分析学习群

子模块 scipy.special 。如果你希望对你的数据进行一些更晦涩的数学计算, scipy.special 可能包含了你需要的计算函数。

这些函数能列一个长长的列表,下面的代码片段展示了一些可能在统计学中用到的函数:

In[21]: from scipy import special
In[22]: # Gamma函数(广义阶乘,generalized factorials)和相关函数
x = [1, 5, 10]
print("gamma(x) =", special.gamma(x))
print("ln|gamma(x)| =", special.gammaln(x))
print("beta(x, 2) =", special.beta(x, 2))
gamma(x) = [ 1.00000000e+00 2.40000000e+01 3.62880000e+05]
ln|gamma(x)| = [ 0. 3.17805383 12.80182748]
beta(x, 2) = [ 0.5 0.03333333 0.00909091]
In[23]: # 误差函数(高斯积分)
# 它的实现和它的逆实现
x = np.array([0, 0.3, 0.7, 1.0])
print("erf(x) =", special.erf(x))
print("erfc(x) =", special.erfc(x))
print("erfinv(x) =", special.erfinv(x))
erf(x) = [ 0. 0.32862676 0.67780119 0.84270079]
erfc(x) = [ 1. 0.67137324 0.32219881 0.15729921]
erfinv(x) = [ 0. 0.27246271 0.73286908 inf]

NumPy 和 scipy.special 中提供了大量的通用函数,

添加CDA认证专家【维克多阿涛】,微信号:【cdashijiazhuang】,提供数据分析指导及CDA考试秘籍。已助千人通过CDA数字化人才认证。欢迎交流,共同成长!
119.8891 1 1 关注作者 收藏

评论(0)


暂无数据

推荐课程