logo

Matematické funkcie v Pythone | Sada 3 (trigonometrické a uhlové funkcie)

Niektoré z matematických funkcií sú opísané nižšie v súbore 1 a množine 2 Matematické funkcie v Pythone | Sada 1 (numerické funkcie) Matematické funkcie v Pythone | Sada 2 (Logaritmické a výkonové funkcie) V tomto článku sa diskutuje o goniometrických a uhlových funkciách. 1. hriech() :- Táto funkcia vráti ich hodnoty odovzdanej ako argument. Hodnota odovzdaná v tejto funkcii by mala byť in radiánov . 2. cos() :- Táto funkcia vráti kosínus hodnoty odovzdanej ako argument. Hodnota odovzdaná v tejto funkcii by mala byť in radiánov . Python
# Python code to demonstrate the working of # sin() and cos() # importing 'math' for mathematical operations import math a = math.pi/6 # returning the value of sine of pi/6 print ('The value of sine of pi/6 is : ' end='') print (math.sin(a)) # returning the value of cosine of pi/6 print ('The value of cosine of pi/6 is : ' end='') print (math.cos(a)) 
Output:
The value of sine of pi/6 is : 0.49999999999999994 The value of cosine of pi/6 is : 0.8660254037844387 

3. tan() :- Táto funkcia vráti dotyčnica hodnoty odovzdanej ako argument. Hodnota odovzdaná v tejto funkcii by mala byť in radiánov . 4. hypot(a b) :- Toto vráti hypotenzia z hodnôt odovzdaných v argumentoch. Číselne vráti hodnotu sqrt(a*a + b*b) . Python
# Python code to demonstrate the working of # tan() and hypot() # importing 'math' for mathematical operations import math a = math.pi/6 b = 3 c = 4 # returning the value of tangent of pi/6 print ('The value of tangent of pi/6 is : ' end='') print (math.tan(a)) # returning the value of hypotenuse of 3 and 4 print ('The value of hypotenuse of 3 and 4 is : ' end='') print (math.hypot(bc)) 
Output:
The value of tangent of pi/6 is : 0.5773502691896257 The value of hypotenuse of 3 and 4 is : 5.0 

5. stupňov() :- Táto funkcia sa používa previesť hodnotu argumentu z radiánov na stupne . 6. radiány() :- Táto funkcia sa používa previesť hodnotu argumentu zo stupňov na radiány . Python
# Python code to demonstrate the working of # degrees() and radians() # importing 'math' for mathematical operations import math a = math.pi/6 b = 30 # returning the converted value from radians to degrees print ('The converted value from radians to degrees is : ' end='') print (math.degrees(a)) # returning the converted value from degrees to radians print ('The converted value from degrees to radians is : ' end='') print (math.radians(b)) 
Output:
The converted value from radians to degrees is : 29.999999999999996 The converted value from degrees to radians is : 0.5235987755982988