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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM