How to calculate inverse using cramer's rule in python?
linalg is right and you are wrong.
The matrix it gave you is indeed the inverse. However, if you are using np.array instead of np.matrix then the multiplication operator doesn't work as expected, since it calculates the component-wise product.
In that case you have to do mat.dot(inv(mat)).
In any case, what you will get will not be a perfect identity matrix due to rounding errors (when I tried it the off-diagonal matrix entries were in the order of 10 ** (-16)).
I'm trying to generate the inverse matrix using numpy package in python. Unfortunately , I'm not getting the answers I expected.
Original matrix:
([17 17 5]
 [21 18 21]
 [2 2 19])
Inverting the original matrix by Cramer's rule gives:
([4 9 15]
 [15 17 6]
 [24 0 17])
Apparently using numpy.linalg.inv()  gives
-3.19488818e-01,3.80191693e-01,-6.38977636e-03,
3.33333333e-01, -3.33333333e-01, 2.26123699e-18, 
-2.84345048e-01, 2.68370607e-01, 5.43130990e-02n
I expected that multiplying the original matrix and the inverse would have given an identity matrix but as you can see I give a matrix filled with floating points.
Where can be the issue?