logo

Matematikai függvények Pythonban | 3. halmaz (trigonometrikus és szögfüggvények)

Néhány matematikai függvényt az alábbi 1. és 2. halmaz tárgyal Matematikai függvények Pythonban | 1. készlet (numerikus függvények) Matematikai függvények Pythonban | 2. halmaz (logaritmikus és hatványfüggvények) Ebben a cikkben a trigonometrikus és a szögfüggvényeket tárgyaljuk. 1. bűn() :- Ez a függvény a övék argumentumként átadott érték. Az ebben a függvényben átadott értéknek ben kell lennie radiánok . 2. cos() :- Ez a függvény a koszinusz argumentumként átadott érték. Az ebben a függvényben átadott értéknek ben kell lennie radiánok . 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. barna() :- Ez a függvény a tangens argumentumként átadott érték. Az ebben a függvényben átadott értéknek ben kell lennie radiánok . 4. hipotézis(a b) :- Ez visszaadja a átfogó az argumentumokban átadott értékek közül. Számszerűen az értékét adja vissza 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. fok() :- Ezt a funkciót használják konvertálja az argumentum értékét radiánról fokra . 6. radián() :- Ezt a funkciót használják konvertálja az argumentum értékét fokról radiánra . 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