Visualizations¶
The live visualizations in IBM Quantum Composer show you different views of how quantum circuits affect the state of a collection of qubits. Each type of live visualization is explained in detail below.
Randomness in the simulator
The live visualizations come from a single-shot statevector simulator, which is different from the
system specified in the Run settings, which can have multiple shots. The simulator
creates randomness by generating
results based on a seed. The seed is the initial value introduced into the
algorithm that generates pseudorandom numbers and simulates quantum randomness. Because the seed is
fixed during your circuit
session, your live visualizations will be repeatable. However, when you close your circuit and re-open it,
the seed will have a new value, so you may see a different visualization. You can set the
seed yourself by changing the value
in the box (up to four digits) after the words Visualizations seed
above the Composer, and observe
how the live visualizations for your circuit change.
View visualizations¶
The live visualizations are shown in windows at the bottom of the Quantum Composer workspace (except the phase disk, which appears at the end of each qubit wire). You can choose any combination of statevector, probabilities, and q-sphere visualizations to appear at the bottom of the workspace. Select or unselect visualizations in the View menu.
Download visualizations¶
Download one of the visualizations at the bottom of the Quantum Composer workspace by clicking the More options menu in the visualization window. You can download visualizations as an SVG, a PNG, or a CSV of the underlying data. You can also download the visualization images of the measurement probabilities and statevector histograms as a PDF.
Phase disk¶
As described in the Field Guide, a single-qubit state can be represented as
where is the probability that the qubit is in the state, and is the quantum phase. is strongly analogous to a classical probabilistic bit. For , the qubit is in the state, for the qubit is in the state, and for the qubit is a 50/50 mixture. We call this a superposition as, unlike classical bits, this mixture can have a quantum phase. The phase disk visualizes this state.
The phase disk at the terminus of each qubit in IBM Quantum Composer gives the local state of each qubit at the end of the computation. The components of the phase disk are described below.
Probability the qubit is in the state
The probability that the qubit is in the state is represented by the blue disk fill.
Quantum phase
The quantum phase of the qubit state is given by the line that extends from the center of the diagram to the edge of the gray disk (which rotates counterclockwise around the center point).
Example: phase disks for two different qubits
Two examples of the phase disk visualization. The first example is a state and the second shows the state with a nonzero relative phase.
Connection to the Bloch sphere
The phase disk, which contains all the information in the Bloch sphere, is a two-dimensional representation of a qubit. To convert to the Bloch sphere representation: , , and .
N-qubit states: maximum 15 qubits
An N-qubit quantum state takes the form
where is the probability that the qubits are in the state with quantum phase with respect to the state. is the probability that the qubits are not in the ground state . Here it is simple to see that for an N-qubit quantum state there are probabilities and phases. The phase disk fails to represent this state, as N-qubit phase disks would only contain probabilities and phases; this is because most states are entangled and are not separable into independent single-qubit quantum states. To represent that full information is not contained in this visualization, we introduce the reduced purity as a component in the phase disk.
Reduced purity of the qubit state
The radius of the black ring represents the reduced purity of the qubit state, which for qubit in an -qubit state is given by . The reduced purity for a single qubit is in the range ; a value of one indicates that the qubit is not entangled with any other party. In contrast, a reduced purity of shows that the qubit is left in the completely mixed state, and has some level of entanglement over the remaining qubits, and possibly even the environment.
Probabilities view¶
8-qubit limit
This view visualizes the probabilities of the quantum state as a bar graph. The horizontal axis labels the computational basis states. The vertical axis measures the probabilities in terms of percentages. In this view the quantum phases are not represented, and is therefore an incomplete representation. However, it is useful for predicting the outcomes if each qubit is measured and the value stored in its own classical bit.
Consider the following quantum circuit and its probabilities view:
A circuit consisting of a column of Hadamards that creates an equal superposition of the computational basis states, followed by a two-qubit controlled-Z (CZ) gate.
A quantum circuit and its probabilities view.
The circuit puts the two qubits into the state The computational basis states are and The probabilities for each of the computational states is 1/4.
Q-sphere view¶
5-qubit limit
The q-sphere represents the state of a system of one or more qubits by associating each computational basis state with a point on the surface of a sphere. A node is visible at each point. Each node’s radius is proportional to the probability () of its basis state, whereas the node color indicates the quantum phase ().
The nodes are laid out on the q-sphere so that the basis state with all zeros (e.g., is at its north pole, and the basis state with all ones (e.g., ) is at its south pole. Basis states with the same number of zeros (or ones) lie on a shared latitude of the q-sphere (e.g., ). Beginning at the north pole of the q-sphere and progressing southward, each successive latitude has basis states with a greater number of ones; the latitude of a basis state is determined by its Hamming distance from the zero state. The q-sphere contains complete information about the quantum state in a compact representation.
Consider the following quantum circuit and its q-sphere:
A quantum circuit and the q-sphere representing the state the circuit creates.
You can select, hold, and drag to rotate the q-sphere. To return the q-sphere to its default orientation, select the rewind-arrow button to the top right of the q-sphere.
What is the difference between a Bloch sphere and a q-sphere?
It is important to highlight that the q-sphere is not the same as the Bloch sphere, even for a single qubit. Indeed, like the phase disk, the Bloch sphere gives a local view of the quantum state, where each qubit is viewed on its own. When trying to understand how registers of qubits (multi-qubit states) behave upon the application of quantum circuits, it is more insightful to take a global view and look at the quantum state in its entirety. The q-sphere provides a visual representation of the quantum state, and thus this global viewpoint. Therefore, when exploring quantum applications and algorithms on small numbers of qubits, the q-sphere should be the primary visualization method.
Statevector view¶
6-qubit limit
It is common to call the quantum amplitude. This view visualizes the quantum amplitudes as a bar graph. The horizontal axis labels the computational basis states. The vertical axis measures the magnitude of the amplitudes () associated with each computational basis state. The color of each bar represents the quantum phase ().
Consider the following quantum circuit and its statevector view:
The statevector at the terminus of the above circuit. The color wheel maps phase angle to color. The output state is expressed as a list of complex numbers.
The circuit puts the two qubits into the state . The computational basis states are , , , and . The magnitudes of the amplitudes are , and the quantum phases with respect to the ground state are for and , and for .