Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Python cmath.atanh() Function



The Pythoncmath.atanh() function returns the inverse hyperbolic tangent.

Inverse hyperbolic tangent is denoted as tanh-1(x) or it is also called artanh(x), where this is a mathematical function that acquires the value whose hyperbolic tangent is a given number x.

This function can also be explained in other words; if we have values between -1 and 1, then this function will return a hyperbolic tangent value equal to x.

Every domain in the tangent inverse hyperbolic function is restricted to the range (-1,1). Inverse hyperbolic tangents will always give a real number as an output.

Syntax

Following is the basic syntax of the Python cmath.atanh() function −

cmath.atanh(x)

Parameters

This function accepts domains in the range of (-1,1), for which we need to find inverse the hyperbolic tangent as a parameter.

Return Value

This function returns the inverse hyperbolic tangent in the range of (-,).

Example 1

The hyperbolic tangent of 0 is 0. When we pass 0 as an argument, then this Python cmath.atanh() function will return 0j.

import cmath
x = 0
result = cmath.atanh(x)
print(result)

Output

When we run the above code, it produces the Following result −

0j

Example 2

When we pass a fraction value to this cmath.atanh() function, it returns a real number.

import cmath
from fractions import Fraction
x = Fraction(1, -7)
result = cmath.atanh(x)
print(result)

Output

The output obtained is as follows −

(-0.14384103622589042+0j)

Example 3

In the below example, we are retrieving the inverse hyperbolic tangent of a negative number using cmath.atanh() function −

import cmath
x = -0.65
result = cmath.atanh(x)
print(result)

Output

Following is the output of the above code −

(-0.7752987062055835+0j)
python_modules.htm
Advertisements