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 ])