Python atanh

The Python atanh function is used to calculate the Trigonometric Hyperbolic Arc Tangent for the specified expression or number. Python atanh function 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 Hyperbolic Arc Tangent value.

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

Python atanh Function Example

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

# Python ATANH Function

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

First, We used the atanh Function 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 Python tan to understand the Tangent Function.

Next, We used the atanh Function on Python Tuple and Python 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 atanh Function directly on multiple values.

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

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

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