Quantum Circuit Simulator Calculator

Build circuits with clear gate syntax, then compute outcomes quickly today here. Inspect statevectors, probabilities, and marginals; export results for research and learning easily.

Circuit Inputs

Keep qubits ≤ 6 to stay fast and readable.
Custom amplitudes are normalized automatically.
For n qubits, allowed range is 0 to 2^n − 1.
Provide 2^n values. Accepted: a, a+bi, a-bi, a+i, a-i, a+i0.3.
Syntax examples: H 0, RX 1 1.570796, CNOT 0 1, CZ 0 1, SWAP 0 2, MEASURE 1. Angles are radians.
Reset

Example Data Table

Qubits Gate list Key outcome
2 H 0
CNOT 0 1
Bell state with P(00)=0.5 and P(11)=0.5
1 RY 0 1.570796
MEASURE 0
Equal superposition: P(0)=0.5, P(1)=0.5
3 X 2
SWAP 0 2
Moves |001⟩ population to |100⟩

Formula Used

This simulator uses the statevector model. For n qubits, the state is a complex vector |ψ⟩ with 2^n amplitudes. Each gate is a unitary matrix U, and the circuit applies: |ψ′⟩ = U |ψ⟩.

Single-qubit gates use a 2×2 matrix acting on a chosen qubit, paired across basis states whose target bit differs. Controlled gates apply a conditional transformation when the control qubit is 1.

Measurement probabilities in the Z basis come from the Born rule: P(state) = |a_state|². Marginal probabilities for one qubit sum over all basis states that share the same bit value at that qubit.

How to Use This Calculator

  1. Choose the number of qubits, then select an initial state mode.
  2. If using Basis mode, set the index from 0 to 2^n − 1.
  3. If using Custom mode, provide exactly 2^n amplitudes.
  4. Enter your gate list, one instruction per line.
  5. Click Simulate Circuit to compute the final state.
  6. Review amplitudes, probabilities, measurement marginals, and Z expectations.
  7. Use the download buttons to export CSV or PDF results.

Tip: Start with 2–3 qubits, validate your circuit, then scale up.

Professional Article

1) What this simulator computes

This calculator performs statevector simulation for small quantum circuits. It represents an n-qubit register as a complex vector with 2^n amplitudes and updates that vector by applying unitary gates. The output lists amplitudes, probabilities, Z‑basis marginals, and per‑qubit <Z> expectations to summarize the final state.

2) Scaling and why qubits are limited

Statevector cost grows exponentially: memory scales with 2^n complex numbers and each single‑qubit gate touches paired amplitudes across the full vector. That is why this tool targets 1–6 qubits. Within this range, you can explore interference, entanglement, and measurement statistics without long runtimes or huge downloads.

3) Gate set and parameterized rotations

Common Clifford gates (H, X, Y, Z, S) and the T gate support many textbook circuits. Continuous control is provided by rotations RX, RY, and RZ, where angles are entered in radians. For example, RY 0 1.570796 prepares an equal superposition on a single qubit, while RZ changes relative phase without changing probabilities.

4) Entanglement through controlled operations

Multi‑qubit behavior appears when control logic couples qubits. A standard Bell pair uses H 0 then CNOT 0 1, producing two dominant basis states with equal probability. Controlled‑Z (CZ) adds a conditional phase, useful for phase‑kickback and many variational circuits. SWAP is included to move information between wires when mapping logic to hardware layouts.

5) Measurement data and interpretation

The calculator reports measurement marginals in the Z basis using the Born rule. These marginals summarize what you would see if you measured a qubit at the end of the circuit. Because the simulator stays in a pure statevector, the report does not permanently collapse the state; it provides probabilities for analysis and debugging.

6) Validating circuits with invariants

A quick quality check is probability conservation: the sum of all basis probabilities should be approximately 1, with minor differences due to rounding. Another check is expectation bounds: -1 ≤ <Z> ≤ 1. If a circuit behaves unexpectedly, test smaller subcircuits, then re‑combine them once results match your design intent.

7) Practical workflows using exports

Use CSV when you want the full statevector for plotting, post‑processing, or comparing against another simulator. The PDF is a compact report for documentation, lab notes, or student submissions. In research workflows, exporting intermediate results helps track how parameter changes affect amplitudes and measurement distributions.

8) Scope, assumptions, and next steps

This tool models ideal unitary evolution and Z‑basis measurement summaries. It does not include noise channels, density matrices, mid‑circuit measurement collapse, or sampling shots. For hardware‑level studies, extend the model with decoherence, readout error, and repeated sampling. For learning and prototyping, the current scope is fast, transparent, and easy to verify.

FAQs

1) What does “statevector” mean here?

It means the circuit is represented by a full complex vector of length 2^n. Gates update that vector exactly, producing amplitudes and probabilities for every computational basis state.

2) Why are angles entered in radians?

Rotation gates are defined using trigonometric functions of θ/2, and scientific workflows typically express θ in radians. If you have degrees, convert using θ(rad) = θ(deg) × π/180.

3) Do MEASURE lines collapse the quantum state?

No. MEASURE lines report marginal probabilities for the selected qubit in the Z basis. The simulator keeps a pure statevector and does not perform destructive, sequential collapse.

4) How do I prepare a Bell state?

Use two qubits, initialize |00⟩, then run: H 0 and CNOT 0 1. The statevector will show |00⟩ and |11⟩ with probability 0.5 each.

5) What is the meaning of <Z> for each qubit?

<Z> is the expected value of the Pauli‑Z operator. +1 indicates certainty of |0⟩, −1 indicates certainty of |1⟩, and values near 0 indicate a balanced or mixed outcome distribution.

6) Why might probabilities not sum to exactly one?

Small deviations come from rounding the displayed values. Internally the simulator conserves norm for unitary gates, so the true sum remains approximately 1 within floating‑point precision.

7) What is the largest circuit I should try?

Stay within 1–6 qubits and roughly 60 operations for quick feedback. If you need larger circuits, consider a backend optimized for vectorized linear algebra or a sampling‑based simulator.

Accurate simulations help learners debug circuits and build intuition.

Related Calculators

black hole temperatureenergy momentum tensorfeynman path integralbogoliubov transformationspontaneous symmetry breakingwigner d matrixredshift distance calculatorquantum tunneling calculatorpoisson bracket calculatorbeta function calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.