{'fraction_non_alphanumeric': 0.018612896077996897, 'fraction_numerical': 0.0015510746731664082, 'mean_word_length': 5.393059490084986, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
DiracQ: A Package for Algebraic Manipulation of Non-Commuting Quantum Variables

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 Mathematica. With DiracQ, one can proceed with large scale algebraic manipulations of expressions containing combinations of ordinary numbers or symbols (the c-numbers) and arbitrary sets of non-commuting variables (the q-numbers) with user defined properties. The DiracQ package is user extendable and comes encoded with the algebraic properties of several standard operators in popular usage. These include Fermionic and Bosonic creation and annihilation operators, spin operators, and canonical position and momentum operators. An example book is provided with some suggestive calculations of large-scale algebraic manipulations.


Introduction
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 [1]. Dirac's notation pervades much of theoretical physics, and underlies its characteristic informality of syntax, relative to formal mathematical literature. The package DiracQ permits user defined expressions to be similarly informal combinations of (symbolic) commuting variables and non-commuting operators. DiracQ consists of functions designed to extend and compliment the abilities of Mathematica to perform manipulations with non-commuting quantum operators. Once loaded within Mathematica, the package DiracQ allows the user to perform algebraic operations with the most frequently encountered quantum objects. The package enables the user to evaluate commutators, anticommutators or products of expressions, and to manipulate and often greatly simplify the resulting expressions.
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.

An Elementary Example
We now provide a simple example of Mathematica input and output, to demonstrate the motivation and usage of the package. In this example, we will take a single spin-1/2 particle in an arbitrary magnetic field. The Zeeman Hamiltonian of this system is given by 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 4 .

Problems involving Fermions
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 Mathematica itself, or if required, in a suitable external program.

Advanced Problems
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 [2], and B. S. Shastry's analogous proof of the integrabilty of the 1-dimensional Hubbard model [3], and its later extensions [4]. A recent work by Bukov et. al. illustrates the use of the DiracQ package for the evaluation of commutators in the problem of high-frequency periodically driven systems [5].

Summary
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

Implementation and architecture
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.

Quality control
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.

Operating system
Any system capable of running Mathematica 8 or higher.

Programming language
Mathematica 8 or higher.

Dependencies
Mathematica 8 and higher. (3) Reuse potential 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.