Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" The multiplicative inverse of a matrix expression
This is a symbolic object that simply stores its argument without evaluating it. To actually compute the inverse, use the ``.inverse()`` method of matrices.
Examples ========
>>> from sympy import MatrixSymbol, Inverse >>> A = MatrixSymbol('A', 3, 3) >>> B = MatrixSymbol('B', 3, 3) >>> Inverse(A) A^-1 >>> A.inverse() == Inverse(A) True >>> (A*B).inverse() B^-1*A^-1 >>> Inverse(A*B) (A*B)^-1
"""
raise TypeError("mat should be a matrix")
def arg(self):
def shape(self):
from sympy.matrices.expressions.determinant import det return 1/det(self.arg)
else:
""" >>> from sympy import MatrixSymbol, Q, assuming, refine >>> X = MatrixSymbol('X', 2, 2) >>> X.I X^-1 >>> with assuming(Q.orthogonal(X)): ... print(refine(X.I)) X' """ elif ask(Q.unitary(expr), assumptions): return expr.arg.conjugate() elif ask(Q.singular(expr), assumptions): raise ValueError("Inverse of singular matrix %s" % expr.arg)
return expr
|