Método Python math.sin()
Ejemplo
Encuentra el seno de diferentes números:
# Import math Library
import math
# Return the sine of different
values
print (math.sin(0.00))
print (math.sin(-1.23))
print (math.sin(10))
print (math.sin(math.pi))
print
(math.sin(math.pi/2))
Definición y uso
El math.sin()
método devuelve el seno de un número.
Nota: Para encontrar el seno de grados, primero debe convertirse a radianes con el método (vea el ejemplo a continuación).
math.radians()
Sintaxis
math.sin(x)
Valores paramétricos
Parameter | Description |
---|---|
x | Required. The number to find the sine of. If the value is not a number, it returns a TypeError |
Detalles técnicos
Valor devuelto: | Un float valor, de -1 a 1, que representa el seno de un ángulo |
---|---|
Versión de Python: | 1.4 |
Más ejemplos
Ejemplo
Encuentre el seno de diferentes grados:
# Import math Library
import math
# Return the sine value of 30
degrees
print(math.sin(math.radians(30)))
# Return the sine value
of 90 degrees
print(math.sin(math.radians(90)))