This is probably the same bug.  Try using Integer(1) everywhere where
you have 1 (a shorter version that also should work is S(1)).

I opened http://code.google.com/p/sympy/issues/detail?id=2824 for this.

Aaron Meurer

2011/11/4 Uğur Güney <[email protected]>:
> Thanks! "Integer(1)" worked as expected. But can you please tell me why
> "Qubit(0)*Dagger(Qubit(0))+Qubit(1)*Dagger(Qubit(1))" does not work as the
> identity operator?
> from sympy import *
> from sympy.physics.quantum import *
> from sympy.physics.quantum.qubit import *
> state = TensorProduct(Qubit(0),Qubit(1)) # example state
> id1 = Integer(1) # identity op. type 1
> id2 = Qubit(0)*Dagger(Qubit(0))+Qubit(1)*Dagger(Qubit(1)) # identity op.
> type 2
> proj1 = TensorProduct(id1, Qubit(1)*Dagger(Qubit(1))) # projection op which
> affect only the second Hilbert space
> proj2 = TensorProduct(id2, Qubit(1)*Dagger(Qubit(1)))
> # apply operator on the state
> print "1)"
> print qapply(tensor_product_simp(proj1*state)) # this works
> print "2)"
> print qapply(tensor_product_simp(proj2*state)) # this gives an error
> # AttributeError: 'int' object has no attribute 'is_commutative'
> Regards,
> vug
>
> --
> 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.
>

-- 
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.

Reply via email to