Metoda Python math.sin().
Příklad
Najděte sinus různých čísel:
# 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))
Definice a použití
Metoda math.sin()
vrací sinus čísla.
Poznámka: Chcete-li najít sinus stupňů, musíte jej nejprve převést na radiány pomocí metody (viz příklad níže).
math.radians()
Syntax
math.sin(x)
Hodnoty parametrů
Parameter | Description |
---|---|
x | Required. The number to find the sine of. If the value is not a number, it returns a TypeError |
Technické údaje
Návratová hodnota: | Hodnota float od -1 do 1 představující sinus úhlu |
---|---|
Verze Pythonu: | 1.4 |
Další příklady
Příklad
Najděte sinus různých stupňů:
# 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)))