(1) Overview

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

(1)
H = A σx + B σy + C σz ,

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= e the identity matrix, and (b) the anticommuting property {σ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 h=A2+B2+C2 so that the eigenvalues are h and – h. Let us next see how this problem is done using DiracQ. We define this Hamiltonian in Mathematica using the input below1.

Input:  H = A σ[i, x] +B σ[i, y] + C σ[i, z];

Note that H is a typical mix of commuting (A,B,C), and non-commuting (Pauli matrix) objects. The standard Mathematica function NonCommutativeMultiply (**) is not very useful for evaluating the square of the Hamiltonian; H**H leads to a sum over nine terms of the type (A σ[i, x])**(B σ[i, y]). This output can be further processed by the standard Mathematica function Simplify, which gives back the same result. One would like to implement further rules that declare A and B to be commuting objects that can be moved to any position in the product, while the ordering and simplification should only affect the product of Pauli matrices σ[i, x] **σ[i, y]. This is achieved in DiracQ, where one instructs the program that A, B and C are c-numbers, whereas the Pauli matrices are q-number operators, with their well known simplification rules2. With these preliminaries, the expression is immediately simplified to the correct answer3.

In: ProductQ[H,H]Out: A2+B2+C2

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 power4.

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.

(2) Availability

Operating system

Any system capable of running Mathematica 8 or higher.

Programming language

Mathematica 8 or higher.

Dependencies

Mathematica 8 and higher.

Software location

Archive

Code repository GitHub

Language

English.

(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.

Competing Interests

The authors declare that they have no competing interests.