Latest web development tutorials

python3 función tan ()

python3 digitales python3 digitales


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

Después de ejecutar la salida anterior ejemplo es:

(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 digitales python3 digitales