Q:

Write a NumPy program to compute the inverse of a given matrix

0

Write a NumPy program to compute the inverse of a given matrix.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
m = np.array([[1,2],[3,4]])
print("Original matrix:")
print(m)
result =  np.linalg.inv(m)
print("Inverse of the said matrix:")
print(result)

Sample Output:

Original matrix:
[[1 2]
 [3 4]]
Inverse of the said matrix:
[[-2.   1. ]
 [ 1.5 -0.5]]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now