The asinh() function in R is used to calculate the inverse hyperbolic sine of a number. The inverse hyperbolic sine function, often denoted as arsinh or sinh^(-1), is the inverse of the hyperbolic sine function.
Formula
The inverse hyperbolic sine of x is defined as:
Syntax
asinh(x)
Parameters
x: It is a numeric value, array, or vector.
Return value
It returns the inverse hyperbolic sine of the value.
- If the x (input value) is NaN, the result is NaN.
- If the x (input value) is infinite, the result is infinity with the same sign.
Example 1: Basic usage
asinh(0)
asinh(1)
asinh(-3)
Output
[1] 0
[1] 0.8813736
[1] -1.818446
Example 2: Using a complex number
complex_val <- 8 + 9i
asinh(complex_val)
Output
[1] 3.181316+0.842441i
Example 3: Using vector
vec <- c(-1, 0.5, 0, 0.5, 1)
asinh(vec)
Output
[1] -0.8813736 0.4812118 0.0000000 0.4812118 0.8813736
Example 4: Passing a pi
Let’s find the pi constant’s asinh() value.
asinh(pi)
asinh(pi / 4)
Output
[1] 1.862296
[1] 0.7212255
Example 5: Plotting
dt <- seq(-1, 1, by = 0.01)
plot(dt, asinh(dt), type = "l", col = "red")
Output
The function returns the NaN value, so it can’t draw a graph based on that value.
Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.