 # Math Functions in Python | Set 3 (trigonometric and angle functions)

1. sin () : — This function returns the sine of the value passed as an argument. The value passed to this function must be in radians .

2. cos () : — This function returns the cosine of the value passed as an argument. The value passed to this function must be in radians .

 ` # Python code to demonstrate how it works ` ` # sin () and cos () `   ` # import math for math operations ` ` import ` ` math `   ` a ` ` = ` ` math.pi ` ` / ` ` 6 `   ` # returns sine pi / 6 ` ` print ` ` (` ` "The value of sine of pi / 6 is:" ` `, end ` ` = ` ` "") ` ` print ` ` (math.sin (a)) `   ` # returns cosine pi / 6 value ` ` 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 () : — This function returns the tangent of the value passed as an argument. The value passed to this function must be in radians .

4. hypot (a, b) : — returns the hypotenuse of the values ​​passed in the arguments. Returns numerically sqrt (a * a + b * b) .

 ` # Python code to demonstrate how it works ` ` # tan () and hypot () `   ` # import math for math operations ` ` import ` ` math `   ` a ` ` = ` ` math.pi ` ` / ` ` 6 ` ` b ` ` = ` ` 3 ` ` c ` ` = ` ` 4 `   ` # returning the tangent of pi / 6 ` ` print ` ` (` ` "The value of tangent of pi / 6 is:" ` `, end ` ` = ` ` "") ` ` print ` ` (math. tan (a)) `   # returns hypotenuse 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. degrees () : — This function is used to convert the argument value from radians to degrees .

6. radians () : — This function is used to convert the argument value from degrees to radians .

 ` # Python code to demonstrate how it works ` ` # degrees () and radians () `   ` # import math for math operations ` ` import ` ` math `   ` a ` ` = ` ` math.pi ` ` / ` ` 6 ` ` b ` ` = ` ` 30 `   ` # returns the converted value from radians to degrees ` ` print ` ` (` `" The converted value from radians to degrees is: "` `, end ` ` = ` `" ") ` ` print ` ` (math.degrees (a)) `   ` # returns 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 `

This article courtesy of Manjit Singh . If you are as Python.Engineering and would like to contribute, you can also write an article using contribute.python.engineering or by posting an article contribute @ python.engineering. See my article appearing on the Python.Engineering homepage and help other geeks.