math.cosh()
Anonymous contributor
Published Sep 27, 2024
Contribute to Docs
In Python, the math.cosh()
method returns the hyperbolic cosine of a number which is equivalent to (math.exp(x) + math.exp(-x)) / 2
.
Syntax
math.cosh(x)
x
: A numeric value whose hyperbolic cosine is to be calculated.
Example 1
The following example uses math.cosh()
to return the hyperbolic cosine of integer 1:
import mathprint(math.cosh(1))
The above code gives the following output:
1.5430806348152437
Note: If the input is not a number, a
TypeError
is raised.
Example 2
The following example uses math.cosh()
to return the hyperbolic cosine of the float 8.9:
import mathprint(math.cosh(8.9))
The above code gives the following output:
3665.986837772461
Codebyte Example
Run the following example to understand the working of math.cosh()
method:
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.