MCPcopy Index your code
hub / github.com/numpy/numpy / logn

Function logn

numpy/lib/_scimath_impl.py:349–382  ·  view source on GitHub ↗

Take log base n of x. If `x` contains negative inputs, the answer is computed and returned in the complex domain. Parameters ---------- n : array_like The integer base(s) in which the log is taken. x : array_like The value(s) whose log base `n` is (are) r

(n, x)

Source from the content-addressed store, hash-verified

347@set_module('numpy.lib.scimath')
348@array_function_dispatch(_logn_dispatcher)
349def logn(n, x):
350 """
351 Take log base n of x.
352
353 If `x` contains negative inputs, the answer is computed and returned in the
354 complex domain.
355
356 Parameters
357 ----------
358 n : array_like
359 The integer base(s) in which the log is taken.
360 x : array_like
361 The value(s) whose log base `n` is (are) required.
362
363 Returns
364 -------
365 out : ndarray or scalar
366 The log base `n` of the `x` value(s). If `x` was a scalar, so is
367 `out`, otherwise an array is returned.
368
369 Examples
370 --------
371 >>> import numpy as np
372 >>> np.set_printoptions(precision=4)
373
374 >>> np.emath.logn(2, [4, 8])
375 array([2., 3.])
376 >>> np.emath.logn(2, [-4, -8, 8])
377 array([2.+4.5324j, 3.+4.5324j, 3.+0.j ])
378
379 """
380 x = _fix_real_lt_zero(x)
381 n = _fix_real_lt_zero(n)
382 return nx.log(x) / nx.log(n)
383
384
385@set_module('numpy.lib.scimath')

Callers

nothing calls this directly

Calls 1

_fix_real_lt_zeroFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…