Related Tags

r
math
acos
communitycreator

# What is acos() in R?

harris910

The acos()also called the arc cosine function function in R returns the inverse cosine of a number. To be more specific, acos() returns the inverse cosine of a number in radians.

Figure 1 below shows the mathematical representation of the acos() function.

Figure 1: Mathematical representation of inverse cosine function

Figure 2 below shows the visual representation of the acos() function.

Figure 2: Visual representation of inverse cosine 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 radians
a <- acos(0.5);

b <- acos(-0.5);

#applying acos() and then converting the result in radians to degrees
c <- acos(0.5) * (180.0 / pi);
print(paste0("acos(0.5): ", c, " degrees"))


RELATED TAGS

r
math
acos
communitycreator

CONTRIBUTOR

harris910
RELATED COURSES

View all Courses

Keep Exploring

Learn in-demand tech skills in half the time