A discrete-time coined quantum walk on a line stores, at every site x, a two-component complex amplitude (a "coin" pointing left/right). One step interleaves a coin flip and a shift, exactly like the 2D grid-search version of this sim, just on a 1D lattice so the interference pattern is easy to read off a single chart:
|ψ_{t+1}⟩ = S · (H ⊗ I) |ψ_t⟩
H = Hadamard coin (unmarked sites):
H = 1/√2 [[1, 1], [1, -1]]
H' = −I (π phase flip) at the MARKED site when search mode is on
S = shift: L-amplitude moves to x−1, R-amplitude moves to x+1
(reflecting walls keep S unitary at the lattice edges)
Starting from a symmetric coin state at the origin, the interference between the two coin channels produces a double-peaked probability distribution that spreads ballistically: its standard deviation grows like t, so its variance grows like t². A classical random walk started the same way spreads diffusively — variance grows only like t (standard deviation ∝ √t). Both variances are computed from the real, live probability distributions every step and plotted below, together with a fitted power-law exponent (slope of log σ² vs log t) that should read ≈2 for the quantum walk and ≈1 for the classical one.
- Step / Run — advances both walks (quantum coin+shift, classical diffusion) one iteration at a time, in lock-step, from the same starting point.
- Search mode — replaces the coin at one chosen site with a π phase flip (the oracle), the 1D analogue of the Grover-coin search in the 2D grid version: amplitude builds up on the marked site far faster than the classical walk reaches it, the same quadratic hitting-time speed-up.
- Click the quantum chart — relocates the marked site and resets both walks.
This is the exact coin-then-shift unitary used by the 2D "Quantum Walk Search Algorithm" 3D sim, reduced to one spatial dimension so the ballistic-vs-diffusive spreading and the variance scaling law can be read directly off a plot rather than a bar height.