2019-03-04
阅读量:
655
python中的expm1库
Python有数学库,并且有许多与之相关的功能。一个这样的功能是expm1()
。此函数以数学方式计算值exp(x) - 1
。如果我们需要计算这个值,可以使用此方法。
语法: math.expm1()
参数:
x:必须计算exp(x)-1的数字。
返回:返回“exp(x)-1”的计算值
代码:演示expm1()的工作情况
# Python3 code to demonstrate
# the working of expm1()
import math
# initializing the value
test_int = 4
test_neg_int = -3
# checking expm1() values
# doesn't throw error with negative
print ("The expm1 value using positive integer : "
+ str(math.expm1(test_int)))
print ("The expm1 value using negative integer : "
+ str(math.expm1(test_neg_int)))
输出 :
The expm1 value using positive integer : 53.598150033144236
The expm1 value using negative integer : -0.950212931632136






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论