MCPcopy Index your code
hub / github.com/numpy/numpy / arctanh

Function arctanh

numpy/lib/_scimath_impl.py:591–642  ·  view source on GitHub ↗

Compute the inverse hyperbolic tangent of `x`. Return the "principal value" (for a description of this, see `numpy.arctanh`) of ``arctanh(x)``. For real `x` such that ``abs(x) < 1``, this is a real number. If `abs(x) > 1`, or if `x` is complex, the result is complex. Finally,

(x)

Source from the content-addressed store, hash-verified

589@set_module('numpy.lib.scimath')
590@array_function_dispatch(_unary_dispatcher)
591def arctanh(x):
592 """
593 Compute the inverse hyperbolic tangent of `x`.
594
595 Return the "principal value" (for a description of this, see
596 `numpy.arctanh`) of ``arctanh(x)``. For real `x` such that
597 ``abs(x) < 1``, this is a real number. If `abs(x) > 1`, or if `x` is
598 complex, the result is complex. Finally, `x = 1` returns``inf`` and
599 ``x=-1`` returns ``-inf``.
600
601 Parameters
602 ----------
603 x : array_like
604 The value(s) whose arctanh is (are) required.
605
606 Returns
607 -------
608 out : ndarray or scalar
609 The inverse hyperbolic tangent(s) of the `x` value(s). If `x` was
610 a scalar so is `out`, otherwise an array is returned.
611
612
613 See Also
614 --------
615 numpy.arctanh
616
617 Notes
618 -----
619 For an arctanh() that returns ``NAN`` when real `x` is not in the
620 interval ``(-1,1)``, use `numpy.arctanh` (this latter, however, does
621 return +/-inf for ``x = +/-1``).
622
623 Examples
624 --------
625 >>> import numpy as np
626 >>> np.set_printoptions(precision=4)
627
628 >>> np.emath.arctanh(0.5)
629 0.5493061443340549
630
631 >>> import warnings
632 >>> with warnings.catch_warnings():
633 ... warnings.simplefilter('ignore', RuntimeWarning)
634 ... np.emath.arctanh(np.eye(2))
635 array([[inf, 0.],
636 [ 0., inf]])
637 >>> np.emath.arctanh([1j])
638 array([0.+0.7854j])
639
640 """
641 x = _fix_real_abs_gt_1(x)
642 return nx.arctanh(x)

Callers

nothing calls this directly

Calls 1

_fix_real_abs_gt_1Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…