From the qiskit documentation (here), a general form of a single qubit unitary is defined as $$ U(\theta, \phi, \lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -e^{i\lambda} \sin\left(\frac{\theta}{2}\right) \\ e^{i\phi} \sin\left(\frac{\theta}{2}\right) & e^{i(\lambda + \phi)} \cos\left(\frac{\theta}{2}\right) \end{pmatrix}. $$ Where $0โค๐โค๐, 0โค๐<2๐, \text{and} \ 0โค๐<2๐$. However, when I tried to put some arguments out of the range, the gate still operates. For example, if I set $\theta = -1,\phi=8,\lambda=7$,
simulator = Aer.get_backend('statevector_simulator')
quancir = QuantumCircuit(1)
quancir.u3(-1,8,7,0)
results = execute(quancir, simulator).result()
resvec = results.get_statevector(quancir)
bloch_sphere([conv(resvec)])
I can still visualize how the $U_3$ gate operates on the initial state $|0\rangle$, and plot the final vector:
I'm wondering if my arguments aren't in the expected range, like in this case, what really happened to the $U_3$ gate? Am I still getting the vector I want, or do I need to convert the arguments myself to make sure the output vector is correct? Thanks:)
Update: I tried to take the mod of those parameters but it looks like the output vector is different (points toward the opposite direction):
quancir = QuantumCircuit(1)
T = float(-1%pi)
P = float(8%(2*pi))
L = float(7%(2*pi))
quancir.u3(T,P,L,0)
results = execute(quancir, simulator).result()
resvec = results.get_statevector(quancir)
bloch_sphere([conv(resvec)])
quancir = QuantumCircuit(1) quancir.u3(-1+2*pi,8 - 2*pi ,7 - 2*pi,0) resvec =quancir.statevector() bloch_sphere([resvec])
Try this... $\endgroup$