The arccosine of x is defined as the inverse cosine function of x when -1≤x≤1.
When the cosine of y is equal to x:
cos y = x
Then the arccosine of x is equal to the inverse cosine function of x, which is equal to y:
arccos x = cos^-1 x = y
Here cos-1 x means the inverse cosine and does not mean cosine to the power of -1.
acosh in R
To calculate the hyperbolic arccosine in R, use the acosh() function. The inverse hyperbolic cosine function is defined by x == cosh(y). The acosh(x) returns the inverse hyperbolic cosine of the elements of x when x is a REAL scalar, vector, matrix, or array. The result has the same shape as x.
Syntax
acosh(x)
Parameters
x: It is a numeric value, array, or vector.
Example
Let’s calculate the acosh value of 1.
acosh(1)
Output
[1] 0
If you pass the 0 to the atanh() function, it will return 0.
acosh(0)
Output
[1] 0
Calculating acosh() of complex number
Define a complex value and pass that value to the acosh() function.
dt <- 8 + 9i
acosh(dt)
Output
[1] 3.181721+0.845865i
Plotting the acosh() function to a graph
We can use the seq() function to create a series of values and pass that to the plot() function, which will create a line chart.
dt <- seq(-1, 1, by = 0.01)
plot(dt, acosh(dt), type = "l", col = "red")
Output
Warning message:
In acosh(dt) : NaNs produced
The function returns the NaN value that is why it can’t draw a graph based on that value.
Applying acosh() function to a Vector
To create a Vector in R, use the c() function. Then pass that vector to the acosh() function.
rv <- c(-1, 0.5, 0, 0.5, 1)
acosh(rv)
Output
[1] NaN NaN NaN NaN 0
Warning message:
In acosh(rv) : NaNs produced
Passing a pi to the acosh() function
The pi is an inbuilt constant in R programming, and its value is 3.141593.
Let’s find the pi constant’s acosh() value.
acosh(pi)
Output
[1] 1.811526
Let’s see another example of pi.
acosh(pi / 4)
Output
[1] NaN
Warning message:
In acosh(pi/4) : NaNs produced
That is it for acosh() function in R programming.
See also

Krunal Lathiya is an Information Technology Engineer by education and web developer by profession. He has worked with many back-end platforms, including Node.js, PHP, and Python. In addition, Krunal has excellent knowledge of Data Science and Machine Learning, and he is an expert in R Language. Krunal has written many programming blogs, which showcases his vast expertise in this field.