You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
n = 2
v = symbols('b:%s'%n**2,commutative=False)
A = Matrix(n,n,symbols('a:%s'%n**2,commutative=False))
B = Matrix(n,n,v)
eqs = list(A*B - eye(n)) <-- solve for b0-b3
for i in range(n**2):
c,d = eqs[i].expand().as_independent(v[i])
assert all(j.args[-1]==v[i] for j in Add.make_args(d))
vi = 1/d.subs(v[i],1)*-c
eqs[i] = Eq(v[i], vi)
eqs[i+1:] = [e.subs(v[i], vi) for e in eqs[i+1:]]
print(eqs[-1])
Eq(b3, (-a2*a0**(-1)*a1 + a3)**(-1))
(and that is the right, explicit expression)
I think that will apply - result and solution process -- provided that the matrices on the diagonal are square. e.g.
Note: one would have to back substitution the solutions to create the full explicit inverse of A; what I have shown here is only the forward solving part. A naive approach is to do
For simplicity, it is sufficient to consider the 2x2 case: a 3x3 matrix could be imagined to be partitioned into a 2x2 and 1x1 on the diagonal and 2x1 and 1x2 on the off-digonal (and similar for any other sized matrix). This wikipage also indicates that the inverse can be computed so it involves different regions of the original matrix being inverted.
This question was raised on SO and I had some difficulty coming up with a solution. It seems like something that should work with SymPy.
Consider a block matrix of submatrices:
If we look at bottom right submatrix after inversion we find that it is only implicitly defined:
If we create a matrix of the symbols (which are non-commutative) we get a more explicit (but wrong) expression:
Finally, I solved the equation by hand:
(and that is the right, explicit expression)
I think that will apply - result and solution process -- provided that the matrices on the diagonal are square. e.g.
@oscargus , I think this is the first sighting of the
irregular
method in the wild!BTW, trying to solve
eqs
withsolve
did not work with or withoutmanual=True
:See also #5858
SO issue is here
Note: one would have to back substitution the solutions to create the full explicit inverse of A; what I have shown here is only the forward solving part. A naive approach is to do
The text was updated successfully, but these errors were encountered: