logo

Python の数学関数 |セット 3 (三角関数と角度関数)

いくつかの数学関数については、以下のセット 1 とセット 2 で説明します。 Python の数学関数 |セット 1 (数値関数) Python の数学関数 |セット 2 (対数関数とべき乗関数) この記事では、三角関数と角関数について説明します。 1.sin() :- この関数は、 彼らのもの 引数として渡される値。この関数で渡される値は次のとおりです。 ラジアン2.cos() :- この関数は、 余弦 引数として渡される値。この関数で渡される値は次のとおりです。 ラジアン . 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.タン() :- この関数は、 正接 引数として渡される値。この関数で渡される値は次のとおりです。 ラジアン4. ハイポット(a b) :- これは、 斜辺 引数で渡される値。数値的には次の値を返します。 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.度() :- この関数は次の目的で使用されます。 引数値をラジアンから度に変換します6. ラジアン() :- この関数は次の目的で使用されます。 引数値を度からラジアンに変換します . 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