Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/itsubaki/qasm-playground/llms.txt

Use this file to discover all available pages before exploring further.

After you run an OpenQASM circuit, the simulator returns a list of quantum states — one for each basis vector that has a non-zero amplitude in the final superposition. These results appear in the right panel as state cards. This page explains what each field means, how the display is organized, and how to explore results in the full-screen table.

What quantum states represent

When a quantum circuit finishes executing, the qubits exist in a superposition described by a state vector. Each component of that vector corresponds to a classical bit string (a basis state) and carries a complex-valued amplitude. The probability of measuring that basis state is the squared magnitude of its amplitude. The playground surfaces three values per basis state:
  • Basis string — the classical bit pattern in ket notation
  • Probability — the likelihood of measuring that basis state
  • Amplitude — the complex number whose squared magnitude equals the probability

State cards

Each state in the results panel is rendered as a card with the following layout.

Basis (ket notation)

The top of each card shows the basis state in ket notation. For example, a two-qubit state with bits 0 and 1 is displayed as |01⟩. Bit strings are displayed in declaration order — the order in which qubits are declared in your OpenQASM program. The first declared qubit occupies the most significant bit position (leftmost character) in the string. If your circuit uses multiple qubit registers, each register produces its own ket label and they are concatenated: for example, |01⟩|10⟩.

Probability

The probability is shown as a six-decimal-place value, for example 0.500000. Below it, a horizontal bar visualizes the probability relative to 1.0. The bar is always at least 6 px wide so that low-probability states remain visible.

Amplitude

The complex amplitude is shown in rectangular form:
±<real> ± <imag>i
Both parts are formatted to six decimal places with fixed-width columns so that values in different states align visually when scanned down the panel.
For a state with probability p, the amplitude a + bi satisfies a² + b² = p. A pure basis state (probability 1.0) has amplitude 1.000000 + 0.000000i. An equal superposition of two states each has amplitude approximately 0.707107 + 0.000000i.

Sort modes

The Sort button in the results toolbar cycles through two ordering modes:
ModeDescription
Index order (default)States appear in the order returned by the simulator, which corresponds to ascending integer value of the basis bit string
Probability descendingStates are re-ordered from highest to lowest probability, making it easy to identify the most likely outcomes at a glance
Sort mode applies to both the side-panel cards and the full-screen results table. Clicking Sort again returns to index order.

Full-screen results table

Clicking the Quantum States heading in the results panel opens a full-screen dialog with a tabular layout. This is useful when a circuit produces many states and the card layout becomes hard to read. The table has four columns:
ColumnContents
BasisBasis state in ket notation, sticky-scrolls horizontally
AmplitudeComplex amplitude in ±real ± imagi format
ProbabilityNumerical probability to six decimal places
(bar)Visual probability bar
The Basis column is sticky — it remains pinned to the left edge as you scroll the table horizontally, which is helpful for circuits with long bit strings. To close the dialog, click the Close button in the dialog header, or click anywhere on the backdrop behind the dialog.
The Quantum States heading is only clickable when results are loaded and there is no active error. When no results are available, the heading is non-interactive.

Copying results as JSON

The Copy button in the results toolbar serializes all current results to JSON and writes them to your clipboard. The JSON follows this structure:
{
  "states": [
    {
      "binaryString": ["00"],
      "int": [0],
      "probability": 0.500000,
      "amplitude": {
        "real": 0.707107,
        "imag": 0.0
      }
    },
    {
      "binaryString": ["11"],
      "int": [3],
      "probability": 0.500000,
      "amplitude": {
        "real": 0.707107,
        "imag": 0.0
      }
    }
  ]
}
binaryString is an array of strings — one per qubit register — giving the bit pattern for that register. int is the integer value of each bit string. amplitude.real and amplitude.imag are both optional fields; if a component is zero, it may be omitted from the response.
Copy the JSON output to analyze results in a script or notebook. The probability values sum to 1.0 (within floating-point precision) across all returned states.

Build docs developers (and LLMs) love