There's no easy way yet to define custom automatic multiplication (see https://code.google.com/p/sympy/issues/detail?id=1941 and the pages linked to there). It is possible to write a little helper function that goes through an expression and rewrites products of Adds using this algorithm.
Aaron Meurer On Thu, Apr 4, 2013 at 5:12 PM, Alan Bromborsky <[email protected]> wrote: > let e_1,...,e_n bet a set of noncommutative symbols. Consider the sympy > expressions - > > a = a_0+a_1*e_1+...+a_n*e_n > > b = b_0+b_1*e_1+...+b_n*e_n > > and you are given a multiplication table for the e_i's in the form of a > dictionary mul_table[(e_i,e_j)]. > Each entry in the table is a linear combination of a scalar and the e_i's. > > What is the most efficient way of performing the operation a*b where the > table results for e_i*e_j are > substituted (a*b is again a linear combination of a scalar and the e_i's). > > For example is there a way of overloading the __mul__ operation for > expressions to test and substitute > for products of the form e_i*e_j? > > -- > 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?hl=en-US. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
