Hyperbolic functions in R calculate the hyperbolic cosine, sine, tangent, and their inverses, arc-cosine, arc-sine, arc-tangent.
cosh in R
The cosh() is a built-in R function that calculates the hyper tangent of cosine value. It accepts the numerical value as an argument and returns the hyper tangent of the cosine of that numeric value.
To calculate the hyper tangent of cosine value in R, use the cosh() function. The cosh() function calculates the hyperbolic cosine of the given value.
Syntax
cosh(x)
Parameters
The x is a column to compute on.
Example
Let’s calculate the cosh value of 1.
cosh(1)
Output
[1] 1.543081
Let’s calculate the cosh value of 0.
cosh(0)
Output
[1] 1
Calculating cosh() of complex number
Define a complex value and pass that value to the cosh() function.
d <- 5 + 1i
cosh(d)
Output
[1] 40.09581+62.43985i
Plotting the cosh() function to a graph
We can use the seq() function to create a series of values and pass that to the plot() function, which will create a line chart.
dt <- seq(-1, 1, by = 0.05)
plot(dt, cosh(dt), typ = "l", col = "red")
abline(v = 0, lty = 6, col = "blue")
Output
Applying cosh() function to a Vector
To create a Vector in R, use the c() function. Then pass that vector to the cosh() function.
rv <- c(-1, 0.5, 0, 0.5, 1)
cosh(rv)
Output
[1] 1.543081 1.127626 1.000000 1.127626 1.543081
Passing a pi to the cosh() function
The pi is an inbuilt constant in R programming, and its value is 3.141593.
Let’s find the pi constant’s cosh() value.
cosh(pi)
Output
[1] 11.59195
Let’s see another example of pi.
cosh(pi / 4)
Output
[1] 1.324609
That is it for this tutorial.
See also

Krunal Lathiya is an Information Technology Engineer by education and web developer by profession. He has worked with many back-end platforms, including Node.js, PHP, and Python. In addition, Krunal has excellent knowledge of Data Science and Machine Learning, and he is an expert in R Language. Krunal has written many programming blogs, which showcases his vast expertise in this field.