Hopefully something in the tensor module could help you here (I'll defer that to someone more knowledgeable). Otherwise you'd need something like MatrixFunction (which isn't implemented yet, https://github.com/sympy/sympy/issues/5855), i.e., to represent the matrices as functions of i and j.
Aaron Meurer On Mon, Oct 17, 2016 at 7:43 PM, Andre Walker-Loud <walksl...@gmail.com> wrote: > Greetings, > > I am using sympy for the first time, and attempting to do matrix > multiplication like the following > > sum_{l,m} U[i,l] G[l,m] D[j,m] > > I want to do regular matrix multiplication, but only on one of the two > indices for the objects U and D, in my case for a known G (I want to put > numerical entries for the matrix G). I was hoping to have this print out a > symbolic expression. I found sympy.MatrixSymbol to create a symbolic > representation for U and D, but it seems I need some functionality from > sympy.tensor class to handle this type of multiplication. > > Does anyone have, or could anyone write down a simple example doing such a > multiplication? Let me make a simple specific example. > Let > > G = sympy.Matrix([[0,1], [-1,0]]) # > # [ 0 1 ] > # [ -1 0 ] > > So, in the above example, leaving i,j arbitrary, this would result in > > U[i,0] D[j,1] - U[i,1] D[j,0] > > I also want to multiply this by a G[i,j], but knowing how to do the above I > think will be sufficient for the complete multiplication. > > Thanks, > Andre > > -- > 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 sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > Visit this group at https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/b51fda12-c828-439b-bc14-51915ff6996d%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BFR7Q_Q6rLG4fZpMGmVODn3KjnpwPQ4ETThxJaS%3D_WYQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.