Python Tutorial Python Advanced Python References Python Libraries

Python cmath - cosh() Function



The Python cmath.cosh() function returns the complex hyperbolic cosine of a complex number z. It is a function on complex plane, and has no branch cuts. It is periodic with respect to the imaginary component, with period 2𝜋j.

Mathematically, it can be expressed as:

complex cosh

Syntax

cmath.cosh(z)

Parameters

z Required. Specify a number to find the complex hyperbolic cosine of

Return Value

Returns the complex hyperbolic cosine of z.

Example:

In the example below, cosh() function is used to find out the complex hyperbolic cosine of the given number.

import cmath

z1 = 2 + 2j
z2 = 2
z3 = 2j

print("cmath.cosh(z1):", cmath.cosh(z1))
print("cmath.cosh(z2):", cmath.cosh(z2))
print("cmath.cosh(z3):", cmath.cosh(z3))

The output of the above code will be:

cmath.cosh(z1): (-1.5656258353157435+3.297894836311237j)
cmath.cosh(z2): (3.7621956910836314+0j)
cmath.cosh(z3): (-0.4161468365471424+0j)

❮ Python cMath Module