A collection of quantum computing notebooks built with PennyLane, exploring fundamental quantum algorithms from first principles.
Quantum_Projects/
├── Quantum Phase Estimation/
│ └── qpe.ipynb # Quantum Phase Estimation algorithm
├── Quantum_Fourier_Transform/
│ └── qft.ipynb # Quantum Fourier Transform (QFT)
├── requirements.txt
└── README.md
The Quantum Phase Estimation algorithm is a cornerstone of quantum computing. Given a unitary operator U and one of its eigenstates |ψ⟩, QPE estimates the phase φ such that:
U|ψ⟩ = e^(i·2π·φ)|ψ⟩
What this notebook covers:
- Theory behind QPE and its role in algorithms like Shor's and HHL
- Circuit construction using PennyLane's
ControlledSequenceand adjoint QFT - Demonstration with a phase-shift unitary:
U = PhaseShift(2π/5), so the true phase is φ = 0.2 - Probability distribution visualization highlighting the peak at the correct phase
Key circuit components:
| Block | Role |
|---|---|
| Hadamard layer | Create superposition on estimation wires |
| Controlled-U powers | Phase kickback encoding |
| Inverse QFT | Convert phase → computational basis |
The Quantum Fourier Transform is the quantum analogue of the classical Discrete Fourier Transform (DFT). It is a key subroutine in many quantum algorithms, including Shor's algorithm and QPE.
What this notebook covers:
- Mathematical relationship between QFT and the classical DFT
- Comparison of QFT matrix vs. DFT matrix (they are equal!)
- Circuit decomposition using Hadamard and controlled-phase gates
- Forward QFT transforming a computational basis state
- Inverse QFT: verifying the round-trip restores the original state
- Python 3.9+
pip
# Clone the repository
git clone https://github.com/<your-username>/Quantum_Projects.git
cd Quantum_Projects
# Create and activate a virtual environment (recommended)
python -m venv .venv
.venv\Scripts\activate # Windows
source .venv/bin/activate # macOS / Linux
# Install dependencies
pip install -r requirements.txt# Launch Jupyter
jupyter notebookThen open any .ipynb file from the Jupyter file browser and run cells top-to-bottom (Shift+Enter).