A complete, runnable implementation of quantum algorithms, noise modelling, and quantum sensing simulations using IBM's Qiskit framework. All code runs on the Qiskit Aer local simulator — no quantum hardware access required.
| File | What it covers |
|---|---|
1_quantum_circuits.py |
Bell states, Grover's search, quantum teleportation |
2_qaoa_vqe.py |
QAOA for MaxCut, VQE for Ising ground state |
3_noise_modelling.py |
Depolarizing noise, T1/T2 decoherence, readout errors, fidelity |
4_quantum_sensing.py |
Ramsey interferometry, Trotter evolution, SNR scaling |
pip install qiskit qiskit-aer numpy scipy matplotlib
python 1_quantum_circuits.py
python 2_qaoa_vqe.py
python 3_noise_modelling.py
python 4_quantum_sensing.pyBell states — Four maximally entangled 2-qubit states. Measuring one qubit instantly determines the other regardless of distance.
Grover's algorithm — Finds a marked item in an unsorted database in O(√N) queries vs O(N) classically. On 3 qubits (8 items), achieves 94%+ probability on the target.
Quantum teleportation — Transmits a qubit state using a shared Bell pair and 2 classical bits. No quantum information is transmitted faster than light (no-cloning theorem respected).
Solves combinatorial optimization problems (here: MaxCut on a 5-node graph). Uses alternating problem and mixer unitaries parameterised by (γ, β), optimised classically.
| Depth p | Approximation ratio |
|---|---|
| 1 | 0.641 |
| 2 | 0.766 |
| 3 | 0.785 |
Classical optimum (brute force) = 5.0. QAOA at p=3 achieves ~3.93 expected cut.
Finds ground state energy of the 1D transverse-field Ising Hamiltonian: H = -J·ΣZZ - h·ΣX using a hardware-efficient ansatz (Ry layers + CNOT entanglers). Minimises ⟨ψ(θ)|H|ψ(θ)⟩ via classical COBYLA optimizer.
Three noise channels modelled:
Depolarizing noise: After each gate, the qubit state is replaced with the maximally mixed state I/2 with probability p. GHZ fidelity drops from ~0.996 (p=0.001) to ~0.834 (p=0.05).
T1/T2 decoherence:
- T1 (amplitude damping): qubit spontaneously decays from |1⟩ to |0⟩ with rate 1/T1
- T2 (dephasing): phase coherence lost with rate 1/T2, T2 ≤ 2·T1
Readout errors: Confusion matrix — P(measure 0 | state |1⟩) and P(measure 1 | state |0⟩). Even small readout errors (2-5%) significantly distort probabilities for multi-qubit circuits.
Ramsey interferometry — Core protocol for atomic clocks, magnetometers, and accelerometers. Sequence: π/2 pulse → free precession under field → π/2 pulse → measure. Phase accumulated encodes the field strength. Noise reduces fringe contrast (ideal: 0.999, noisy p=0.02: 0.974).
SNR scaling:
- Classical (shot noise limit): SNR ∝ √N
- Quantum (Heisenberg limit): SNR ∝ N
- At N=10: quantum advantage = 3.16×
Trotter evolution — Simulates time evolution under H = -J·ΣZZ - h·ΣX by decomposing U(t) into alternating ZZ and X rotations. Useful for quantum chemistry and materials simulation.
bell_states.png— measurement histograms for all 4 Bell statesgrover_search.png— probability distribution after Grover's algorithmqaoa_approximation_ratio.png— approximation ratio vs QAOA depthqaoa_distribution.png— QAOA output bitstring histogramvqe_convergence.png— VQE energy minimisation curvenoise_analysis.png— fidelity vs noise, T1 decay, readout confusionquantum_sensing.png— Ramsey fringes, Trotter dynamics, SNR scaling
Qiskit, Python, NumPy, SciPy, quantum circuits, variational algorithms, noise modelling, quantum sensing, Hamiltonian simulation