log() exp()函数

1 对数函数表示法

import numpy as np
import math
print('输出自然底数e:',math.e)

# np表示法
# np.log()是以e为底的自然对数
print(np.log(math.e))
# np.log10是以10为底的对数函数  这种写法只可表示底为2和10的对数函数
print(np.log10(10))
# np.log1p()表示ln(1+x)
print(np.log1p(math.e-1))

# math表示法
# 任意的对数函数表示方法,第一个数是幂,第二个是底数
print(math.log(64, 2))
View Code

 参考:https://www.runoob.com/python/func-number-log.html

2 指数函数表示法

import numpy as np
import math

# np表示法
# np.exp()是以e为底的自然对数
print(np.exp(1))
# np.expm1()表示exp(x)-1,输入的可以是普通数字也可以是数组
print(np.expm1(1))

# math表示法
print(math.exp(1))
# 任意的对数函数表示方法,第一个数是底数,第二个是指数
print(math.pow(2,6))
View Code

参考:https://www.runoob.com/python/func-number-exp.html

          https://blog.csdn.net/jhjbjbn/article/details/44776089

posted on 2019-10-16 12:51  吃我一枪  阅读(1927)  评论(0编辑  收藏  举报

导航