Latest web development tutorials

fonction Python tan ()

chiffres Python chiffres Python


description

tan () renvoie le sinus de x radians.


grammaire

Ce qui suit est la syntaxe de méthode tan ():

import math

math.tan(x)

Remarque: tan () ne sont pas directement accessibles, vous devez importer le module de mathématiques, puis appeler la méthode par mathématiques objets statiques.


Paramètres

  • x - une valeur.

Valeur de retour

Retourne le sinus de x en radians, des valeurs comprises entre -1 et 1.


Exemples

L'exemple suivant illustre l'utilisation de tan () méthode Exemple:

#!/usr/bin/python
import math

print "tan(3) : ",  math.tan(3)
print "tan(-3) : ",  math.tan(-3)
print "tan(0) : ",  math.tan(0)
print "tan(math.pi) : ",  math.tan(math.pi)
print "tan(math.pi/2) : ",  math.tan(math.pi/2)
print "tan(math.pi/4) : ",  math.tan(math.pi/4)

Après avoir exécuté l'exemple ci-dessus est sortie:

tan(3) :  -0.142546543074
tan(-3) :  0.142546543074
tan(0) :  0.0
tan(math.pi) :  -1.22460635382e-16
tan(math.pi/2) :  1.63317787284e+16
tan(math.pi/4) :  1.0

chiffres Python chiffres Python