Ket vis

Pure states visualized with BraKetVue

Piotr Migdał https://p.migdal.pl (Quantum Flytrap)https://quantumgame.io , Klem Jankiewicz http://jankiewiczstudio.com/ (Quantum Flytrap)https://quantumgame.io
2020-09-20

Ket states for qubits

We start with a 3-qubit state:

Now, let’s apply Hadamard gate to the first qubit. Here is the resulting sta

Now, let’s apply CNOT gate to the first two qubits:

Finally, we apply Toffoli gate to all three qubits:

Ket list

Or, if you prefer to have all operations in one place:

Code

And if you wonder, JavaScript code to make the computation is as simple as:


const { Circuit } = QuantumTensors;

const circuitHistory = [];
Circuit.qubits(3)
  .saveTo(circuitHistory)
  .H(0)
  .saveTo(circuitHistory)
  .CNOT(0, 1)
  .saveTo(circuitHistory)
  .TOFFOLI(0, 1, 2)
  .saveTo(circuitHistory);

Full documentation is in https://github.com/Quantum-Game/quantum-tensors/. For quantum circuits, see: https://quantum-game.github.io/quantum-tensors/classes/_circuit_.circuit.html.

Gates

If you’ve ever wondered how does the Hadamard matrix look like, here’s one:

If we have three qubits, the operator acting on them is \(H \otimes I \otimes I\), that is: