AngouriMath

Navigation

QuantumState


← Back to list of classes

Description

Summary

Reading a quantum state out of an ordinary expression, and writing one back.

Remarks

**A state is not a new kind of node.** A ket is written apply(ket, 0, 1) -- an
application of an undeclared name, which the library already understands -- so a state
is an ordinary sum of products and everything that reads expressions reads it. That is
not only tidy: it is why a|x> + b|x> = (a+b)|x> and 0|x> = 0 need no code here at all. Simplify collects like terms over an opaque
application already, and it factors the amplitude out of a Bell state without being
told what one is.
The cost of the choice is that ket is a name rather than a type: nothing stops
apply(ket, 5, 7), and a caller with their own variable called ket will
collide with it. A dedicated node would close both and would forfeit everything in the
paragraph above, so the loose reading is taken deliberately and is reversible.

Members

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online