Latest web development tutorials

fonction python3 tan ()

python3 numérique python3 numérique


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/python3
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.1425465430742778
tan(-3) :  0.1425465430742778
tan(0) :  0.0
tan(math.pi) :  -1.2246467991473532e-16
tan(math.pi/2) :  1.633123935319537e+16
tan(math.pi/4) :  0.9999999999999999

python3 numérique python3 numérique