Movatterモバイル変換


[0]ホーム

URL:


Python Tutorial

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 Pythoncmath.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 Pythoncmath.atanh() function will return 0j.

import cmathx = 0result = 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 thiscmath.atanh() function, it returns a real number.

import cmathfrom fractions import Fractionx = 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 usingcmath.atanh() function −

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

Output

Following is the output of the above code −

(-0.7752987062055835+0j)
python_modules.htm
Print Page
Advertisements

[8]ページ先頭

©2009-2025 Movatter.jp