Python math.cosh()
Published Sep 27, 2024Updated Jun 11, 2025
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
TypeErroris 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:
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.
Learn Python on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
- With Certificate
- Beginner Friendly.24 hours