Dear all,
I would like to implement some basic manipulation with matrices that I 
need. 
The problem I'm facing is that I cannot figure out how to recognize 
correctly a MatrixSymbol:
from sympy.abc import i,j
A = sy.MatrixSymbol("A",3,3)
B = sy.MatrixSymbol("B",3,3)
C = sy.MatrixSymbol("C",3,3)

pippo = A[i,j].subs(A, B+C)
isinstance(pippo.args[0].args[0].func, sy.MatrixSymbol)  # False
isinstance(B.func, sy.MatrixSymbol) #True
Note, that  pippo.args[0].args[0] is B and if you 
print pippo.args[0].args[0].func it returns 
sympy.matrices.expressions.matexpr.MatrixSymbol

So why is it not working? How can I check if it is a matrix and stop the 
recursion?

Bests,
Lorenzo

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/9b2bbb2d-e61b-4e37-8db3-9fd55fd18cb5%40googlegroups.com.

Reply via email to