I'm trying to use sympy to compute symbolic results of quantum circuits using dirac notation. More specifically, I'd like to use the three rotation gates. I try to implement them in the following way, using sympy symbolic quantum physics package :
from IPython.display import display
from sympy import init_printing
init_printing(use_latex=True)
from sympy import expand, Eq, Symbol, simplify, exp, sin,cos,I,srepr,Matrix
from sympy.physics.quantum import *
from sympy.physics.quantum.qubit import *
from sympy.physics.quantum.gate import *
from sympy.physics.quantum.circuitplot import circuit_plot
theta = Symbol('theta')
Ry_mat = Matrix([[cos(theta/2), -sin(theta/2)],[sin(theta/2),cos(theta/2)]]) #check
Rx_mat = Matrix([[cos(theta/2), -I*sin(theta/2)],[-I*sin(theta/2),cos(theta/2)]]) #check
Ry = UGate((0,), Ry_mat)
Rx= UGate((1,), Rx_mat)
c = Ry*Rx
circuit_plot(c, nqubits=2);
qapply(c*Qubit('00'))
I get the error unhashable type: 'MutableDenseMatrix' when executing qapply. I tried to replace the line :
c = Rx*Ry
with
c = Rx
and then there is no more errors. Does someone know what's going on ? What am I doing wrong ?