In several problems of quantum many body physics, one is required to handle complex expressions
originating in the non-commutative nature of quantum operators. Their manipulation requires precise
ordering and application of simplification rules. This can be cumbersome, tedious and error prone,
and often a challenge to the most expert researcher. In this paper we present a software package
DiracQ to facilitate such manipulations. The package DiracQ consists of functions based upon and
extending considerably the symbolic capabilities of

The programming philosophy underlying the software package DiracQ is inspired by P A M
Dirac’s notation of c-numbers and q- numbers, denoting objects that are analogous to regular
numbers and to non commuting quantum operators [

In summary, DiracQ works with expressions in a fashion that is very close to a theoretical physicists “natural” way of formulating quantum problems. This feature makes it especially easy to use for physicists and can be very advantageous in pedagogical settings, where it may facilitate student concentration on physics related logic instead of the specificities of programming.

We now provide a simple example of

where A, B, and C are the components of the magnetic field in the three Cartesian directions in
suitable units, the set {σ_{x}, σ_{y}, σ_{z} } are the usual
Pauli matrices. By a specific rotation of the Cartesian axes, H can be diagonalized. However, if we
are interested only in the eigenvalues of H, and not its eigenfunctions, we can avoid the
diagonalization altogether. A simple shortcut may be used, exploiting the two properties of Pauli
matrices (a) for any component j, (σ_{j})^{2}= _{i}, σ_{j}}=0 for distinct
i, j. Therefore by squaring H, we obtain identity times the square of the net field. This is easily
done by hand and yields the net field

Note that H is a typical mix of commuting (A,B,C), and non-commuting (Pauli matrix) objects. The
standard Mathematica function

This rather elementary example illustrates DiracQ’s ability to distinguish and separate
c-numbers from q-numbers, and apply special algebraic properties of quantum operators. The problem
at hand is trivial and hardly requires symbolic computation. However, similar tasks involving many
copies of the Pauli matrices can compound to unmanageable proportions and require greater processing
power

DiracQ recognizes most common quantum operators and knows their algebraic properties. For example, when instructed by the user, the package will recognize f[i] and f†[j] to represent the Fermi annihilation and creation operators indexed by i and j, representing sites on a lattice. Functions of the package will utilize their algebraic properties, such as product rules and anticommutators appropriately, or as overridden/directed by the user. Input expressions can include standard summation notation using multiple summation indices. Summation indices interact appropriately with Kronecker delta functions in user input, or those that arise during evaluation or simplification of expressions.

Many important problems in quantum many body physics require the diagonalization of standard
models, such as the Hubbard model. These models are defined on varying lattices with Fermi operators
assigned to each site, and often with different spin or flavor indices. A typical numerical
application requires setting up and diagonalizing the Hamiltonian matrix within a subspace defined
by a fixed number of particles. While the diagonalization of a numerical matrix is a standard
problem in numerical analysis, where much progress has been made, we are interested in the other end
of the problem: setting up the matrix. Here the physicist is expected to produce the numerical
matrix starting from the abstract Hamiltonian on an appropriate lattice. This is often a tedious and
error prone procedure. DiracQ efficiently handles this aspect of the problem. The example notebook
provided in the DiracQ package distribution folder shows how to construct such a matrix in a typical
case. For a small cluster of four sites, the Hubbard Hamiltonian and the basis states within the
Fock space are set up, and the numerical matrix written out at the end. This procedure is easily
extended to larger lattices and to other models. The eigensystem of the resulting matrix can be
computed either within

Users can not only use the predefined operators in DiracQ, but also define additional operators and provide their algebraic properties to DiracQ. Such operators and their algebraic properties will be recognized and implemented by all functions of the package. In this way DiracQ provides a new language for formulating algebraic quantum problems.

The DiracQ package distribution folder includes demonstration problems involving popular systems
in statistical mechanics and many body physics. For example, we reproduce some of the crucial
algebra contained in the seminal paper by R. J. Baxter on the integrability of the 8-vertex model
[

The DiracQ package should find application in any research that involves manipulations of long string of non-commutating operators. We typically expect that these manipulations will arise in the fields of quantum condensed matter physics, quantum statistical mechanics, quantum field theory and nuclear physics, and also in some problems of quantum chemistry

The goal of our project was to develop a library of functions that would enable users to perform algebraic manipulations of expressions that include non-commuting operators as well as commuting numbers. The functions of the package all operate within the same underlying framework. User input expressions are first separated into individual components. Input expressions are broken into individual non-commuting operators, commuting symbols, numbers, and summation indices. These components of an input expression are stored in a nested list organized according to the type of objects found in the input expression. All functions of the package utilize this organizational framework for manipulation and combination of expressions. After manipulation, the individual components of an expression are recombined to yield a result in familiar notation.

The package therefore contains two sets of functions: those functions whose purpose is decomposing input expressions into nested lists or composing output expressions from nested lists, and functions that users call to perform manipulations which rely on the former functions. The package is extensible in that users can relatively easily write new functions to manipulate expressions utilizing the foundational organization system.

Each function of the package has been tested individually to ensure that the algebraic manipulations carried out are correct. Combinations of functions have been tested with known examples. Series of manipulations using a large number of functions have been carried out to ensure they produce some known results. A notebook supplied in the package distribution folder provides several examples of the packages use and demonstrations of the functions of the package being used to obtain non-trivial known results.

Any system capable of running

English.

The DiracQ package will find use in any research that requires the algebraic manipulation of expressions containing non-commuting quantum operators, especially in settings where the expressions or manipulations are particularly large or complex.

The authors declare that they have no competing interests.

The dummy index “i” is needed here since DiracQ defines the Pauli matrices as having two indices, the Cartesian indices (x,y,z) and the additional site or flavor index.

Before running DiracQ, we must of course invoke it within the Mathematica session. For example we may use the command Get[“DiracQ_V1.m”], or use alternative schemes as described more fully in the writeup. We must also specify that the σ variables represent the Pauli operators using the control palette that pops up with the invocation of DiracQ, (otherwise they will be treated as c-numbers).

Note that the DiracQ function ProductQ[A,B] can be replaced with the alternate DiracQ command A ⊗ B.

A sledgehammer approach to the class of problems involving many spin half particles is to represent the non commuting objects as matrices in a suitable dimension. We presume that the readers of this article are looking for more elegant solutions.