I was trying to find the inverse of a positive definite matrix with high dimension by computer. However, I tried even for a $5 \times 5$ matrix I cannot invert it correctly. I multiplied the original matrix and the inverse of it returned by the computer, the result is quite close to the identity matrix but not exactly the identity matrix.
Is there better ways (better algorithm etc.) to find the inverse by computer?
If a package can give you an approximate inverse to $A,$ call the approximation $X,$ an improvement can be found by $$ g(X) = 2X - XAX $$
You are concerned about $AX-I;$ it has small entries but is not quite zero. $$ A g(X) - I = A(2X - XAX) - I = -AXAX + 2AX - I = -(AX-I)^2 $$
That is, using some submultiplicative norm for matrices, as soon as $|AX-I|$ is significantly smaller than $1,$ the improvement is considerable.
ADDED: a piece of luck. In the strange world of numerical matrices, you are also worried about $XA-I.$ However, $$ g(X) A - I = (2X - XAX)A - I = -XAXA + 2XA - I = -(XA-I)^2 $$