Latest web development tutorials

función de Python tan ()

cifras Python cifras Python


descripción

tan () devuelve el seno de x radianes.


gramática

El siguiente es el método de sintaxis tan ():

import math

math.tan(x)

Nota: tan () no es directamente accesible, debe importar el módulo de matemáticas, y luego llamar al método por objetos estáticos matemáticas.


parámetros

  • x - un valor.

Valor de retorno

Devuelve el seno de x en radianes, los valores entre -1 y 1.


Ejemplos

Lo siguiente ilustra el uso de tan () método de Ejemplo:

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

Después de ejecutar la salida anterior ejemplo es:

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

cifras Python cifras Python