Quirk: A Browser-Based Quantum Circuit Simulator for Learning the Basics
Quirk is a web tool for simulating quantum circuits in real time. Developed by Craig Gidney from Google for rapid prototyping and visualization of quantum operations. The simulator updates the circuit state every 0.1 seconds without manual triggering, speeding up experiments by 100 times compared to pure JavaScript.
Suitable for mid-level and senior developers learning quantum computing: testing hypotheses, debugging small circuits up to 16 qubits, demonstrating algorithms without installing software.
Interface and Navigation
The main menu includes documentation, videos, source code, and example circuits. The workspace is divided into panels:
- Top: Basic gates, probes, displays.
- Bottom: Advanced gates, arithmetic.
- Central field: Drag-and-drop gates.
To the left of qubits are state indicators (|0⟩, |1⟩, |+⟩, |-⟩, |i⟩, |-i⟩). Delete a gate by dragging it outside. The URL encodes the circuit for saving.
Color coding:
- White: Static gates.
- Yellow: Animated (rotating in real time).
- Gray: Multi-qubit.
- Green/blue: Displays (Amps shows complex amplitudes).
Hovering over an element reveals its matrix and rotation axes.
Gate and Element Groups
Probes and Displays
Probes extract information without altering state, useful for debugging. Displays show amplitudes and probabilities at any point in the circuit.
Rotations and Basic Operations
- Half turns: X/Y/Z at 180°, H (superposition), Swap.
- Quarter turns: √X/√Y/√Z (90°), S (√Z).
- Eighth turns: T (45°), fractional roots.
Spinning: Continuous rotation, angle set by dragging.
Formulaic: Formulas with t, x, y (e.g., sin(t)).
Parametrized: Variable A for angles, dependent on inputs.
Advanced Groups
- Sampling: Probabilistic measurements without branching, recalculated on click.
- Parity: Control of parity for a group of qubits.
- X/Y Probes: Measurements in X/Y bases.
- Order: Inversion of qubit order for arithmetic.
- Frequency: QFT, gradients for phase tuning.
Others include arithmetic on quantum registers (addition, multiplication).
Built-in Circuit Examples
Quirk includes demonstration circuits for key algorithms:
- Grover Search: Search in O(√N), iterations increase probability.
- Shor Period Finding: Period B^r ≡ 1 mod R, peaks after QFT.
- Bell Inequality Test: Violation of local realism via entanglement.
- Quantum Teleportation: State transfer through entanglement.
- Superdense Coding: 2 classical bits in 1 qubit + pair.
- Delayed Choice Eraser: Retroactive path erasure, interference by choice.
| Circuit | Key Effect | Qubits |
|---------|------------|--------|
| Grover | Probability grows | 3-5 |
| Shor | Peaks at 1/r | 8+ |
| Bell | Correlations > classical | 4 |
| Teleport | Transfer without copying | 3 |
| Superdense | 100% decoding | 2 |
| Eraser | Interference post-factum | 4 |
Limitations and Applications
Maximum 16 qubits—for prototypes, not production. No custom gates via UI, detector statistics, or mobile optimization. Hidden gates are accessible via URL.
Advantages for developers:
- No registration, instant response.
- Real-time state visualization.
- Open source (Apache 2.0).
Ideal for intuitive understanding: superposition, entanglement, QFT without code.
Key Points
- Real-time simulation (0.1s/frame) accelerates iterations.
- Displays show states inside the circuit, not just output.
- Support for formulas/parameters for dynamic gates.
- Built-in examples of key algorithms (Grover, Shor).
- 16-qubit limit—focus on learning, not scaling.
— Editorial Team
No comments yet.