How to calculate arccosine in Python
To find the arccosine (arccos) in Python you can use the acos() function of the math module.
acos(x)
The parameter x is the cosine value of an angle θ measured in radians.
The function outputs the arccosine.
What is the arccosine? It is the inverse trigonometric function of the cosine, arccos = cos-1. This function finds the amplitude of the angle that determines a particular cosine value.
Examples
Example 1
Given a cosine cos θ equal 0.25, find the angle θ which determines it.
>>> from math import acos
>>> x=0.25
>>> acos(x)
The result of the acos() function is the arcsine
1.318116071652818
This value is the amplitude of the angle θ which determines the value cos θ = 0.25.
The angle θ measures 1.318116071652818 radians (approximately 75.52 °).
Verify
To verify the result, calculate the cosine of the angle 1.318116071652818
>>> from math import cos
>>> x= 1.318116071652818
>>> cos(x)
The result of the cos function is 0.25
0.25