Latest web development tutorials

fonction de journal de python3 ()

python3 numérique python3 numérique


description

log () retourne le logarithme naturel de x, x> 0.


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/python3
import math   # 导入 math 模块

print ("math.log(100.12) : ", math.log(100.12))
print ("math.log(100.72) : ", math.log(100.72))
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.6063694665635735
math.log(100.72) :  4.612344389736092
math.log(math.pi) :  1.1447298858494002

python3 numérique python3 numérique