def sqrt(x, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
"""
sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])
Return the non-negative square-root of an array, element-wise.
以元素为单位返回数组的非负平方根。
Parameters
----------
x : array_like
The values whose square-roots are required.
需要平方根的值。
out : ndarray, None, or tuple of ndarray and 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. A tuple (possible only as a
keyword argument) must have length equal to the number of outputs.
结果存储的位置。 如果提供,它必须具有输入广播到的形状。
如果未提供或没有,则返回一个新分配的数组。
元组(只能作为关键字参数)的长度必须等于输出的数量。
where : array_like, optional
Values of True indicate to calculate the ufunc at that position, values
of False indicate to leave the value in the output alone.
**kwargs
For other keyword-only arguments, see the
:ref:`ufunc docs <ufuncs.kwargs>`.
Returns
-------
y : ndarray
An array of the same shape as `x`, containing the positive
square-root of each element in `x`. If any element in `x` is
complex, a complex array is returned (and the square-roots of
negative reals are calculated). If all of the elements in `x`
are real, so is `y`, with negative elements returning ``nan``.
If `out` was provided, `y` is a reference to it.
This is a scalar if `x` is a scalar.
与x形状相同的数组,包含x中每个元素的正平方根。
如果x中的任何元素是复数,则返回一个复数数组(并计算负实数的平方根)。
如果x中的所有元素都是真实的,则y也是如此,而否定元素返回nan。
如果提供了“ out”,则“ y”是对它的引用。 如果x是标量,则这是标量。
See Also
--------
lib.scimath.sqrt
A version which returns complex numbers when given negative reals.
Notes
-----
*sqrt* has--consistent with common convention--as its branch cut the
real "interval" [`-inf`, 0), and is continuous from above on it.
A branch cut is a curve in the complex plane across which a given
complex function fails to be continuous.
* sqrt *具有-与通用约定一致-因为其分支剪切了真实的“间隔” [`-inf`,0),
* 并且从上开始连续。 分支切口是复杂平面中的曲线,给定的复杂函数在该曲线上无法连续。
Examples
--------
>>> np.sqrt([1,4,9])
array([ 1., 2., 3.])
>>> np.sqrt([4, -1, -3+4J])
array([ 2.+0.j, 0.+1.j, 1.+2.j])
>>> np.sqrt([4, -1, numpy.inf])
array([ 2., NaN, Inf])
"""
pass
python numpy np.sqrt(x, *args, **kwargs)函数 (平方根)
最新推荐文章于 2024-06-14 11:06:42 发布