bundles / numpy latest / numpy / lib / scimath / sqrt
_ArrayFunctionDispatcher
numpy.lib.scimath:sqrt
source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_scimath_impl.py :185
Signature
def sqrt ( x ) Summary
Compute the square root of x.
Extended Summary
For negative input elements, a complex value is returned (unlike numpy.sqrt which returns NaN).
Parameters
x: array_likeThe input value(s).
Returns
out: ndarray or scalarThe square root of
x. Ifxwas a scalar, so is out, otherwise an array is returned.
Examples
For real, non-negative inputs this works just like `numpy.sqrt`:import numpy as np
✓np.emath.sqrt(1) np.emath.sqrt([1, 4])✗
np.emath.sqrt(-1)
✗np.emath.sqrt([-1,4])
✓np.emath.sqrt(complex(-4.0, 0.0)) np.emath.sqrt(complex(-4.0, -0.0))✗
See also
Aliases
-
numpy.emath.sqrt