How to Use the sinh() Function in R

The sinh() function in R is used to return the hyperbolic sine of a number in radians”. It takes a numerical value as an argument and returns the hyperbolic sine value of the numeric value.

Syntax

sinh(x)

Parameters

x: It is a numeric value.

Return value

The sinh() function returns a number’s hyperbolic sine (in radians), which is sent as a parameter.

Example 1: R program of sinh() function

sinh(0)
sinh(1)

Output

[1] 0
[1] 1.175201

Example 2: Calculating sinh() of a complex number

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

d <- 5 + 1i
sinh(d)

Output

[1] 40.09217+62.44552i

Example 3: Using the sinh() function with a Vector

To create a Vector in R, use the c() function. Then pass that vector to the sinh() function.

rv <- c(-1, 0.5, 0, 0.5, 1)
sinh(rv)

Output

[1] -1.1752012 0.5210953 0.0000000 0.5210953 1.1752012

Example 4: Passing a pi to the sinh() function

The pi is a built-in constant in R; its value is 3.141593.

Let’s find the pi constant’s sinh() value.

sinh(pi)

Output

[1] 11.54874

Let’s see another example of pi.

sinh(pi / 4)

Output

[1] 0.868671

Plotting the sinh() function to a graph

We will use the seq() function to create a series of values and pass that to the plot() function, which will create a line chart using the sinh() function.

dt <- seq(-1, 1, by = 0.05)
plot(dt, sinh(dt), typ = "l", col = "red")
abline(v = 0, lty = 6, col = "blue")

Output

Plot the sinh() function to a graph

See also

R atanh()

R tanh()

R cosh()

R atan()

R tan()

Leave a Comment