What is acos() in R?
The acos()arc cosine functionacos() returns the inverse cosine of a number in radians.
Figure 1 below shows the mathematical representation of the acos() function.
Figure 2 below shows the visual representation of the acos() function.
Methodology
To convert radians to degrees, use the following formula:
degrees = radians * ( 180.0 / pi )
Syntax
acos(num)
Parameter
The acos() function requires a number as a parameter.
Return value
acos() returns the inverse cosine of the number that is sent as a parameter. The return value lies in interval [0, pi] radians.
Code
#Positive number in radiansa <- acos(0.5);print(paste0("acos(0.5): ", a, " radians"))#negative number in radiansb <- acos(-0.5);print(paste0("acos(-0.5): ", b, " radians"))#applying acos() and then converting the result in radians to degrees#radians = 0.5c <- acos(0.5) * (180.0 / pi);print(paste0("acos(0.5): ", c, " degrees"))
Free Resources
Attributions:
- undefined by undefined