https://github.com/user-attachments/assets/8e590dea-a3be-4980-ae6c-c86ab52ca006
Since I started in quantum computing, Bloch sphere rotations were a big trouble to me. It was easy to get stuck, or simply don’t understand what was happening.
So, today I decided to test some rotations and understand it better.
First of all, Quirk
was a great deal to me. If you visit Quirk’s website, you’ll see a bunch of stuff before you. However, the greatest feature of this simulator, is the gates explanation when you keep your mouse over each operator. In my case, looking at the explanation of Z
, X
, H
and Y
gates made all the difference to me.
The great thing about those descriptions are those tiny arrows pointing to the rotation direction. This way, was possible to understand how it works.
Although the understanding was reached, I needed to test with some some. For that, I prepared a Qutip snippet a plot the vector onto a 3d Bloch Sphere.
The RX rotation is the same as fixing the vector from the origin to the farthest point in the X axis, then rotating everything around by some angle.
The RY rotation is the same as fixing the vector from the origin to the farthest point in the Y axis, then rotating everything around by some angle.
The RZ rotation works the same way as the others, however this time we need to use a initial state in half superposition to visualize the state transition, rotating the states in the horizontal axis unlike its counterparts.
For this experiment, you may start explore the Quirk simulator visiting algassert.com/quirk. Then, locally you need to install:
install the dependencies:
pip install -r requirements.txt
after that, You’re ready to run:
python plots.py
# and
python animate.py