fonction de journal de Python ()
description
log () retourne le logarithme naturel de x.
grammaire
Ce qui suit est la méthode log de syntaxe ():
import math math.log( x )
Remarque: log () ne sont pas directement accessibles, nous avons besoin d'importer le module de mathématiques, invoquer la méthode par objet statique.
Paramètres
- x - expression numérique.
Valeur de retour
Renvoie le logarithme naturel de x, x> 0.Exemples
Le tableau suivant montre un exemple d'utilisation de la méthode log ():
#!/usr/bin/python import math # This will import math module print "math.log(100.12) : ", math.log(100.12) print "math.log(100.72) : ", math.log(100.72) print "math.log(119L) : ", math.log(119L) print "math.log(math.pi) : ", math.log(math.pi)
Après avoir exécuté l'exemple ci-dessus est sortie:
math.log(100.12) : 4.60636946656 math.log(100.72) : 4.61234438974 math.log(119L) : 4.77912349311 math.log(math.pi) : 1.14472988585