Quantum Simulator

Build a simulator for quantum states, gates, and circuits.

← Quantum Computing projects

Learn Mathematics Quantum Computing

Question

How can a classical program reproduce quantum states, gates, and measurements?

Goals

  • Represent single and multiple qubits with complex amplitudes.
  • Build gates, circuits, and probabilistic measurement in a simulator.

Method

Use vectors for states and matrices for the operations applied to them.

  • Store a normalized state vector and combine qubits with tensor products.
  • Apply unitary gate matrices and sample measurement outcomes from their probabilities.
  • Test small circuits such as Deutsch's or Simon's algorithm against expected results.

Try an example

Apply simple quantum gates to one qubit, then connect its state vector with the probabilities of measuring 0 or 1.

Controls: Use X, H, and Z to change the state. Click MEASURE to sample an outcome and RESET to return to |0⟩.