A repository aimed at exploring quantum states, their applications, and computational complexity through fundamental implementations using Qiskit.
Unlike classical computers that use Bits (which can only be 0 or 1), quantum computers leverage the bizarre properties of quantum mechanics to process information using Qubits (Quantum Bits).
Here are the three fundamental pillars of quantum computing explained simply:
A classical bit is like a light switch—it is either OFF (0) or ON (1). A qubit is like a spinning coin—while it is spinning in the air, it is in a superposition of being both heads (0) and tails (1) at the exact same time.
In mathematics, applying a Hadamard Gate (
You cannot observe a superposition directly. The moment you measure a qubit, the superposition collapses instantly into a definite classical state of either 0 or 1. This is similar to stopping the spinning coin with your hand—it immediately collapses to either heads or tails.
Qubits can be linked together in a way that the state of one instantly dictates the state of another, no matter how far apart they are. Einstein famously called this "spooky action at a distance". Applying a CNOT gate is a common way to entangle two qubits, forcing them to always collapse into correlated states (e.g., both 00 or both 11).
- True Quantum Randomness: Leverages Qiskit and Aer quantum simulator.
- Interactive CLI: Prompts the user for the number of flips.
- Quantum Circuit Visualizer: Prints the ASCII circuit diagram directly to the terminal.
┌───┐┌─┐
q: ┤ H ├┤M├
└───┘└╥┘
c: 1/══════╩═
0
-
q: Qubit line where the Hadamard gate ($H$ ) and Measurement ($M$ ) occur. -
c: Classical register where the measurement result drops down ($0$ for Heads,$1$ for Tails).
Ensure you have Python 3.8+ installed.
Install the required quantum computing libraries:
pip install qiskit qiskit-aerExecute the script in your terminal:
python heads_or_tail_in_qiskit.pyThis project is open-source and available under the MIT License.