python math.erf()方法,误差函数
math.erf()语法
erf(x, /)
python源码中对erf()方法的介绍
Error function at x.
即,math.erf()方法返回参数指定的值的误差函数。
erf()参数
参数 | 描述 |
---|---|
x | real number,值介于-inf负无穷大到inf正无穷大之间 |
erf()返回值
python float浮点数类型的值,且介于-1到1之间。
math.erf()实例代码
>>> import math
>>> math.erf(1)
0.8427007929497148
>>> math.erf(3)
0.9999779095030015
>>> math.erf(1000000)
1.0
>>> math.erf(100000000000000)
1.0
>>> math.erf('1') #参数must be real number
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: must be real number, not str