Developer Log
Micro-updates on research projects, bug investigations, readings, and current focus areas.
Compiling Imagination: Thinking Through How to Simulate a Qubit on a Laptop CPU
2026-07-20T12:00:00Z · NOTE
I don't own a quantum computer. Nobody I know does. So today I went down a rabbit hole on a much smaller question: if I did want to fake one on my own laptop using PennyLane or Qiskit, what would that actually involve? Haven't written a line of code yet. This is just me figuring out the shape of the problem before I touch a keyboard.
Here's the thing that got me thinking. Picture a coin spinning in the air. While it's spinning, it isn't "heads" or "tails" yet, it's some blend of both, with a specific weighting toward one side or the other. That blend is basically what a qubit is. And I'd be trying to capture that blend using a machine built entirely out of strict, deterministic 0s and 1s, the most binary substrate imaginable, and there's no physical processor on my desk holding a spinning coin in place. There's no Bloch sphere spinning in a fridge-sized dilution refrigerator next to me. Just Python and some linear algebra, in theory.
The idea, as I understand it so far
A qubit's state is described by two numbers, usually called $\alpha$ and $\beta$. They tell you how much of "0" and how much of "1" is baked into the spin:
$$
|\psi\rangle = \alpha|0\rangle + \beta|1\rangle, \quad \alpha, \beta \in \mathbb{C}, \quad |\alpha|^2 + |\beta|^2 = 1
$$
You don't see $\alpha$ and $\beta$ directly. They're more like the "settings" of the spin. Square their sizes and you get the actual odds of landing on 0 or 1: $|\alpha|^2$ and $|\beta|^2$, which always add up to 1. The weird part is that $\alpha$ and $\beta$ can cancel or reinforce each other before anything is measured. That's the "interference" people mean when they call quantum stuff spooky.
On the classical side, this blend is just a list of two numbers, a vector. A "gate" would just be a fixed grid of numbers (a matrix) that reshuffles that blend in a reversible way:
$$
|\psi'\rangle = U|\psi\rangle, \quad U^\dagger U = I
$$
So a common gate (Hadamard) applied to a coin that starts as a guaranteed "0" would look like this, on paper:
$$
H|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\\ 1 & -1\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix} = \frac{|0\rangle + |1\rangle}{\sqrt{2}}
$$
That's it, as far as I can tell. A grid of 4 numbers multiplied against a list of 2 numbers. No magic, just arithmetic dressed up in physics notation. Whether PennyLane and Qiskit actually expose it that plainly under the hood is exactly what I want to go check next.
The part that already makes sense to me, at least conceptually: this doesn't scale nicely. One coin is 2 numbers to track. Two coins isn't 4, it's every possible combination of their blends, still $2^2 = 4$ here, but the pattern is exponential, not additive. For $n$ coins:
$$
\dim(\mathcal{H}) = 2^n
$$
Which is presumably why everyone says classical simulation caps out somewhere in the 30-40 qubit range on real hardware, let alone a laptop. I haven't hit that wall myself yet since I don't have code running to hit it with, but it's good to know it's coming before I start.
Why this is worth compiling imagination over
There's no hardware that would be doing anything "quantum" here. No spinning coin physically happening in RAM. What I'd be building is a spreadsheet that tracks exactly what the blend would be, updated every time a gate is applied, a mathematical shadow of the real thing and not the real thing itself.
Without a real qubit to look at, that spreadsheet would be my only window into the Bloch sphere. Not a real quantum experiment. A very elaborate, very precise thought experiment that, if I build it right, should spit out correct odds.
That's the thought I kept circling back to today: you're not just writing code, you're compiling imagination into something that (hopefully) produces falsifiable numbers.
Next
- Actually install PennyLane and Qiskit and get a single-qubit circuit running. Nothing built yet, this was purely a "how does this work" pass.
- Once something runs, sanity-check the output against the Hadamard example above by hand.
- Then start poking at where the exponential wall actually bites on this machine.