I realized that when I try to multiply two objects, "a tensor product" and "a sum of tensor products", SymPy makes a wrong calculation. For example, say, this is what I am trying to compute: http://mathurl.com/cfj5zfc The answer must be zero at the end. This is what SymPy does at tensor_product_simp step: http://mathurl.com/cc5sxlz which is incorrect.
Here is the code I am using: from sympy import * from sympy.physics.quantum import * from sympy.physics.quantum.qubit import * q0 = Qubit(0) q1 = Qubit(1) state = TensorProduct(q0,q0)+TensorProduct(q1,q0) # state as a sum of tensor products op = TensorProduct(1, q0*Dagger(q1)) # a operator as a tensor product print tensor_product_simp(op*state) # ? print " " print qapply(tensor_product_simp(op*state)) # operator applied to the state, answer must be 0 but it is not. What I understand is that tensor_product_simp() does this: (AxB)(CxD) -> ACxBD. But here, instead of (CxD) I have (CxD+ExF). And t_p_s() gives something like: A(CxD+ExF)xB(CxD+ExF), which is incorrect. It must be (AxB)(CxD)+(AxB)(ExF)=ACxBD+AExBF. Actually I am not sure whether this is my mistake or tensor_product_simp()'s mistake. :-) Maybe it is not intended to do this kind of calculations. Regards, vug -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.