Python math.sin() Metodo
Esempio
Trova il seno di diversi numeri:
# 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))
Definizione e utilizzo
Il math.sin()
metodo restituisce il seno di un numero.
Nota: per trovare il seno dei gradi, è necessario prima convertirlo in radianti con il metodo (vedi esempio sotto).
math.radians()
Sintassi
math.sin(x)
Valori dei parametri
Parameter | Description |
---|---|
x | Required. The number to find the sine of. If the value is not a number, it returns a TypeError |
Dettagli tecnici
Valore di ritorno: | Un float valore, da -1 a 1, che rappresenta il seno di un angolo |
---|---|
Versione Python: | 1.4 |
Altri esempi
Esempio
Trova il seno di diversi gradi:
# 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)))