====== Post 1 — Qubits and the Bloch Sphere ====== This first entry introduces the Bloch sphere representation of qubits and demonstrates how to obtain Bloch vectors with the [[https://github.com/erikkallman/hottbloch|accompanying Python code]]. ---- ===== 1. Qubit states and density matrices ===== A pure qubit state is written as \[ |\psi\rangle = \alpha |0\rangle + \beta |1\rangle, \quad \alpha, \beta \in \mathbb{C}, \quad |\alpha|^2 + |\beta|^2 = 1. \] From this vector we form the density matrix \[ \rho = |\psi\rangle \langle \psi |. \] ---- ===== 2. Mapping to the Bloch sphere ===== The Pauli matrices are \[ \sigma_x = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}, \quad \sigma_y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}, \quad \sigma_z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}. \] The Bloch vector is defined by \[ r_i = \operatorname{Tr}(\rho \, \sigma_i), \quad i \in \{x,y,z\}. \] For pure states we obtain \(\|r\|=1\), so every qubit corresponds to a point on the unit sphere \(S^2\). ===== 3. Using the code ===== The function **state_to_bloch** implements this mapping. Example: import numpy as np import hottbloch as h # Basis states ket0 = np.array([1, 0], dtype=complex) ket1 = np.array([0, 1], dtype=complex) print("Bloch vector of |0>:", h.state_to_bloch(ket0)) print("Bloch vector of |1>:", h.state_to_bloch(ket1)) # Superposition state |+> = (|0> + |1>)/√2 ket_plus = (ket0 + ket1) / np.sqrt(2) print("Bloch vector of |+>:", h.state_to_bloch(ket_plus)) Expected output: $|0\rangle$ maps to the north pole $(0,0,1)$. $|1\rangle$ maps to the south pole $(0,0,-1)$. $|+\rangle$ maps to a point on the equator $(1,0,0)$. ---- ===== 4. Visualization ===== To plot Bloch points or loops, use: python hottbloch.py --out ./hott_outputs --loop equator --theta 0 This produces a static Bloch sphere with a marked state. Images are saved in `./hott_outputs`. ---- ===== Conclusion ===== This establishes the basic correspondence between qubit states and points on the Bloch sphere. In subsequent posts we extend this to continuous paths, closed loops, and their associated geometric phases.