On Friday, April 25, 2014 2:49:15 AM UTC+2, Matthew wrote:
>
> I haven't thought about this issue much. Generally speaking though
> MatrixElement and derivatives and Matrix Expressions are absolutely in a
> not so perfect state. Help here is welcome.
>
I'll see what I can do.
Imo the next thing to fix is this: type(MatrixSymbol.args[0]) is str. It is
the name of the symbol. I think there is even a docstring somewhere that
states that all members of .args must be derived from Basic, and it
actually breaks a couple of functions if this is not the case. For example
the following code throws an AttributeError because str has no .match:
from sympy import *
from sympy.abc import n, m
X = MatrixSymbol('X', n, m)
X.find(n)
At the moment MatrixSymbol.is_Symbol=False, which kind of makes sense
because it has arguments (the dimensions) that can be arbitrary
expressions. But it also means that there is code that tries to clone it by
performing X.func(*X.args), so the symbol name must be contained in args
somehow.
I would recommend to sympify the symbol name, i.e. effectively turning
MatrixSymbol into an operator that turns an ordinary symbol into a matrix
symbol. This has the downside that mixing Symbol('X') and MatrixSymbol('X',
n, m) can have strange effects, but it is the best solution I can think of.
Any other ideas how to fix this problem?
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/138f058b-f8c3-4faa-89da-22f4c8774d51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.