R asinh() Function

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:

asinh

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

Usage of the asinh() function

asinh(0)
asinh(1)
asinh(-3)

Output

[1] 0
[1] 0.8813736
[1] -1.818446

Example 2: Using a complex number

Calculating asinh() of the complex number

complex_val <- 8 + 9i

asinh(complex_val)

Output

[1] 3.181316+0.842441i

Example 3: Using vector

Use asinh() function with a 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

Plotting

The function returns the NaN value, so it can’t draw a graph based on that value.

Leave a Comment