Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to visually represent multi-qubit system in Python?

I am trying to visually show a comparison between a 3-qubit system before and after a certain algorithim/gate has been performed on it.

For examle 3 qubit system before and after Hadamard gate

psi =   1|000> + 1|001> 

Hadamard 3-Qubit matrix

H =     [[ 0.3536  0.3536  0.3536  0.3536  0.3536  0.3536  0.3536  0.3536]
        [ 0.3536 -0.3536  0.3536 -0.3536  0.3536 -0.3536  0.3536 -0.3536]
        [ 0.3536  0.3536 -0.3536 -0.3536  0.3536  0.3536 -0.3536 -0.3536]
        [ 0.3536 -0.3536 -0.3536  0.3536  0.3536 -0.3536 -0.3536  0.3536]
        [ 0.3536  0.3536  0.3536  0.3536 -0.3536 -0.3536 -0.3536 -0.3536]
        [ 0.3536 -0.3536  0.3536 -0.3536 -0.3536  0.3536 -0.3536  0.3536]
        [ 0.3536  0.3536 -0.3536 -0.3536 -0.3536 -0.3536  0.3536  0.3536]
        [ 0.3536 -0.3536 -0.3536  0.3536 -0.3536  0.3536  0.3536 -0.3536]]


output = psi*H =    [[ 0.7071]
                     [ 0.    ]
                     [ 0.7071]
                     [ 0.    ]
                     [ 0.7071]
                     [ 0.    ]
                     [ 0.7071]
                     [ 0.    ]]

This could be written in ket notation as:

0.70711|000> + 0.70711|010> + 0.70711|100> + 0.70711|110>

I initially was thinking of using Bloch spheres but soon realised that Bloch spheres only work for a single qubit system.

I have come across the Quantum Toolbox for Python, QuTiP or specifically this page about visualisation (http://qutip.org/docs/2.2.0/guide/guide-visualization.html) but I'm a quite confused how this applies to what I am trying to achieve or what those visualisations are revealing about the system?

In this example my question would be what would be the best method to visualise or showcase the changes that have occured to the quantum system before and after the Hadamard gate was applied?

I am still a beginner when it comes to the quantum computing/qubits so any advice is welcome!

like image 844
Catherine Avatar asked Apr 15 '26 22:04

Catherine


1 Answers

The fact is it is very hard to visualize a multi-qubit system in a geometric way. The reason is that the equivalent of the Bloch sphere picture is in general very complicated for multi-qubit systems. The link in your question gives a way to visualize the state using the probability distributions we get from the density matrix of the state. This is a good way to look at multi-qubit system if you are interested in looking at how the probability changes once you fix a basis to do your measurement on.

Alternatively you can check out this quantum circuit visualization tool. It shows how the amplitudes change in the various bases once you apply a circuit. It works well if the system has few qubits like in your case

like image 103
biryani Avatar answered Apr 18 '26 13:04

biryani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!