atanh#
- ivy.atanh(x, /, *, out=None)[source]#
Return a new array with the inverse hyperbolic tangent of the elements of
x
.- Parameters:
- Return type:
- Returns:
ret – an array containing the inverse hyperbolic tangent of each element in
x
. The returned array must have a floating-point data type determined by Type Promotion Rules.
This function conforms to the Array API Standard. This docstring is an extension of the docstring in the standard.
Both the description and the type hints above assumes an array input for simplicity, but this function is nestable, and therefore also accepts
ivy.Container
instances in place of any of the argumentsSpecial cases
For real-valued floating-point operands,
If
x_i
isNaN
, the result isNaN
.If
x_i
is less than-1
, the result isNaN
.If
x_i
is greater than1
, the result isNaN
.If
x_i
is-1
, the result is-infinity
.If
x_i
is+1
, the result is+infinity
.If
x_i
is+0
, the result is+0
.If
x_i
is-0
, the result is-0
.
For complex floating-point operands, let
a = real(x_i)
,b = imag(x_i)
, andIf
a
is+0
andb
is+0
, the result is+0 + 0j
.If
a
is+0
andb
isNaN
, the result is+0 + NaN j
.If
a
is1
andb
is+0
, the result is+infinity + 0j
.If
a
is a positive (i.e., greater than0
) finite number andb
is+infinity
, the result is+0 + πj/2
.If
a
is a nonzero finite number andb
isNaN
, the result isNaN + NaN j
.If
a
is+infinity
andb
is a positive (i.e., greater than0
) finite number, the result is+0 + πj/2
.If
a
is+infinity
andb
is+infinity
, the result is+0 + πj/2
.If
a
is+infinity
andb
isNaN
, the result is+0 + NaN j
.If
a
isNaN
andb
is a finite number, the result isNaN + NaN j
.If
a
isNaN
andb
is+infinity
, the result is±0 + πj/2
(sign of the real component is unspecified).If
a
isNaN
andb
isNaN
, the result isNaN + NaN j
.
Examples
With
ivy.Array
input:>>> x = ivy.array([0, -0.5]) >>> y = ivy.atanh(x) >>> print(y) ivy.array([ 0. , -0.549])
>>> x = ivy.array([0.5, -0.5, 0.]) >>> y = ivy.zeros(3) >>> ivy.atanh(x, out=y) >>> print(y) ivy.array([ 0.549, -0.549, 0. ])
With
ivy.Container
input:>>> x = ivy.Container(a=ivy.array([0., -0.5]), b=ivy.array([ 0., 0.5])) >>> y = ivy.atanh(x) >>> print(y) { a: ivy.array([0., -0.549]), b: ivy.array([0., 0.549]) }
- Array.atanh(self, *, out=None)[source]#
ivy.Array instance method variant of ivy.atanh. This method simply wraps the function, and so the docstring for ivy.atanh also applies to this method with minimal changes.
- Parameters:
self (
Array
) – input array whose elements each represent the area of a hyperbolic sector. Should have a floating-point data type.out (
Optional
[Array
], default:None
) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Array
- Returns:
ret – an array containing the inverse hyperbolic tangent of each element in
self
. The returned array must have a floating-point data type determined by type-promotion.
Examples
>>> x = ivy.array([0.0, 0.5, -0.9]) >>> y = x.atanh() >>> print(y) ivy.array([ 0. , 0.549, -1.47 ])
- Container.atanh(self, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.atanh. This method simply wraps the function, and so the docstring for ivy.atanh also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container whose elements each represent the area of a hyperbolic sector. Should have a floating-point data type.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains to apply or not apply the method to. Default isNone
.to_apply (
Union
[bool
,Container
], default:True
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default isTrue
.prune_unapplied (
Union
[bool
,Container
], default:False
) – Whether to prune key_chains for which the function was not applied. Default isFalse
.map_sequences (
Union
[bool
,Container
], default:False
) – Whether to also map method to sequences (lists, tuples). Default isFalse
.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container containing the inverse hyperbolic tangent of each element in
self
. The returned container must have a floating-point data type determined by type-promotion.
Examples
>>> x = ivy.Container(a=ivy.array([0, 0.5, -0.5]), b=ivy.array([0., 0.2, 0.9])) >>> y = x.atanh() >>> print(y) { a: ivy.array([0., 0.549, -0.549]), b: ivy.array([0., 0.203, 1.47]) }