Python Math.sin() Metoda
Przykład
Znajdź sinus różnych liczb:
# 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))
Definicja i użycie
Metoda math.sin()
zwraca sinus liczby.
Uwaga: Aby znaleźć sinus stopni, należy go najpierw przekonwertować na radiany za pomocą metody (patrz przykład poniżej).
math.radians()
Składnia
math.sin(x)
Wartości parametrów
Parameter | Description |
---|---|
x | Required. The number to find the sine of. If the value is not a number, it returns a TypeError |
Szczegóły techniczne
Wartość zwrotu: | Wartość float od -1 do 1, reprezentująca sinus kąta |
---|---|
Wersja Pythona: | 1,4 |
Więcej przykładów
Przykład
Znajdź sinus o różnych stopniach:
# 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)))