Python Función sin()
Descripción
sin()Devuelve el seno de x en radianes.
Sintaxis
La sintaxis del método sin() es la siguiente:
import math math.sin(x)
Nota:No se puede acceder a sin() directamente, es necesario importar el módulo math y luego llamar a este método a través del objeto estático math.
Parámetros
- x -- Un valor numérico.
Valor de retorno
Devuelve el seno de x en radianes, con un valor entre -1 y 1.
Ejemplo
A continuación se muestra un ejemplo que utiliza el método sin():
Ejemplo
#!/usr/bin/python
import math
print "sin(3) : ", math.sin(3)
print "sin(-3) : ", math.sin(-3)
print "sin(0) : ", math.sin(0)
print "sin(math.pi) : ", math.sin(math.pi)
print "sin(math.pi/2) : ", math.sin(math.pi/2)
import math
print "sin(3) : ", math.sin(3)
print "sin(-3) : ", math.sin(-3)
print "sin(0) : ", math.sin(0)
print "sin(math.pi) : ", math.sin(math.pi)
print "sin(math.pi/2) : ", math.sin(math.pi/2)
El resultado de ejecutar el ejemplo anterior es:
sin(3) : 0.14112000806 sin(-3) : -0.14112000806 sin(0) : 0.0 sin(math.pi) : 1.22460635382e-16 sin(math.pi/2) : 1Otras extensiones
Números de Python