Python math.cosh() Method

Python math 模块Python math module

Python math.cosh(x)Returns the hyperbolic cosine of x, equivalent to (exp(number) + exp(-number)) / 2.

Python version: 1.4

Syntax

The syntax of the math.cosh() method is as follows:

math.cosh(x)

Parameter description:

  • x-- Required. A positive or negative number. If x is not a number, returns TypeError.

Return Value

Returns a floating-point number representing the hyperbolic cosine of a number.

Examples

The following example returns the hyperbolic cosine values of different numbers:

Example

# Import math package
import math

# Output hyperbolic cosine value
print (math.cosh(1))
print (math.cosh(8.90))
print (math.cosh(0))
print (math.cosh(1.52))

Output:

1.5430806348152437
3665.986837772461
1.0
2.395468541047187

Python math 模块Python math module

Other extensions