Python Glossary Русский

all Python 3cmathfunction

cmath.sinh()

hyperbolic functions

The hyperbolic sine of a complex argument; sinh(i·x) = i·sin(x).

Syntax

cmath.sinh(z)

sinh(iπ/2) gives exactly 1j, one of the few cases where the rounding error stays invisible; at neighbouring angles it shows up. Like the rest of cmath, the result is complex even for a real input, and a large real part raises OverflowError, whereas numpy would return inf.

Examples

import cmath
print(cmath.sinh(1j * cmath.pi / 2))  # → 1j
try:
    cmath.sinh(1000)
except OverflowError as e:
    print(type(e).__name__)  # → OverflowError

See also

Common errors

Open in the full glossarydocs.python.orgReport an inaccuracy