¿Existe una función incorporada para encontrar logaritmos en Python?
¿Existe una función incorporada para encontrar logaritmos en Python?
El método log() devuelve el logaritmo natural de x si x>0.
Sintaxis
La siguiente es la sintaxis del método log():
p>
#! /usr/bin/python
importar matemáticas # Importará el módulo de matemáticas
imprimir "math.log(100.12): ", math.log(100.12)
imprimir "math.log(100.72) : ", math.log(100.72)
imprimir "math.log(119L) : ", math.log(119L)
print "math.log(math.pi) : ", math.log(math.pi)
Cuando ejecutamos el programa anterior, se producirán los siguientes resultados:
matemáticas .log(100.12): 4.60636946656
math.log(100.72): 4.61234438974
math.log(119L): 4.77912349311
math.log(math. pi): 1,14472988585