Open In App

Calculate Inverse cosine of a value in R Programming – acos() Function

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

acos() function in R Language is used to calculate the inverse cosine value of the numeric value passed to it as argument.

Syntax: acos(x)

Parameter:
x: Numeric value

Example 1:




# R code to calculate inverse cosine of a value
  
# Assigning values to variables 
x1 <- -1
x2 <- 0.5
  
# Using acos() Function
acos(x1)
acos(x2)


Output:

[1] 3.141593
[1] 1.047198

Example 2:




# R code to calculate inverse cosine of a value
  
# Assigning values to variables
x1 <- 0.224587
x2 <- 0.456732
  
# Using acos() Function
acos(x1)
acos(x2)


Output:

[1] 1.344277
[1] 1.096478

Last Updated : 01 Jun, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads