Python atanh

The Python atanh function is used to calculate the Trigonometric Hyperbolic Arc Tangent for the specified expression or number. The Python atanh function is also called the inverse of hyperbolic Tangent.

In this section, we discuss how to use the atanh function in Python Programming language with an example. The syntax of the atanh Function is

math.atanh(number);

Number: A valid numerical expression to find the Hyperbolic Arc Tangent value.

  • If the number argument is positive and negative, the atanh function returns the Hyperbolic Arc Tangent value.
  • If it is not between -1 (exclude) and 1 (exclude), it returns ValueError.
  • And if it is not a number, it returns TypeError.

Python atanh Function Example

The Python atanh Function allows you to find the Trigonometric Hyperbolic Arc Tangent of the numeric values. In this example, We will find the Hyperbolic Arc Tangent values of different data types.

import math

Tup = (0.10, 0.20, 0.35, -0.45 , 0.75)
Lis = [-0.15, 0.25, -0.32, -0.95 , 0.64]

print('Hyperbolic Arc Tangent of Positive Number = %.2f' %math.atanh(0.91))
print('Hyperbolic Arc Tangent of Negative Number = %.2f' %math.atanh(-0.91))

print('Hyperbolic Arc Tangent of Tuple Item = %.2f' %math.atanh(Tup[3]))
print('Hyperbolic Arc Tangent of List Item = %.2f' %math.atanh(Lis[2]))

print('Hyperbolic Arc Tangent of Multiple Numbers = %.2f' %math.atanh(0.22 + 0.49 - 0.27))

print('Hyperbolic Arc Tangent of String Value = ', math.atanh('Hello'))
Python ATANH Function Example

First, We used directly on both the Positive and Negative values. The following statements find the hyperbolic arc Tangent of the corresponding values.

print('Hyperbolic Arc Tangent of Positive Number = %.2f' %math.atanh(0.91))
print('Hyperbolic Arc Tangent of Negative Number = %.2f' %math.atanh(-0.91))

TIP: You can try values greater than or equal to One, but it throws ValueError. Please refer to the tan to understand the Tangent Function.

Next, We used the atanh Function on Tuple and List items. See the above Python screenshot, this Math function is working perfectly on them.

print('Hyperbolic Arc Tangent of Tuple Item = %.2f' %math.atanh(Tup[3]))
print('Hyperbolic Arc Tangent of List Item = %.2f' %math.atanh(Lis[2]))

Next, We used the Python atanh method directly on multiple values.

print('Hyperbolic Arc Tangent of Multiple Numbers = %.2f' %math.atanh(0.22 + 0.49 - 0.27))

We tried on the String value, and it returns TypeError as output.

print('Hyperbolic Arc Tangent of String Value = ', math.atanh('Hello'))