Python Numpy.log() - Logarithme
-
Syntaxe de
numpy.log()
-
Exemples de codes:
numpy.log()
-
Exemples de codes:
numpy.log2()
- Numpy Log Base 2 -
Exemples de codes:
numpy.log10()
- Numpy Log Base 10
La fonction Numpy.log()
calcule le logarithme naturel de chaque élément du tableau donné.
Syntaxe de numpy.log()
numpy.log(arr)
Paramètres
arr |
tableau d’entrée |
Revenir
Il retourne un tableau du logarithme naturel de chaque élément du tableau d’entrée.
Exemples de codes: numpy.log()
import numpy as np
arr = [1, np.e, np.e**2, np.e**3]
print(np.log(arr))
Production:
[0. 1. 2. 3.]
Exemples de codes: numpy.log2()
- Numpy Log Base 2
numpy.log2()
est similaire à numpy.log()
, mais a la base comme 2 au lieu de e
.
import numpy as np
arr = [1, 2, np.e, 4]
print(np.log2(arr))
Production:
[0. 1. 1.44269504 2.]
Exemples de codes: numpy.log10()
- Numpy Log Base 10
numpy.log10()
est similaire à numpy.log()
, mais a la base comme 10 au lieu de e
.
import numpy as np
arr = [1, np.e, 10, 100]
print(np.log10(arr))
Production:
[0. 0.43429448 1. 2.]
Founder of DelftStack.com. Jinku has worked in the robotics and automotive industries for over 8 years. He sharpened his coding skills when he needed to do the automatic testing, data collection from remote servers and report creation from the endurance test. He is from an electrical/electronics engineering background but has expanded his interest to embedded electronics, embedded programming and front-/back-end programming.
LinkedIn Facebook