draw inverse of a matrix in module n?

0

I need to draw the inverse of a matrix but in module 29,
 [[6 3 26]
 [28 10 7]
 [12 22 20]]
it is assumed that if the matrix in module 29 is well taken out, it would be as follows:
 [[13 7 29]
 [1 22 11]
 [17 7 9]]

    
asked by AXL 06.11.2018 в 04:49
source

1 answer

0

The Sympy library has a function for that:

from sympy import Matrix, pprint
A = Matrix([
  [  6,  3, 26 ],
  [ 28, 10,  7 ],
  [ 12, 22, 20 ]
])
A_inv = A.inv_mod(29)
pprint(A_inv)

Result:

⎡12  10  7 ⎤
⎢          ⎥
⎢12  18  10⎥
⎢          ⎥
⎣26  9   24⎦

By the way, this answer does not match what you offer in the question (although it does give you the this online calculator )

If you are too lazy to install Sympy and you only need it to do things on time, you can use Google Colaborator which gives you an interface to a Jupyter Notebook where you already have it pre-installed (along with many other typically useful libraries such as numpy, pandas, matplotlib, tensorflow, etc.)

    
answered by 06.11.2018 в 09:34