Structs§
- Bloch
Sphere Renderer - Render Bloch sphere as wireframe with state vector.
- Spin
Chain - Heisenberg spin chain with nearest-neighbor coupling.
- Spin
State - Spin-1/2 state: |psi> = up|+> + down|->.
Functions§
- bloch_
angles - Get Bloch sphere angles (theta, phi) from a spin state. |psi> = cos(theta/2)|+> + e^{i*phi}*sin(theta/2)|->
- from_
bloch - Create spin state from Bloch sphere angles.
- larmor_
precession - Larmor precession: time evolution in a magnetic field. H = -gamma * B.sigma, evolve by exp(-iHt/hbar). For simplicity, gamma*hbar/2 = 1, so omega = |B|.
- pauli_x
- Pauli X gate: |+> <-> |->
- pauli_y
- Pauli Y gate: |+> -> i|-> , |-> -> -i|+>
- pauli_z
- Pauli Z gate: |+> -> |+>, |-> -> -|->
- rotate_
spin - Rotate spin state about an axis by an angle. Uses the SU(2) rotation: exp(-i * angle/2 * n.sigma)
- spin_
expectation - Expectation value of spin along an axis: <S.n> = (hbar/2)*<psi|sigma.n|psi>. Returns the value in units of hbar/2 (i.e., between -1 and 1).
- stern_
gerlach - Stern-Gerlach measurement along an axis. Returns (collapsed state, outcome +1 or -1).