numpy.lib.scimath.logn#
- lib.scimath.logn(n, x)[源代码]#
计算 x 的以 n 为底的对数。
如果 x 包含负输入,则在复数域中计算并返回结果。
- 参数:
- narray_like
计算对数的整数底数。
- xarray_like
需要计算以 n 为底的对数的值。
- 返回:
- outndarray 或 scalar
以 n 为底的 x 的对数。如果 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 ])