How to square root numpy array elements in Python

2 Answers

0 votes
import numpy as np
 
arr = np.array([[9, 12], [25, 16]], dtype = np.int64)  

sq = np.sqrt(arr)

print(sq)


'''
run:

[[3.         3.46410162]
 [5.         4.        ]]

'''

 



answered Jan 23, 2019 by avibootz
0 votes
import numpy as np
 
arr = np.array([9, 12, 25], dtype = np.int64)  

sq = np.sqrt(arr)

print(sq)


'''
run:

[3.         3.46410162 5.        ]

'''

 



answered Jan 23, 2019 by avibootz
...