The math.acos()
function returns the trigonometric inverse cosine(arc cosine) of a number.
math.acos(x)
Where x
is the number for which you want to find the inverse cosine.
The function calculates the angle (in radians) whose cosine is equal to x.
import math
number = 0.5
inverse_cosine = math.acos(number)
print(inverse_cosine)
In the above case, the inverse cosine of 0.5 is approximately 1.0471975511965979
radians.
We can use the math.degrees function to turn the radians into degrees.
import math
number = 0.5
inverse_cosine = math.acos(number)
print(math.degrees(inverse_cosine))
import math
print(math.degrees(math.acos(0.7071067811865476)))
print(math.degrees(math.acos(0.30901699437494745)))
print(math.degrees(math.acos(0.17364817766693041)))