R Tutorial R Charts & Graphs R Statistics R References

R - acosh() Function



The R acosh() function returns inverse hyperbolic cosine of a value. The inverse hyperbolic cosine of x is defined as:

acosh

where e is an Euler's number.

In special cases it returns the following:

  • If the argument is NaN or less than 1, then the result is NaN.
  • If the argument is positive infinite, then the result is positive infinity.

Syntax

acosh(x)

Parameters

x Required. Specify column to compute on.

Return Value

Returns the inverse hyperbolic cosine of the value.

Example:

In the example below, acosh() function is used to find out the inverse hyperbolic cosine of the value.

#operating on single element atomic vector
print(acosh(1))
print(acosh(3))
print(acosh(5))

cat("\nOperating on vector\n")
#operating on vector
v <- c(1, 3, 5)
print(acosh(v))

cat("\nOperating on matrix\n")
#operating on matrix
m <- matrix(c(1, 3, 5, 7, 10, NaN), nrow=2)
print(acosh(m))

cat("\nOperating on first column of matrix\n")
#operating on first column of matrix
print(acosh(m[,1]))

The output of the above code will be:

[1] 0
[1] 1.762747
[1] 2.292432

Operating on vector
[1] 0.000000 1.762747 2.292432

Operating on matrix
         [,1]     [,2]     [,3]
[1,] 0.000000 2.292432 2.993223
[2,] 1.762747 2.633916      NaN

Operating on first column of matrix
[1] 0.000000 1.762747

❮ R Math Functions