This has already been considered some.  See
http://code.google.com/p/sympy/issues/detail?id=1860 for example.

I kind of doubt this would conflict with Sherjil's work, since what
you are suggesting and actual matrices would be quite different, but
Sherjil would have to confirm.

I think if you implement non-commutative symbols with shape (see the
issue I linked to above), that would cover about 90% of use cases.  If
you want to symbolically represent more than just matrix
multiplication and addition, you would have to do more than that, but
these would not be difficult to do.  For example, A.T would just swap
the shape of A.  The inverse would just be handled by Pow, i.e.,
A**-1.  I suppose a little more work would need to be done if you want
to support matrices being non-invertible, and that being handled
correctly.  But even that would not be hard (just have an attribute .
invertible, which would probably default to True if the shape is
square, and make ._eval_pow, not work for negative powers if it is
False).

The real problem (and I think it's what the main issue is in issue
1860), is how to make Mul handle the shape attribute correctly.  The
way it is now, you have to modify Mul.flatten to make it work (also
see issue 1941).

Aaron Meurer

On Fri, Jun 24, 2011 at 2:30 PM, Matthew Rocklin <[email protected]> wrote:
> Hi Everyone,
> I'd like to build a symbolic Matrix object. I'm envisioning a
> non-commutative Symbol with a shape and some optional attributes like
> is_symmetric, is_positive_definite, etc.... I imagine that Inverse and
> Transpose would be objects on top of expressions built up of these.
> To be clear this Matrix won't hold any data, it won't be mutable in any way,
> it'll just be a mathematical symbol.
> It may be that this work conflicts with Sherjil's work on revamping
> matrices. If that's the case I'll just hold off until some more ideal future
> when things are quiet. I'm hoping that this is relatively independent from
> his work.
> I was looking through the issues and it appears that similar thoughts have
> come up in the past. What's the general community wisdom on this topic?
> Best,
> -Matt
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to