Inverse matrix in sympy?

I was wondering how to create a matrix and calculate its inverse using sympy in Python?

For example, for this symbolic matrix

$$ \Sigma = \begin{pmatrix} \sigma_x^2 & \rho \sigma_x \sigma_y \\ \rho \sigma_x \sigma_y & \sigma_y^2 \end{pmatrix} $$ 

Thank you and welcome!

+7
python matrix sympy
source share
1 answer

If you have a question: how to calculate the inverse matrix M in sympy, then:

 M_inverse = M.inv() 

How to create a matrix:

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

will provide you with the following 2X3 matrix:

1 2 3

4 5 6

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

+13
source share

All Articles