sqrt¶
-
sqrt(x, out=None, **kwargs)¶ Return the non-negative square-root of an array, element-wise.
Parameters: - x : ndarray or scalar
The values whose square-roots are required.
- out : ndarray, or None, optional
A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.
Returns: - y : ndarray or scalar
An array of the same shape as x, containing the positive square-root of each element in x. This is a scalar if x is a scalar.
- Notes
- This function only supports input type of float.
Examples
>>> np.sqrt(np.array([1,4,9])) array([1., 2., 3.]) >>> np.sqrt(np.array([4, -1, _np.inf])) array([ 2., nan, inf])