用 numpy 造一台量子模拟器

Build a Quantum Simulator with numpy

No quantum hardware needed — entangle qubits in a browser and turn mystical gates into visible matrix multiplications

6 labs9 AI-mentored sessions~5 hoursBilingual · EN / 中
Start learning →

About this course

Quantum computing sounds like mysticism: superposition, entanglement, one query
answering a global question. This course's stance: it is all just linear algebra —
and linear algebra is something you can compute by hand. Starting from a single
2-dimensional complex vector, you'll build your own n-qubit state-vector simulator
in pure numpy: gates become visible matrix multiplications, measurement becomes
sampling by |amplitude|², and entanglement becomes a bar chart that stubbornly shows
only 00 and 11. Then every famous scene replays on YOUR simulator: BB84 catching an
eavesdropper, teleporting a quantum state, Grover's √N speedup, and Shor's
period-finding factoring 15. No qiskit, no GPU, no network — every script runs in
under a second with deterministic, assertable results.

What you'll learn

  • Represent n-qubit states as numpy complex vectors and write X/H/Z/CNOT as visible matrix multiplications
  • Implement measurement & collapse by sampling |amplitude|², and watch 10,000 shots hug the theoretical probabilities
  • Construct Bell and GHZ states, and capture entanglement red-handed in a joint-measurement histogram showing only 00/11
  • Run Deutsch-Jozsa, Bernstein-Vazirani and Grover on your own simulator, measuring one-query and √N speedups
  • Implement BB84 eavesdropper detection, superdense coding and quantum teleportation — entanglement as a spendable resource
  • Build the QFT and phase estimation, factor 15 via Shor's period finding, and survive a bit flip with the 3-qubit repetition code

Syllabus

1A State-Vector Simulator: from Superposition to Entanglement3 sessions
  • 1A Qubit Is Just a Two-Dimensional Complex Vector30 minStart →
  • 2Entanglement, Bell States, and the First Quantum Speedup30 minStart →
  • 3Packaging the Simulator: Gates on Any Qubit, GHZ & Collapse30 minStart →
2Entanglement as a Resource: No-Cloning, Superdense Coding & Teleportation3 sessions
  • 1No-Cloning & BB84: The Laws of Physics as Your Security Guard30 minStart →
  • 2Superdense Coding: 2 Bits in 1 Qubit30 minStart →
  • 3Quantum Teleportation: Move the State, Destroy the Original30 minStart →
3Black-Box Speedups: Bernstein-Vazirani & Grover Search3 sessions
  • 1Bernstein-Vazirani: Read the Hidden String in One Query30 minStart →
  • 2Grover Search I: The Geometry of Amplitude Amplification30 minStart →
  • 3Grover Search II: Nailing √N to Your Own Experimental Curve30 minStart →
4The QFT, Phase Estimation & Shor's Period Finding0 sessions

Sessions are on the way.

5Noise, Density Matrices & Quantum Error Correction0 sessions

Sessions are on the way.

6Variational Quantum Algorithms: VQE & QAOA0 sessions

Sessions are on the way.

Same series · 计算机科学与工程探索

CS & Engineering Explorations

Build from scratch the systems you usually treat as black boxes — and understand them to the core.