Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do you take a square root of a matrix that contains zeros in python?

let’s say we want to compute the square root of the identity matrix, how would you do in python? I have tried numpy.sqrt() but it didn’t work. Any ideas? Thanks a lot!

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If you want to do this element wise you can use

import numpy as np
my_matrix = np.array([0, 4, 9])
sqrt_my_matrix = np.sqrt(my_matrix)
print(sqrt_my_matrix)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading