On Tue, Nov 8, 2011 at 9:43 PM, Chris Smith <[email protected]> wrote: >> >> If I recall tensor_product_simp is designed to handle the >> TensorProduct()*TensorProduct() case only. Try doing this: >> >> tensor_product_simp(expand(op*state)) > > Should an expand_mul be part of the simp routine itself?
Yes, but the logic is quite a bit more complex. When tensor_product_simp gets passed a Mul, it calls tensor_product_simp_Mul which has the logic for that case. The challenge is that any arg of that Mul could be something like: * an Add with TensorProducts * a Pow of TensorProdiucts * Commutator/Anticommutators of TensorProducts And such expression can be nested arbitrarily deep. Throwing in an expand_mul will only cover the case where one or more of the arguments passed to tensor_product_simp_Mul is an Add. Separate logic is needed for the other cases. Cheers, Brian > -- > 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. > > -- Brian E. Granger Cal Poly State University, San Luis Obispo [email protected] and [email protected] -- 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.
