Méthode math.tanh() de Python

Python math 模块Module math de Python

Python math.tanh(x)Renvoie la tangente hyperbolique de x.

Version de Python : 1.4

Syntaxe

La syntaxe de la méthode math.tanh() est la suivante :

math.tanh(x)

Description du paramètre :

  • xx -- Requis, un nombre positif ou négatif. Si x n'est pas un nombre, TypeError est renvoyé.

Valeur de retour

Renvoie un nombre à virgule flottante représentant la tangente hyperbolique d'un nombre.

Exemple

Les exemples suivants renvoient la tangente hyperbolique de différents nombres :

Exemple

# Importer le package math
import math

# Afficher la valeur de la tangente hyperbolique
print(math.tanh(8))
print(math.tanh(1))
print(math.tanh(-6.2))

Résultat de sortie :

0.9999997749296758
0.7615941559557649
-0.9999917628565104

Python math 模块Module math de Python

Autres extensions