Python Glossary Русский

all Python 3Numbers & mathfunction

math.acosh

hyperbolic

Inverse hyperbolic cosine (argument ≥ 1).

Syntax

math.acosh(...)

The domain starts at 1: anything below it, including 0 and negatives, raises ValueError with "math domain error" instead of returning nan, so either validate the input or catch that ValueError specifically. The result is always non-negative — this is the principal branch; for arguments outside [1, inf) use cmath.acosh, which returns a complex value.

Examples

import math
print(math.acosh(1))   # → 0.0
print(round(math.acosh(2), 3))   # → 1.317
print(round(math.acosh(10), 3))  # → 2.993
print(round(math.acosh(math.cosh(1.5)), 6))  # → 1.5
print(math.acosh(0.5))  # → ValueError

See also

Common errors

Open in the full glossarydocs.python.orgReport an inaccuracy