# Announcing QuantumAlgebra.jl

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

```
H = 1//2*Pr"Ω"*σz() + ∑(:i,Pr"ω_i"*adag(:i)*a(:i)) + ∑(:i,Pr"g_i"*(adag(:i)+a(:i))*σx())
```

gets output as . Here, the sum symbol `∑`

can be entered as `\sum<tab>`

in
Julia, and `Pr"ω"`

is a string macro to define the real parameter
(complex parameters would be `Pc`

). You can then do, e.g.,

```
comm(H,adag(:k)*a(:l))
```

to obtain .

The supported “fundamental” operators are bosonic operators `a`

, `adag`

(,
), Pauli matrices `σi`

(, with
) for two-level systems, and fermionic operators `f`

,
`fdag`

(, ) that anticommute:

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

giving .

You can also use `vacExpVal(A,S=1)`

to calculate the expectation value
, where
is the state obtained by the action of operator
on the vacuum:

```
S = Pc"α"*adag() + Pc"β"*adag()*adag()*adag()
vacExpVal(a()*a(),S)
```

giving .

Within the group, we already used it to cross-check our manual analytical calculations in the latest preprint by Mónica and Rui on the “Cumulant expansion for the treatment of light-matter interactions in arbitrary material structures”.

If you want to give it a spin, you can check out the notebooks in the examples folder in the repository linked above. They can also be viewed online on nbviewer and even tried out interactively with Binder. The code is open source, so contributions, bug reports, etc., are more than welcome on the github repository.