Symbolic second-quantization algebra in Mathematica.
Build operators, states, bases, and matrix representations with an
open-source Wolfram Language package. SNEG handles noncommuting
operators and sign-sensitive algebra, from normal ordering and Wick
expansion to exact-diagonalization problems.
Get started
The latest published release is
SNEG 2.1
(1 August 2026). No compilation is required.
With Mathematica 12.1 or newer, install or update the
latest release directly from a notebook:
Both Needs["sneg`"] and Needs["Sneg`"] are supported.
The code requires Mathematica 7 or newer and has been tested with versions
through 15. See the
installation guide
for details.
Manual source installation, including Mathematica 7–12.0
Download the
development source (ZIP)
and place the extracted contents in the directory returned by:
Symbolic algebra: expanded symbolic-sum operations,
improved dummy-index handling, new projectors, and corrections to operator
ordering and Wick evaluation.
States and matrices: improvements to basis construction,
operator application, and dense and sparse matrix representations.
At the core of SNEG is nc, noncommutative multiplication
that automatically orders operators according to their declared
commutation or anticommutation rules.
Operator algebra
Fermionic, bosonic, Majorana, and spin operators, plus
Grassmann variables and fermionic coherent states.
Normal and particle-hole ordering, including a
no-reordering convention.
Symbolic sums, dummy-index renaming, and Kronecker-delta
simplification.
Selected Baker–Campbell–Hausdorff identities and
noncommutative power-series expansions.
States, bases, and matrices
Occupation-number states and efficient application of
operator strings.
Symmetry-adapted bases for charge, spin, and isospin,
with optional reflection parity.
Basis transformations, tensor products, merging,
decomposition, and orthogonalization.
Dense and sparse operator matrices, with constructors for
number, hopping, interactions, and projectors.
Dirac bra-ket notation and finite single- and multi-mode
phonon spaces.
SNEG provides the symbolic foundation of NRG Ljubljana.
It is also used for exact diagonalization of Hubbard clusters,
perturbation theory, and teaching second-quantization methods.