We are happy to announce QuantumAlgebra.jl, a package to do symbolic quantum operator algebra (i.e., algebra with non-commuting operators), written in the Julia programming language. It defines an opinionated canonical form (basically normal ordering plus some additional rules) that all expressions are automatically transformed to, which fulfills some invariants that then allows easy use and simplification of the resulting expressions. The output is formatted most nicely as LaTeX formulas in interfaces that support it (e.g., Jupyter notebooks).

For example, the input

gets output as $$\frac{1}{2} \Omega \sigma_{z} + \sum_{i} \omega_{i} a_{i}^\dagger a_{i} + \sum_{i}g_{i} a_{i}^\dagger \sigma_{x} + \sum_{i}g_{i} a_{i} \sigma_{x}$$. Here, the sum symbol can be entered as \sum<tab> in Julia, and Pr"ω" is a string macro to define the real parameter $$\omega$$ (complex parameters would be Pc). You can then do, e.g.,

to obtain $$\omega_{k} a_{k}^\dagger a_{l} + -1 \omega_{l} a_{k}^\dagger a_{l} + -1 g_{l} a_{k}^\dagger \sigma_{x} + g_{k} a_{l} \sigma_{x}$$.

The supported “fundamental” operators are bosonic operators a, adag ($$a$$, $$a^\dagger$$), Pauli matrices σi ($$\sigma_i$$, with $$i\in\{x,y,z,p=+,m=-\}$$) for two-level systems, and fermionic operators f, fdag ($$f$$, $$f^\dagger$$) that anticommute:

fdag(:k)*f(:j) + f(:j)*fdag(:k)

giving $$\delta_{jk}$$.

You can also use vacExpVal(A,S=1) to calculate the expectation value $$\langle 0|S^\dagger A S|0\rangle = \langle\psi|A|\psi\rangle$$, where $$|\psi\rangle = S|0\rangle$$ is the state obtained by the action of operator $$S$$ on the vacuum:

giving $$6 \alpha^* \beta$$.