1
$\begingroup$

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: enter image description here

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)])

enter image description here

$\endgroup$
11
  • 1
    $\begingroup$ These are periodic functions. So for instance, $\sin(3) = \sin(3 + 2\pi)$. $\endgroup$
    – KAJ226
    Mar 25, 2021 at 21:36
  • 1
    $\begingroup$ quancir = QuantumCircuit(1) quancir.u3(-1+2*pi,8 - 2*pi ,7 - 2*pi,0) resvec =quancir.statevector() bloch_sphere([resvec]) Try this... $\endgroup$
    – KAJ226
    Mar 25, 2021 at 22:10
  • 1
    $\begingroup$ It is the same as $-1\%(2\pi)$. Note in the function, the factor is $\theta/2$. $\endgroup$
    – KAJ226
    Mar 25, 2021 at 22:23
  • 1
    $\begingroup$ It should be. If you plug in different parameters then you can see it. $\endgroup$
    – KAJ226
    Mar 25, 2021 at 22:30
  • 1
    $\begingroup$ @KAJ226 Thank you so much:) $\endgroup$
    – ZR-
    Mar 25, 2021 at 22:40

1 Answer 1

3
$\begingroup$

In this case all input parameters will be mod $4\pi$, $2\pi$, and $2\pi$ for $\theta$, $\phi$, and $\lambda$ respectively. You will obtain the same vector that you would have received if you took the mod of these parameters yourself.

$\endgroup$
2
  • $\begingroup$ Thanks for the answer! I tried that but it turns out that the vector is different (I just updated my question). $\endgroup$
    – ZR-
    Mar 25, 2021 at 21:37
  • $\begingroup$ You're right, I have corrected my answer. $\theta$ is $4\pi$ periodic due to its factor of $1/2$ as seen in its matrix representation. $\endgroup$ Mar 28, 2021 at 15:57

Your Answer

By clicking โ€œPost Your Answerโ€, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.