open-standards/wai/wai-quantum/course/lessons/rotation/lesson.zh-CN.md
Transaction Science fb230d8a62 wai-quantum: the circuits course as data, each exercise checked by the engine, and wai-quantum learn in English and Chinese
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]>
2026-10-28 08:42:54 -04:00

951 B
Raw Permalink Blame History

旋转门 ry(θ) 让量子比特的状态在 |0⟩ 与 |1⟩ 之间转过 θ/2 的角度:

ry(θ)|0⟩ = cos(θ/2)|0⟩ + sin(θ/2)|1⟩,

所以得到 1 的概率是 sin²(θ/2)。θ = π 时必定得到 1,与 x 相同;θ = π/2 时概率为二分之一,与 h 相同。

角度会改变引擎的计算方式。是 2π/2ᵏ 整数倍的角度(π、π/2、π/4……)在逐位精确(bit-exact)方法上运行,在每台机器上得到相同的比特。其他任何角度都以双精度运行,精确到舍入误差,结果会在其精度等级中说明这一点。无论哪种情况,对分布的检查都是精确的,只为舍入留出 10⁻⁹ 的容差。

cat > turn.qasm <<'QASM'
OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
rx(0.3) q[0];
QASM
wai-quantum plan turn.qasm