math.atanh()

FrankKwabenaAboagye's avatar
Published Sep 11, 2024
Contribute to Docs

In Python, the math.atanh() function returns the inverse hyperbolic tangent of a number.

Syntax

math.atanh(x)

Since it is used to reverse the effect of a hyperbolic tangent function, the parameter x must always a number between -0.99 and 0.99. A ValueError will occur if:

  • x is greater than or equal to 1.
  • x is less than or equal to -1.

Example

The following example shows the use of the math.atanh():

import math
x = 0.5
result = math.atanh(x)
print("Inverse hyperbolic tangent of 0.5 =",str(result))

The above code produces the following output:

Inverse hyperbolic tangent of 0.5 = 0.5493061443340549

Codebyte Example

Run the following code to understand how the math.atanh() function works:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy