The acos()
functionarc cosine
function
Figure 1 shows the mathematical representation of the acos()
function, and Figure 2 shows the visual representation of the acos()
function.
Note: The
math
module is required for this function.
To convert radians
to degrees
, use the following formula:
degrees = radians * ( 180.0 / pi )
acos(num)
This function requires a number as a parameter. The parameter must be a double value between -1 and 1.
acos()
returns the inverse cosine
of a number (radians) that is sent as a parameter. The return value lies in interval [0, pi]
radians.
import math#positive number in radiansprint "The value of acos(0.5) : ", math.acos(0.5), "Radians"#negative number in radiansprint "The value of acos(-0.5) : ", math.acos(-0.5), "Radians"#applying acos() and then converting the result in radians to degrees#radians = 0.5#PI = 3.14159265result = math.acos(0.5) * (180.0 / math.pi)print "The value of acos(0.5) : ", result ,"Degrees"