numpy.sqrt#
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
This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None , locations within it where the condition is False will remain uninitialized.
**kwargs
For other keyword-only arguments, see the ufunc docs .
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.
A version which returns complex numbers when given negative reals. Note that 0.0 and -0.0 are handled differently for complex inputs.
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.
numpy.sqrt#
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
This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None , locations within it where the condition is False will remain uninitialized.
**kwargs
For other keyword-only arguments, see the ufunc docs .
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.
A version which returns complex numbers when given negative reals.
0.0 and -0.0 are handled differently for complex inputs.
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.
Python NumPy Square Root
Python numpy.sqrt() function is used to return the non-negative square root of an array element-wise (for each element of the array). In this article, I will explain how to use Numpy square root by using numpy.sqrt() function with examples.
1. Quick Examples of Python NumPy Square Root
If you are in a hurry, below are some quick examples of how to use Python NumPy square root function.
2. Syntax Python NumPy Square Root
Following is the syntax of the numpy.sqrt() function.
2.1 Parameters of sqrt()
- arr – The values whose square-roots are required. Input array.
- out – It is ndarray, None, or tuple of ndarray and None, optional. Out will be the location where the result is to be stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.
- where – It is array_like, optional. This condition is broadcast over the input.
2.2 Return Value of sqrt()
Return : It returns an array of the square root of the number in the input array.
numpy.sqrt
Возвращаем неотрицательный квадратный корень массива,по элементам.
Parameters xarray_like
Ценности,для которых нужны квадратные низы.
out ndarray, None или кортеж из ndarray и None, необязательно
Место,в которое сохраняется результат.Если предоставлено,оно должно иметь форму,на которую транслируются входы.Если не указано или None,возвращается свежераспределенный массив.Кортеж (возможен только как аргумент ключевого слова)должен иметь длину,равную количеству выходов.
wherearray_like, optional
Это условие транслируется по входу. В местах, где условие истинно, массив out будет установлен на результат ufunc. В другом out массив out сохранит свое исходное значение. Обратите внимание , что если инициализирован out массива создается по умолчанию out=None , места в нем , где условие ложно будет оставаться инициализирован.
**kwargs
Для других аргументов, содержащих только ключевые слова, см. Документацию ufunc .
Returns yndarray
Массив той же формы, что и x , содержащий положительный квадратный корень каждого элемента в x . Если какой-либо элемент в x является сложным, возвращается сложный массив (и вычисляются квадратные корни из отрицательных вещественных чисел). Если все элементы в x являются действительными, то также и y , с отрицательными элементами, возвращающими nan . Если был указан out , y является ссылкой на него. Это скаляр, если x — скаляр.
Версия,которая возвращает комплексные числа при заданных отрицательных реакциях.
0.0 и -0.0 обрабатываются по-разному для сложных входов.
Notes
sqrt имеет — в соответствии с общепринятым соглашением — в качестве своей ветви пересекает реальный «интервал» [ -inf , 0) и непрерывен сверху на нем. Разрез — это кривая на комплексной плоскости, на которой данная комплексная функция не может быть непрерывной.