Dear Sympy users,
I'm a physics PhD student, doing research on differences between classical
and quantum correlations.
I was in need of a simple calculator which works with quantum states etc.
While searching for quantum simulators in Python I came to know that there
is already a quantum module in SymPy. Because I couldn't find an explicit
documentation I looked at the source files to understand how basic
calculations can be done using the quantum module.
Can you please help me in applying a projection operator on a general
state. This is the code that I tried:
from sympy import *
from sympy.physics.quantum import *
from sympy.physics.quantum.qubit import *
[c00,c01,c10,c11]=var('c00,c01,c10,c11') # coefficients
state = c00*Qubit('00')+c01*Qubit('01')+c10*Qubit('10')+c11*Qubit('11') #
most general two-qubit state
qbt=Qubit('01') # a qubit
proj = qbt*qbt.dual # projection operator
# proj*state # operator applied on the state
# (proj*state).expand() operator applied on each term in the expansion
print (proj*state).expand().doit() # try to do the inner-products
In the last step "doit()" did not work as I expected, it did not do the
inner products. I suspect that the expression involving TensorProduct is
not converted to InnerProduct automatically. But normally
"(Qubit('01').dual*Qubit('01')).doit()" and
"(Qubit('00').dual*Qubit('01')).doit()" work as expected and give 1 and 0.
I'll be happy if you can guide me how to use this beautiful tool.
Best,
ugur guney
--
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.