Quantum Mechanics¶
Pysic-rs implements the foundational apparatus of non-relativistic quantum mechanics â spin-1/2 algebra, density matrices, coherent states, perturbation theory, the Feynman path integral, and free-field propagators â all at textbook (proven) level.
Python binding status:
pauli_matrices,density_matrix,coherent_state,number_state,feynman_propagator_scalar, andfree_propagator_positionare bound.partial_trace,purity, perturbation theory, and path integrals are Rust-only. See the API page.
1. Hilbert Space & State Space¶
1.1 Axioms of Quantum Mechanics¶
A quantum system is described by a complex Hilbert space \(\mathcal{H}\) with inner product \(\langle\cdot|\cdot\rangle\) (sesquilinear, positive-definite). States are rays â unit vectors modulo global phase:
Postulate (superposition): if \(|\psi_1\rangle\) and \(|\psi_2\rangle\) are physically realisable states, so is any normalised linear combination \(\alpha|\psi_1\rangle + \beta|\psi_2\rangle\) with \(|\alpha|^2+|\beta|^2=1\).
1.2 Projectors & the Born Rule¶
For a normalised state \(|\psi\rangle\), the projector onto the ray it spans is
The probability of outcome \(a\) when measuring observable \(\hat{A}\) with eigenket \(|a\rangle\) is
1.3 Completeness Relation¶
The resolution of the identity \(\sum_a |a\rangle\langle a| = \hat{1}\) (for discrete, non-degenerate spectra) is the completeness relation. It follows from the orthonormality \(\langle a|b\rangle = \delta_{ab}\) and the fact that the eigenkets span \(\mathcal{H}\) (self-adjoint operators have a complete orthonormal eigenbasis â spectral theorem).
2. Spin-1/2 Algebra¶
2.1 Pauli Matrices¶
The Pauli matrices are the \(2\times 2\) generators of \(\mathfrak{su}(2)\) in the fundamental (spin-\(\frac{1}{2}\)) representation:
Theorem (anticommutation). For all \(a,b\in\{1,2,3\}\):
Proof. Direct matrix multiplication. For \(a=b\): \(\sigma_x^2 = I\) (and cyclically). For \(a\neq b\): e.g.
\(\square\)
Theorem (commutation). The commutator is
where \(\varepsilon_{abc}\) is the Levi-Civita symbol. Hence \(\mathfrak{su}(2)\) has structure constants \(f^{abc} = \varepsilon^{abc}\) (see Gauge).
Proof. From \(\sigma_a\sigma_b = \tfrac{1}{2}\{\sigma_a,\sigma_b\} + \tfrac{1}{2}[\sigma_a,\sigma_b]\), and the anticommutator is \(2\delta_{ab}I\). The commutator is therefore purely antisymmetric and must be proportional to \(\varepsilon_{abc}\) by uniqueness of the invariant tensor. Computing one component, e.g. \([\sigma_x,\sigma_y] = 2i\sigma_z\), fixes the constant. \(\square\)
2.2 Rotation Formula¶
Theorem (Euler decomposition of spin rotations). For \(\hat{n} = (\sin\theta\cos\phi,\sin\theta\sin\phi,\cos\theta)\) and \((\hat{n}\cdot\vec{\sigma})^2 = I\) (proven by direct computation):
Proof. Expand the exponential as a Taylor series. Since \((\hat{n}\cdot\vec{\sigma})^{2k} = I\) for all \(k\ge 1\) and \((\hat{n}\cdot\vec{\sigma})^{2k+1} = \hat{n}\cdot\vec{\sigma}\):
2.3 Spin Operators¶
The spin operators \(S_a = \frac{\hbar}{2}\sigma_a\) satisfy the canonical \(\mathfrak{su}(2)\) Lie algebra:
The Casimir operator \(\vec{S}^{\,2} = S_x^2+S_y^2+S_z^2 = \frac{3\hbar^2}{4}I\) has eigenvalue \(s(s+1)\hbar^2\) with \(s=\frac{1}{2}\).
3. Density Matrix Formalism¶
3.1 Pure vs Mixed States¶
A pure state \(\rho = |\psi\rangle\langle\psi|\) satisfies
A mixed state \(\rho = \sum_i p_i|\psi_i\rangle\langle\psi_i|\) with \(p_i>0\), \(\sum_i p_i=1\) satisfies \(\operatorname{tr}(\rho^2)<1\).
Theorem (purity bound). For any density matrix, \(0<\operatorname{tr}(\rho^2)\le 1\), with equality on the right iff \(\rho\) is pure.
Proof. Expand \(\rho = \sum_i p_i|\psi_i\rangle\langle\psi_i|\) in an orthonormal basis \(\{|j\rangle\}\):
with equality iff \(|\langle\psi_i|\psi_j\rangle|^2 = 1\) for all \(i,j\) with \(p_ip_j>0\), i.e. all states are identical. \(\square\)
3.2 Partial Trace & Entanglement¶
For a bipartite system \(\mathcal{H}_{AB} = \mathcal{H}_A\otimes\mathcal{H}_B\), the partial trace over \(B\) is defined by
where \(\{|j\rangle_B\}\) is any orthonormal basis of \(\mathcal{H}_B\).
Properties (proven):
Linearity: \(\operatorname{tr}_B(\alpha\rho_1+\beta\rho_2)=\alpha\operatorname{tr}_B\rho_1 +\beta\operatorname{tr}_B\rho_2\).
Trace preservation: \(\operatorname{tr}(\rho_A)=\operatorname{tr}(\rho_{AB})\).
Positivity: \(\rho_A\ge 0\).
Entanglement criterion: If \(\rho_{AB}\) is pure, then \(\rho_A\) is pure if and only if \(\rho_{AB}\) is separable (i.e. \(\rho_{AB} = \rho_A\otimes\rho_B\)). For entangled states, \(\operatorname{tr}(\rho_A^2)<1\).
3.3 Von Neumann Entropy¶
The entropy of a density matrix is
where \(\{\lambda_i\}\) are the eigenvalues of \(\rho\). For a pure state \(S=0\); for the maximally mixed state \(\rho = I/d\), \(S = \ln d\).
4. Coherent States¶
4.1 Definition & Construction¶
The coherent state \(|\alpha\rangle\) of the harmonic oscillator is the eigenstate of the annihilation operator \(\hat{a}\):
Construction via displacement operator:
Theorem (Baker-Campbell-Hausdorff). The displacement operator satisfies
Proof. Using \([\hat{a},\hat{a}^\dagger]=1\), the BCH formula for \(e^X Y e^{-X} = Y + [X,Y] + \tfrac{1}{2}[X,[X,Y]]+\cdots\) gives \(X = \alpha\hat{a}^\dagger-\alpha^*\hat{a}\), \([X,\hat{a}] = -\alpha\), and all higher commutators vanish. Hence \(e^X\hat{a}e^{-X} = \hat{a}-\alpha\), so \(\hat{D}^\dagger\hat{a}\hat{D} = \hat{a}+\alpha\). \(\square\)
Corollary: \(\hat{a}|\alpha\rangle = \hat{a}\hat{D}(\alpha)|0\rangle = \hat{D}(\alpha)(\hat{a}+\alpha)|0\rangle = \alpha|\alpha\rangle\).
4.2 Fock Expansion¶
Expanding in the number basis:
The probability of measuring \(n\) photons is the Poisson distribution:
4.3 Minimum Uncertainty¶
Coherent states saturate the Heisenberg bound:
This follows from the fact that \(|\alpha\rangle\) is a Gaussian in position space with equal variances \(\Delta x^2 = \hbar/(2m\omega)\) and \(\Delta p^2 = m\omega\hbar/2\).
5. Perturbation Theory¶
5.1 RayleighâSchrödinger (Non-Degenerate)¶
Setup. \(H = H_0 + \lambda H'\) with \(H_0|n^{(0)}\rangle = E_n^{(0)}|n^{(0)}\rangle\), non-degenerate spectrum. Expand:
Intermediate normalisation: \(\langle n^{(0)}|n^{(1)}\rangle = 0\).
Theorem (first-order energy).
Proof. Substitute the expansion into \(H|n\rangle = E_n|n\rangle\) and collect \(\mathcal{O}(\lambda)\):
Project onto \(\langle n^{(0)}|\):
Theorem (second-order energy).
Proof. Project the \(\mathcal{O}(\lambda)\) equation onto \(\langle m^{(0)}|\) for \(m\neq n\):
\(\Longrightarrow |n^{(1)}\rangle = \sum_{m\neq n}\frac{\langle m^{(0)}|H'|n^{(0)}\rangle} {E_n^{(0)}-E_m^{(0)}}|m^{(0)}\rangle\). Collect \(\mathcal{O}(\lambda^2)\) terms and project onto \(\langle n^{(0)}|\):
First-order state correction:
Convergence criterion (proven): perturbation theory converges when \(\lambda|\langle m|H'|n\rangle| \ll |E_n^{(0)}-E_m^{(0)}|\) for all \(m\neq n\) â the perturbation must be small compared with the level spacing.
5.2 Second-Order Stark Effect (Example)¶
For a hydrogen atom in an electric field \(H' = eEz\), the first-order shift vanishes by parity (\(\langle 1s|z|1s\rangle=0\)). The second-order shift is
giving the quadratic Stark effect â the atom acquires an induced dipole moment \(\mathbf{p} = -\partial E^{(2)}/\partial E\).
6. Path Integral (Feynman 1948)¶
6.1 Derivation from Canonical QM¶
The transition amplitude between position eigenstates is
Derivation. Insert \(N\) complete sets of position eigenstates:
with \(\Delta t = (t_f-t_i)/N\), \(x_0=x_i\), \(x_N=x_f\). Use the Trotter product formula (proven for self-adjoint operators with suitable domain):
The free-particle matrix element is
so
In the limit \(N\to\infty\), the sum in the exponent becomes the classical action \(S[x] = \int_{t_i}^{t_f}L\,dt\), giving
6.2 Wick Rotation & Euclidean Path Integral¶
The substitution \(t\to -i\tau\) (Wick rotation) maps the Minkowski action to the Euclidean action \(S_E = \int[\tfrac{1}{2}m(\dot{x})^2+V]\,d\tau\), and the propagator becomes
The integrand is real and exponentially suppressed away from the classical minimum â this is the basis of lattice field theory, instanton methods, and ground-state projection (imaginary-time propagation).
6.3 Classical Limit¶
By the method of stationary phase (steepest descent as \(\hbar\to 0\)):
where \(x_{\rm cl}\) solves the classical EulerâLagrange equations. This recovers classical mechanics in the limit \(\hbar\to 0\).
7. Feynman Propagators¶
7.1 Scalar Propagator (Momentum Space)¶
The Feynman propagator is the Greenâs function of the KleinâGordon operator:
Fourier transforming:
The \(i\varepsilon\) prescription selects Feynman boundary conditions: positive frequencies propagate forward in time, negative frequencies backward.
7.2 Scalar Propagator (Position Space, Euclidean)¶
In Euclidean 4-space, the propagator is
where \(K_1\) is the modified Bessel function of the second kind (see Special Functions).
Derivation. The Fourier transform in 4D spherical coordinates:
The angular integral gives \((2\pi^2)\,J_1(p|x|)/(p|x|)\), and the radial integral is the integral representation of \(K_1\). \(\square\)
7.3 Free Fermion Propagator¶
For a Dirac fermion:
8. Effective Potential¶
8.1 ColemanâWeinberg Formula¶
The one-loop effective potential in 4D scalar field theory is
where \(m_i(\phi)\) are the field-dependent masses and \(\mu\) is the renormalisation scale.
Derivation sketch. Start from the generating functional \(W[J] = -\frac{i}{\hbar}\ln\int\mathcal{D}\phi\,e^{iS[\phi]+i\int J\phi}\). The effective action \(\Gamma[\phi]\) is the Legendre transform of \(W[J]\). The one-loop approximation gives
Evaluating on a constant field and taking the functional determinant via the proper-time method (Schwinger proper time \(\int_0^\infty ds/s\,e^{-im^2s}\)) yields the ColemanâWeinberg formula. \(\square\)
9. Routines¶
Routine |
Formula |
Derivation |
|---|---|---|
|
\(\sigma_x,\sigma_y,\sigma_z\) |
Generators of \(\mathfrak{su}(2)\) |
|
\(S_a = \frac{\hbar}{2}\sigma_a\) |
Canonical commutation relations |
|
\(\rho = |\psi\rangle\langle\psi|\) |
Outer product |
|
\(\operatorname{tr}_B\rho\) |
Sum over basis of \(B\) |
|
\(\gamma = \operatorname{tr}\rho^2\) |
Entanglement criterion |
|
$\langle\psi |
\phi\rangle$ |
|
\(P = |\psi\rangle\langle\psi|\) |
Idempotence |
|
\(|\alpha\rangle\) |
Displacement operator |
|
\(|n\rangle\) |
Fock basis |
|
\(E_n^{(1)}, |n^{(1)}\rangle\) |
Perturbation expansion |
|
\(E_n^{(2)}\) |
Second-order perturbation |
|
\(\langle x_f|x_i\rangle\) via slices |
Trotter decomposition |
|
\(V_{\rm eff}\) grid |
ColemanâWeinberg |
|
\(S_E\) |
Analytic continuation \(t\to -i\tau\) |
|
\(i/(p^2-m^2+i\varepsilon)\) |
KleinâGordon Greenâs function |
|
\(\frac{m}{4\pi^2 r}K_1(mr)\) |
Euclidean Fourier transform |
|
\(i/(p_0^2-|\vec{p}|^2-m^2+i\varepsilon)\) |
Feynman prescription |
10. Usage Examples¶
Purity detects entanglement¶
from pysicrs import density_matrix, partial_trace, purity
# Bell state |Ίâșâ© = (|00â© + |11â©)/â2
psi = [0.70710678, 0.0, 0.0, 0.70710678]
rho = density_matrix(psi)
rho_a = partial_trace(rho, [2, 2], [0])
print(f"purity of rho_A = {purity(rho_a):.4f} (expect 0.5 â entangled)")
Coherent state of a harmonic oscillator¶
from pysicrs import coherent_state
alpha = coherent_state(0.5 + 0.3j, 20)
print(f"number of components: {len(alpha)} (Poisson distribution)")
Second-order Stark shift¶
from pysicrs import rayleigh_schrodinger_2nd
# Pass H0 eigenvalues, H' matrix, index n â returns E_n^(2)
11. Advantages & Limitations¶
â Coherent states & Pauli algebra cover spin/optical textbook problems
â Path integral and propagators exported directly as amplitude-value functions
â Warps with the pure-Rust FFT for split-step evolution (see PDE)
â No full state-vector evolution for large \(N\) (no qiskit-style gate simulator)
â Perturbation module assumes non-degenerate unperturbed energies
â Propagators are the free scalar-field forms only (no interactions/couplings)
12. References¶
Sakurai, J.J. (1994). Modern Quantum Mechanics, rev. ed. Addison-Wesley.
Shankar, R. (1994). Principles of Quantum Mechanics, 2nd ed. Plenum.
Weinberg, S. (1995). The Quantum Theory of Fields, Vol. 1. Cambridge.
Feynman, R.P. (1948). âSpace-time approach to non-relativistic quantum mechanics.â Rev. Mod. Phys. 20:367.
Glauber, R.J. (1963). âCoherent and incoherent states of the radiation field.â Phys. Rev. 131:2766.
Coleman, S. & Weinberg, E. (1973). âRadiative corrections as the origin of spontaneous symmetry breaking.â Phys. Rev. D 7:1888.
Peskin, M. & Schroeder, D. (1995). An Introduction to Quantum Field Theory. Addison-Wesley.