- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Return the non-negative square-root of an array element-wise in Numpy

To return the non-negative square-root of an array, element-wise, use the **numpy.sqrt()** method in Python Numpy.

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.

The out is 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.

## Steps

At first, import the required library −

import numpy as np

Create an array using the array() method −

arr = np.array([4, 9, 10000, 100, 841, 225])

Display the array −

print("Array...

", arr)

Get the type of the array −

print("

Our Array type...

", arr.dtype)

Get the dimensions of the Array −

print("

Our Array Dimension...

",arr.ndim)

Get the shape of the Array −

print("

Our Array Shape...

",arr.shape)

To return the non-negative square-root of an array, element-wise, use the numpy.sqrt() method −

print("

Result...

",np.sqrt(arr))

## Example

import numpy as np # Create an array using the array() method arr = np.array([4, 9, 10000, 100, 841, 225]) # Display the array print("Array...

", arr) # Get the type of the array print("

Our Array type...

", arr.dtype) # Get the dimensions of the Array print("

Our Array Dimension...

",arr.ndim) # Get the shape of the Array print("

Our Array Shape...

",arr.shape) # To return the non-negative square-root of an array, element-wise, use the numpy.sqrt() method in Python Numpy print("

Result...

",np.sqrt(arr))

## Output

Array... [ 4 9 10000 100 841 225] Our Array type... int64 Our Array Dimension... 1 Our Array Shape... (6,) Result... [ 2. 3. 100. 10. 29. 15.]

- Related Articles
- Return the element-wise square-root of a complex type array in Numpy
- Return the element-wise square of the array input in Python
- Return the truth value of an array equal to another element-wise in Numpy
- Return the truth value of an array greater than another element-wise in Numpy
- Return the truth value of an array less than another element-wise in Numpy
- Compute the bit-wise NOT of an array element-wise in Numpy
- Return the truth value of an array not equal to another element-wise in Numpy
- Return the base 10 logarithm of the input array element-wise in Numpy
- Return the element-wise remainder of division in Numpy
- Return the cube-root of an array elementwise in Numpy
- Return the truth value of an array less than equal to another element-wise in Numpy
- Return the truth value of an array greater than equal to another element-wise in Numpy
- Return an element-wise indication of the sign of a number in Numpy
- Return an element-wise indication of the sign of complex types in Numpy
- Return the natural logarithm of one plus the input array element-wise in Numpy