def arctanh(x): """Compute the inverse hyperbolic tangent of x. For real x with abs(x)<=1, this returns the principal value. If abs(x)>1, the complex arctanh() is computed. Parameters ---------- x : array_like Returns ------- array_like Examples -------- (We set the printing precision so the example can be auto-tested) >>> np.set_printoptions(precision=4) >>> np.lib.scimath.arctanh(0) 0.0 >>> np.lib.scimath.arctanh([0,2]) array([ 0.0000+0.j , 0.5493-1.5708j]) """ x = _fix_real_abs_gt_1(x) return nx.arctanh(x)
def arctanh(x): """Compute the inverse hyperbolic tangent of x. For real x with abs(x)<=1, this returns the principal value. If abs(x)>1, the complex arctanh() is computed. Parameters ---------- x : array_like Returns ------- array_like Examples -------- (We set the printing precision so the example can be auto-tested) >>> import numpy as np; np.set_printoptions(precision=4) >>> arctanh(0) 0.0 >>> arctanh([0,2]) array([ 0.0000+0.j , 0.5493-1.5708j]) """ x = _fix_real_abs_gt_1(x) return nx.arctanh(x)
def arctanh(x): """ 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 = 1` returns``inf`` and `x=-1` returns ``-inf``. Parameters ---------- x : array_like The value(s) whose arctanh is (are) required. Returns ------- out : ndarray or scalar The inverse hyperbolic tangent(s) of the `x` value(s). If `x` was a scalar so is `out`, otherwise an array is returned. See Also -------- numpy.arctanh Notes ----- For an arctanh() that returns ``NAN`` when real `x` is not in the interval ``(-1,1)``, use `numpy.arctanh` (this latter, however, does return +/-inf for `x = +/-1`). Examples -------- >>> np.set_printoptions(precision=4) >>> from numpy.testing import suppress_warnings >>> with suppress_warnings() as sup: ... sup.filter(RuntimeWarning) ... np.emath.arctanh(np.eye(2)) array([[inf, 0.], [ 0., inf]]) >>> np.emath.arctanh([1j]) array([0.+0.7854j]) """ x = _fix_real_abs_gt_1(x) return nx.arctanh(x)
def arctanh(x): """ 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 = 1` returns``inf`` and `x=-1` returns ``-inf``. Parameters ---------- x : array_like The value(s) whose arctanh is (are) required. Returns ------- out : ndarray or scalar The inverse hyperbolic tangent(s) of the `x` value(s). If `x` was a scalar so is `out`, otherwise an array is returned. See Also -------- numpy.arctanh Notes ----- For an arctanh() that returns ``NAN`` when real `x` is not in the interval ``(-1,1)``, use `numpy.arctanh` (this latter, however, does return +/-inf for `x = +/-1`). Examples -------- >>> np.set_printoptions(precision=4) >>> np.emath.arctanh(np.matrix(np.eye(2))) array([[ Inf, 0.], [ 0., Inf]]) >>> np.emath.arctanh([1j]) array([ 0.+0.7854j]) """ x = _fix_real_abs_gt_1(x) return nx.arctanh(x)
def arctanh(x): x = _fix_real_abs_gt_1(x) return nx.arctanh(x)