numpy.log(x[, out] = ufunc ‘log1p’) : This mathematical function helps user to calculate Natural logarithm of x where x belongs to all the input array elements.
Natural logarithm log is the inverse of the exp(), so that log(exp(x)) = x. The natural logarithm is log in base e.
array : [array_like] Input array or object.
out : [ndarray, optional] Output array with same dimensions as Input array, placed with result.
An array with Natural logarithmic value of x; where x belongs to all elements of input array.
Code #1 : Working
Input array : [1, 3, 5, 256] Output array : [ 0. 1.09861229 1.60943791 5.54517744] np.log(4**4) : 5.54517744448 np.log(2**8) : 5.54517744448
Code #2 : Graphical representation
out_array : [ 0. 0.18232156 0.33647224 0.47000363 0.58778666 0.69314718]
- Important differences between Python 2.x and Python 3.x with examples
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Sort Python Dictionaries by Key or Value
- try and except in Python
- chr() in Python
- SHA in Python
- zip() in Python
- Any & All in Python
- gcd() in Python
- Python Set | pop()
- pow() in Python
- SQL using Python | Set 1
- bin() in Python
- abs() in Python
- Python | a += b is not always a = a + b
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.