R Tutorial R Charts & Graphs R Statistics R Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

R - sinh() Function



The R sinh() function returns hyperbolic sine of a value. The hyperbolic sine of x is defined as:

sinh

where e is an Euler's number.

In special cases it returns the following:

  • If the argument is NaN, then the result is NaN.
  • If the argument is infinite, then the result is an infinity with the same sign as the argument.
  • If the argument is zero, then the result is a zero.

Syntax

sinh(x)

Parameters

x Required. Specify column to compute on.

Return Value

Returns the hyperbolic sine of the value.

Example:

In the example below, sinh() function is used to find out the hyperbolic sine of the value.

#operating on single element atomic vector
print(sinh(-5))
print(sinh(0))
print(sinh(5))

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

cat("\nOperating on matrix\n")
#operating on matrix
m <- matrix(c(-5, -2, 0, 2, 5, NaN), nrow=2)
print(sinh(m))

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

The output of the above code will be:

[1] -74.20321
[1] 0
[1] 74.20321

Operating on vector
[1]  0.00000 10.01787 74.20321

Operating on matrix
          [,1]    [,2]     [,3]
[1,] -74.20321 0.00000 74.20321
[2,]  -3.62686 3.62686      NaN

Operating on first column of matrix
[1] -74.20321  -3.62686

❮ R Math Functions

5