![]() | 1 | initial version |
Do you mean something like what follows ?
sage: foo=MatrixSpace(ZZ,2).random_element()
sage: while foo.det()==0: foo=MatrixSpace(ZZ,2).random_element()
sage: foo
[-9 -1]
[ 2 -1]
sage: bar=foo.inverse() ; bar
[-1/11 1/11]
[-2/11 -9/11]
sage: gee=gcd(bar.list()) ; gee
1/11
sage: bar/gee
[-1 1]
[-2 -9]
HTH,