log Python function ()
descrizione
log () restituisce il logaritmo naturale di x.
grammatica
Quanto segue è il metodo log sintassi ():
import math math.log( x )
Nota: log () non è direttamente accessibile, abbiamo bisogno di importare il modulo per la matematica, richiamare il metodo attraverso oggetto statico.
parametri
- x - espressione numerica.
Valore di ritorno
Restituisce il logaritmo naturale di x, x> 0.Esempi
Quanto segue mostra un esempio di utilizzo del metodo 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)
Dopo aver eseguito l'output sopra esempio è:
math.log(100.12) : 4.60636946656 math.log(100.72) : 4.61234438974 math.log(119L) : 4.77912349311 math.log(math.pi) : 1.14472988585