Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inverse of a matrix 3x3 using symbols

A have the following matrix, for example:

enter image description here

And I want to do a few matrix operation without adding numbers as they may vary and I want to get general equations out of it.

How can I get the inverse of something like that. If I want to do multiplication or simple operations seems to be fine, but nothing seems to work for the inverse.

I've tried a lot like:

from sympy import *
from numpy import matrix
from numpy import linalg
from sympy import Matrix

a1, a2, a3, b1, b2, b3, c1, c2, c3, x, y, z = symbols('a1 a2 a3 b1 b2 b3 c1 c2 c3 x y z')
A = matrix( [[a1,a2,a3],[b1,b2,b3],[c1,c2,c3]]) # Creates a matrix.
B = matrix( [[x],[y],[z]])
C= A*B  #That works fine
A_inverse = A.inv() #Doesn't work
like image 470
Mac Avatar asked Feb 05 '15 13:02

Mac


People also ask

What is the symbol for inverse matrix?

It is important to know how a matrix and its inverse are related by the result of their product. So then, If a 2×2 matrix A is invertible and is multiplied by its inverse (denoted by the symbol A−1), the resulting product is the Identity matrix which is denoted by I.

How do you write the inverse of a matrix?

What is the Formula for An Inverse Matrix? The inverse of a square matrix, A is A-1 only when: A × A-1 = A-1 × A = I.


1 Answers

You're not using Matrix (sympy) but matrix (numpy)

A = Matrix( [[a1,a2,a3],[b1,b2,b3],[c1,c2,c3]]) # Creates a matrix.
B = Matrix( [[x],[y],[z]])

will give you the correct result.

like image 50
runDOSrun Avatar answered Oct 17 '22 17:10

runDOSrun