Latest web development tutorials

funzione Python tan ()

figure Python figure Python


descrizione

tan () restituisce il seno di x radianti.


grammatica

Quanto segue è il metodo sintassi tan ():

import math

math.tan(x)

Nota: tan () non è direttamente accessibile, è necessario importare il modulo per la matematica, e quindi chiamare il metodo con oggetti statici matematica.


parametri

  • x - un valore.

Valore di ritorno

Restituisce il seno di x in radianti, i valori tra -1 e 1.


Esempi

L'esempio seguente illustra l'uso di tan () Metodo Esempio:

#!/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)

Dopo aver eseguito l'output sopra esempio è:

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

figure Python figure Python