Matemātiskās funkcijas Python | 3. kopa (trigonometriskās un leņķiskās funkcijas)
Dažas no matemātiskajām funkcijām ir aplūkotas tālāk 1. un 2. komplektā Matemātiskās funkcijas Python | 1. kopa (ciparu funkcijas) Matemātiskās funkcijas Python | 2. kopa (logaritmiskās un jaudas funkcijas) Šajā rakstā ir apskatītas trigonometriskās un leņķiskās funkcijas. 1. grēks() :- Šī funkcija atgriež savējie vērtība tika nodota kā arguments. Šajā funkcijā nodotajai vērtībai ir jābūt iekšā radiāni . 2. cos() :- Šī funkcija atgriež kosinuss vērtība tika nodota kā arguments. Šajā funkcijā nodotajai vērtībai ir jābūt iekšā radiāni . Python
3. iedegums() :- Šī funkcija atgriež pieskares vērtība tika nodota kā arguments. Šajā funkcijā nodotajai vērtībai ir jābūt iekšā radiāni . 4. hipotēze(a b) :- Tas atgriež hipotenūza no argumentos nodotajām vērtībām. Skaitliski tas atgriež vērtību sqrt(a*a+b*b) . Python
5. grādi() :- Šī funkcija tiek izmantota konvertēt argumenta vērtību no radiāniem uz grādiem . 6. radiāni() :- Šī funkcija tiek izmantota konvertēt argumenta vērtību no grādiem uz radiāniem . 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. iedegums() :- Šī funkcija atgriež pieskares vērtība tika nodota kā arguments. Šajā funkcijā nodotajai vērtībai ir jābūt iekšā radiāni . 4. hipotēze(a b) :- Tas atgriež hipotenūza no argumentos nodotajām vērtībām. Skaitliski tas atgriež vērtību 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 ( b c ))
Output: The value of tangent of pi/6 is : 0.5773502691896257 The value of hypotenuse of 3 and 4 is : 5.0
5. grādi() :- Šī funkcija tiek izmantota konvertēt argumenta vērtību no radiāniem uz grādiem . 6. radiāni() :- Šī funkcija tiek izmantota konvertēt argumenta vērtību no grādiem uz radiāniem . 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