Defining operators associated with a given HilbertSpace object in sympy

35 views Asked by At

I want to define operator objects in Sympy which are associated with different HilbertSpace objects. For example:

import sympy.physics.quantum as smq

H1 = smq.HilbertSpace()
H2 = smq.HilbertSpace()

a1 = smq.HermitianOperator("a1")
a0 = smq.HermitianOperator("a0")
a1.hilbert_space = H1
a0.hilbert_space = H1

b1 = smq.HermitianOperator("b1")
b0 = smq.HermitianOperator("b0")
b0.hilbert_space = H2
b1.hilbert_space = H2

I want the operators a0 to not commute with a1, but it should commute with b1. I saw that the operator has an attribute hilbert_space, but it does not seem to help. That is a0*b1 - b1*a0 is not zero. This is very helpful, rather necessary for symbolic manipulation of operators in quantum mechanics. Is there a way to define operators belonging to separate Hilbert spaces?

Thanks

0

There are 0 answers