Python Glossary Русский

all Python 3Numbers & mathfunction

math.atanh

hyperbolic

Inverse hyperbolic tangent (|argument| < 1).

Syntax

math.atanh(...)

The domain is open at both ends: math.atanh(1) and math.atanh(-1) already raise ValueError (math domain error) because the function blows up there, and anything with modulus above one fails the same way. Do not mix it up with math.atan, where the argument is unrestricted and the result is bounded — here it is the other way round.

Examples

import math
print(math.atanh(0))   # → 0.0
print(round(math.atanh(0.5), 4))   # → 0.5493
print(round(math.atanh(-0.5), 4))   # → -0.5493
print(round(math.atanh(math.tanh(2)), 4))   # → 2.0
print(math.atanh(1))   # → ValueError

See also

Common errors

Open in the full glossarydocs.python.orgReport an inaccuracy