Qubits are represented using the basis(2, n) function. In QuantumToolbox, the spin operators follow the standard $Z$-basis representation:
sigmax(), sigmay(), sigmaz(): Pauli matrices.sigmap(): Raising operator $\hat{\sigma}_+$.sigmam(): Lowering operator $\hat{\sigma}_-$.
Convention Note: The sigmaz() operator maps the state basis(2, 0) to $+1$ (the $|\uparrow\rangle$ or excited state) and basis(2, 1) to $-1$ (the $|\downarrow\rangle$ or ground state). This aligns with quantum information conventions where $|0\rangle$ is the excited state and $|1\rangle$ is the ground state. Consequently, applying sigmap() to basis(2, 0) results in a zero vector because it attempts to raise the state out of the two-level Hilbert space.
using QuantumToolbox
# Create qubit states
spin_up = basis(2, 0) # Corresponds to |\uparrow\rangle
spin_dn = basis(2, 1) # Corresponds to |\downarrow\rangle
# Pauli Z operations
expect(sigmaz(), spin_up) # Returns 1.0
expect(sigmaz(), spin_dn) # Returns -1.0
# Raising/Lowering
sigmap() * spin_dn # Returns |\uparrow\rangle
sigmap() * spin_up # Returns zero vector
# For higher spin systems, use jmat()