engine::course reads the course from wai-quantum/course/: 21 lessons from a first circuit through superposition, entanglement, interference, the standard algorithms, noise and mitigation, error correction and fault tolerance to resource estimates, each a Markdown text in English and Simplified Chinese and an exercise.json with a schema. A check runs each case of an exercise (a generator's inputs) with its intent and the verdict, measures its constraints (the gates allowed, counts, the T count, the critique's smells, the resource estimate's counts), and says what went wrong from the diagnostics, the verdict and the critique, never from the solution. The tests hold every solution to pass by proof, every known wrong answer to fail for its stated reason, and every locale to every text and message. wai-quantum learn shows, starts, checks, hints and explains a lesson, keeps progress only on this machine, and speaks the language --lang or LANG names; the command summaries and docs topics have Chinese translations held to the English they came from. The verdict gains of_diagnostic for a generator's refusal. llms.txt names the course. Co-Authored-By: Claude Opus 5.5 <[email protected]>
770 B
770 B
The rotation ry(θ) turns a qubit's state through an angle θ/2 between |0⟩ and |1⟩:
ry(θ)|0⟩ = cos(θ/2)|0⟩ + sin(θ/2)|1⟩,
so the probability of 1 is sin²(θ/2). θ = π gives a certain 1, as x does; θ = π/2 gives one half, as h does.
Angles change how the engine computes. An angle that is a multiple of 2π/2ᵏ (π, π/2, π/4, …) runs on the bit-exact method, the same bits on every machine. Any other angle runs in double precision, accurate to rounding, and the result says so in its accuracy class. The check of a distribution is exact either way, within a tolerance of 10⁻⁹ for rounding.
cat > turn.qasm <<'QASM'
OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
rx(0.3) q[0];
QASM
wai-quantum plan turn.qasm