Quantum Forge · live demo

Split, bounce, recombine

One ball. At the middle of the box it splits into two entangled paths. They bounce off the walls and meet again on the far side, and how they meet decides which door the ball leaves by. The phase dial is yours. So is the code.

loading simulator…

What the simulator says

ball A
ball B

Press Run.

Where the ball left

top door0
bottom door0

Every run measures once. Exactly one ball comes out, always.

The code that runs

import { ensureLoaded, QuantumPropertyManager }
  from "quantum-forge/quantum";

await ensureLoaded();
const qpm = new QuantumPropertyManager({ dimension: 2 });
const m = qpm.getModule();

// each run
const a = qpm.acquireProperty(); // ball A, |0⟩
const b = qpm.acquireProperty(); // ball B, |0⟩
m.cycle(a);                      // A exists: |1⟩

These three run at the split line, the phase plate and the far wall. Edit them, then Run.

// at the doors
const [va, vb] = m.measure_properties([a, b]);
qpm.releaseProperty(a, va);
qpm.releaseProperty(b, vb);

Try these

  • Phase 0. Run it ten times. The ball takes the bottom door every time. Not usually. Every time.
  • Phase 1.0. Now it is the top door, every time. Nothing was measured in between; the two paths cancelled at the far wall.
  • Phase 0.5. A coin. This is the only setting where a random number would have looked the same.
  • Change both i_swap fractions to 0.25. The split is no longer equal, so at phase 0 the paths cannot cancel and you get a coin. At phase 1.0 they still add up completely.
  • Set recombine to 0 and the far wall does nothing: the two balls arrive as they left, and you are back to a plain measurement.

Everything on this page is computed by the same simulator that ships in Quantum Forge. The numbers beside the balls are read from it every frame without collapsing anything; only the doors measure.