Wednesday, June 17, 2026
HomeLanguagesNumpy matrix.I function | Python

Numpy matrix.I function | Python

With the help ofnumpy.matrix.I() function we can get the multiplicative inverse of the same size as of our given matrix.

Syntax : numpy.matrix.I()

Return : [matrix object] If self is non-singular, ret is such that ret * self == self * ret == np.matrix(np.eye(self[0, :].size) all return True. Return multiplicative inverse of given matrix.

Code #1 :




# Python program explaining
# numpy.matrix.I() function
  
# importing numpy as geek 
import numpy as geek 
            
mat = geek.matrix('[3, 4; 5, 6]') 
            
# applying matrix.getI() method 
gfg = mat.getI() 
      
print(gfg)


Output :

[[-3.   2. ]
 [ 2.5 -1.5]]

 
Code #2 :




# Python program explaining
# numpy.matrix.I() function
  
# importing numpy as geek 
import numpy as geek 
            
mat = geek.matrix('[1, 2, 3; 4, 5, 6; 7, 8, 9]') 
            
# applying matrix.getI() method 
gfg = mat.getI() 
      
print(gfg)


Output :

[[ -4.50359963e+15   9.00719925e+15  -4.50359963e+15]
 [  9.00719925e+15  -1.80143985e+16   9.00719925e+15]
 [ -4.50359963e+15   9.00719925e+15  -4.50359963e+15]]
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32516 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12014 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS