numpy.emath.logn#

emath.logn(n, x)[源代码]#

求 x 的以 n 为底的对数.

如果 x 包含负输入,则将在复数域中计算并返回答案.

参数:
narray_like

取对数的整数底数.

xarray_like

需要计算以 n 为底的对数值的值.

返回:
outndarray 或标量

x 值的以 n 为底的对数.如果 x 是一个标量,则 out 也是一个标量,否则返回一个数组.

示例

>>> import numpy as np
>>> np.set_printoptions(precision=4)
>>> np.emath.logn(2, [4, 8])
array([2., 3.])
>>> np.emath.logn(2, [-4, -8, 8])
array([2.+4.5324j, 3.+4.5324j, 3.+0.j    ])