Re: Expressions involving both matrix-matrix and componentwise matrix multiplication

19 views
Skip to first unread message

David Ketcheson

unread,
Oct 21, 2012, 4:45:18 AM10/21/12
to sy...@googlegroups.com, dke...@gmail.com
Sorry for the duplicate post; when my first question did not appear, I posted another.  I did not realize that every question is held for moderation.  Moderators, feel free to delete this thread.

On Sunday, October 21, 2012 11:20:11 AM UTC+3, David Ketcheson wrote:
I would like to write expressions involving the equivalents of MATLAB's "*" and ".*"; i.e.

A*(B.*C)

should mean

\sum_j A_{ij} ( \sum_{pq} B_{pq} * C_{pq} )_{jk}.

I don't want to actually instantiate matrices because I don't care to specify their shape or to index into them.  Really I just need two kinds of multiplication of non-commutative symbols.  Is this possible in Sympy?

Chris Smith

unread,
Oct 21, 2012, 5:45:12 AM10/21/12
to sy...@googlegroups.com
>> I don't want to actually instantiate matrices because I don't care to
>> specify their shape or to index into them. Really I just need two kinds of
>> multiplication of non-commutative symbols. Is this possible in Sympy?


I should have left the initial example that I wrote, but then I
thought I would copy from the docs. Again, the element-wise is not
implemented (AFAIK) but


>>> MatrixSymbol('A',n,n)*MatrixSymbol('B',n,n)
A*B
>>> _[i,j]
Sum(A(i, _k)*B(_k, j), (_k, 0, n - 1))


Is that more what you need?
Reply all
Reply to author
Forward
0 new messages