Python Glossary Русский

all Python 3Numbers & mathfunction

math.asinh

hyperbolic

Inverse hyperbolic sine.

Syntax

math.asinh(...)

Unlike acosh it is defined for every real number and never raises a domain ValueError, whatever you pass in. The textbook formula — a logarithm of x plus the square root of x squared plus one — loses accuracy for large negative x because of cancellation, while asinh handles that carefully. It grows logarithmically, which is why it is used as a "soft log" scale for data containing zeros and negative values.

Examples

import math
print(math.asinh(0))   # → 0.0
print(round(math.asinh(1), 3))   # → 0.881
print(round(math.asinh(-2), 3))  # → -1.444
print(round(math.asinh(math.sinh(2)), 6))  # → 2.0
print(round(math.asinh(1000), 3))  # → 7.601

See also

Open in the full glossarydocs.python.orgReport an inaccuracy