Repository navigation
SNEG 2.1 is a major release consolidating development from the 2024-2026 cycle.
SNEG is a Wolfram Language package for symbolic calculations with noncommuting second-quantization operators. It provides canonical operator ordering, Wick expansion, vacuum expectation values, occupation-number states, symmetry-adapted bases, and matrix representations.
New functionality
Multi-mode phonons
- Added
phononbasis[{N1, N2, ...}]for finite product bases with independent mode cutoffs. - Added mode-resolved
phononnumber,phononplus,phononminus, andphononxoperators. - Added
phononidfor constructing identities in truncated phonon spaces. - Extended
ketbratensorproductto an arbitrary number of factors. - Extended
transformtoPHto construct fermion-phonon bases with multiple phonon modes. - Invalid mode indices now produce a diagnostic and return
$Failed.
Symbolic sums
- Added
scalar[...]for explicitly marking numerical, non-operator expressions inside symbolic calculations. - Added
Zeroonvac[...]for applying vacuum-annihilation rules to expressions, products, and symbolic sums. - Added differentiation, division, and conjugation support for symbolic sums.
- Added
FactorSeparableSumCustomandrulesumFactorfor extracting factors separable from summation indices. - Added
rulesumCollectKDandsumCollectSimplifyKDfor collecting and simplifying Kronecker-delta contributions. - Improved nested-sum expansion, collection, denominator handling, and dummy-index renaming.
- Fixed several cases of accidental index capture.
Projectors
- Added
projectorEandprojectorOfor projectors onto normalized|0> +/- |2>charge superpositions. - Added
projectorEphiandprojectorOphifor phase-dependent variants of these projectors. - Added shorthand forms accepting atomic operator names.
Bosonic ordering
Bosonic operators can now use:
ordering[op] = NONEThis disables automatic reordering. Contractions, normal ordering, vacuum expectation values, and Wick expansion have been updated to respect this convention.
Operator algebra and Wick evaluation
- Corrected ordering between different fermion heads using
EMPTY,SEA, andNONEconventions. - Each fermionic operator is now classified according to its own creation or annihilation convention during cross-head ordering.
NONEnow acts as an absolute no-reordering barrier.- Different fermion heads retain vanishing canonical anticommutators.
- Corrected vacuum expectation values for different fermion heads under
SEAordering. - Extended Majorana anticommutators to multiple indices and different Majorana heads.
- Corrected Majorana-Grassmann anticommutation and Berezin-integration signs.
- Preserved Grassmann coefficients in all vacuum-expectation-value and Wick implementations.
- Corrected symbolic contractions involving
NONEordering. - Corrected bosonic and mixed boson-fermion Wick-pairing signs.
- Fixed Wick evaluation for single bosonic operators.
- Corrected commutators between different spin-operator heads.
- Preserved symbolic operator declarations through conjugation and repeated conjugation.
States and basis construction
- Improved
apso that it is linear in operator arguments while preserving the final state argument. - Improved handling of zero states during operator application and spin lowering.
- Corrected Fock-space dimensions for spinless and arbitrary-spin fermionic operators. For example, a spin-3/2 fermionic orbital now produces the expected 16 states.
qsbasisandqsbasisvcnow reject unsupported spinless and non-spin-1/2 inputs instead of returning invalid bases.- Empty charge-spin and spin-only sectors now return the valid vacuum sector.
- Extended
spinbasisto combinations of three or more arbitrary spins. - Preserved auxiliary ket labels during tensor products, spin lowering, and scalar-product calculations.
- Improved
vc2opsfor zero-mode bases and states containing auxiliary kets. - Improved symbolic orthogonalization so that potentially nonzero symbolic vectors are not discarded.
Matrix representations
The optimized matrixrepresentationvcfast and matrixrepresentationvcsparse implementations now handle:
- Complex and prefactored basis states.
- Superposition bases through a safe fallback.
- Rectangular left and right bases.
- States mapped outside the selected basis.
- Symbolic and user-defined auxiliary-ket overlaps.
Regression tests compare optimized results against the general matrix-representation implementation.
Distribution and compatibility
SNEG can now be installed directly as a Wolfram paclet. Mathematica 12.1 or newer is required for paclet installation:
PacletInstall[
"https://github.com/rokzitko/sneg/releases/latest/download/SNEG.paclet"
]Load the package and check the installed version with:
Needs["sneg`"]
$SnegVersionBoth Needs["sneg"]andNeeds["Sneg"] are supported.
Manual source installation remains available for Mathematica 7 through 12.0. SNEG has been tested with Mathematica versions through 15.
The release contains versioned SNEG-2.1.paclet and stable SNEG.paclet assets.
Examples and testing
- Added an example of bosonic displacement-operator algebra and Baker-Campbell-Hausdorff identities.
- Added multi-mode phonon examples and regression tests.
- Added dedicated tests for the exact-diagonalization utilities.
- Expanded regression coverage for operator ordering, Wick expansion, symbolic sums, bases, projectors, matrix representations, Majorana operators, and Grassmann variables.
Links
Full Changelog: v2.0.24...v2.1