python的对数

时间:2025-04-10 22:47:42
首先要导入 math 模块: import math import numpy as np math.log(8,2),此为以2为底8的对数 等于 math.log2(8); 等于np.log2(8) 自然对数: 以e为底的对数。 e = math.e 约等于 2.718281828459045; x的自然对数为: math.log(x,math.e); 等于(x)。