Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

r
math
cosine
hyperbolic
communitycreator

What is cosh() in R?

harris910

The cosh() function in R returns the hyperbolic cosine of a number in radians.

The following illustration shows the mathematical representation of the cosh() function.

Mathematical representation of the hyperbolic cosine function

Syntax

cosh(num)

Parameter

As a parameter, this function requires a number that represents an angle in radians.

In order to convert degrees to radians, use the following formula.

radians = degrees * ( pi / 180.0 )

Return value

cosh() returns the hyperbolic cosine of a number (in radians) that is sent in as a parameter.

Code

#Positive number in radians
a <- cosh(2.3);
print(paste0("cosh(2.3): ", a))

#negative number in radians
b <- cosh(-2.3);
print(paste0("cosh(-2.3): ", b))

#converting the degrees angle into radians and then applying cosh()
#degrees = 180
c <- cosh(180 * (pi / (180)));
print(paste0("cosh(180 * (pi / (180))): ", c))

RELATED TAGS

r
math
cosine
hyperbolic
communitycreator
RELATED COURSES

View all Courses

Keep Exploring