Numpy log1p() is a mathematical function that helps the user to calculate the natural logarithmic value of x+1 where x belongs to all the input array elements. log1p is reverse of exp(x) – 1.

Numpy log1p()

**Numpy log() function is used to get the natural logarithm of value x+1, where x is an element of an array or x is an object. **The log1p is the reverse of exp(x) – 1.

Syntax

numpy.log1p(array[, out] = ufunc ‘log1p’)

Parameters

The np log1p() function can take up to two main arguments:

  1. array: This is the input array or the object whose log is to be calculated. But the function will add 1 with all elements of the array.
  2. out: This is an optional field. A position the result is stored in. If the given, it must have the form to which the inputs convey. If not given or None, it returns a freshly-allocated list. A tuple must have length the same to the number of outputs (possible only as a keyword argument).

#numpy #python

Numpy log1p Example | np log1p() in Python
18.35 GEEK