acosh in R: How to Use acosh() Function in R

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.




x: It is a numeric value, array, or vector.


Let’s calculate the acosh value of 1.



[1] 0

If you pass the 0 to the atanh() function, it will return 0.



[1] 0

Calculating acosh() of complex number

Define a complex value and pass that value to the acosh() function.

dt <- 8 + 9i


[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")


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)


[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.



[1] 1.811526

Let’s see another example of pi.

acosh(pi / 4)


[1] NaN
Warning message:
In acosh(pi/4) : NaNs produced

That is it for acosh() function in R programming.

See also

R atanh()

R acos()

R asin()

R atan()

R tan()

Leave a Comment