Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inverse of a matrix in SymPy?

I was wondering how to create a matrix and compute its inverse using SymPy in Python?

For example, for this symbolic matrix:

like image 929
Tim Avatar asked Nov 21 '10 17:11

Tim


1 Answers

If your question was: How to compute the inverse of a matrix M in sympy then:

M_inverse = M.inv()

As for how to create a matrix:

M = Matrix(2,3, [1,2,3,4,5,6])

will give you the following 2X3 matrix:

1 2 3

4 5 6

See: http://docs.sympy.org/0.7.2/modules/matrices/matrices.html

like image 181
snakile Avatar answered Oct 06 '22 14:10

snakile