Non-commutative operators, expansions, Sympy and all that Jazz.

Just me playing around with Sympy and non-commutative operators. Check a small demo I wrote in IPython from the link here.

These days, commutators play a central role when studying how lattice Monte Carlo performs when trying to compute some kind of observable. Often, I would want to try to compute that observable over an enormous lattice and then it’s a good idea to try to run things in parallel. By doing so, I of course introduce an error that depends on which way I picked to approximate the serial algorithm. One way to quantify said error is by using commutators. Perhaps a separate post explaining all that would be in order.

Anyway, I just was surprised at how easy it is to do those kind of computations with the current version of Sympy. It would be really sweet if I could also rewrite the error terms with Lie brackets (for example, it holds that [A,B]=AB-BA) but I’m still working on that.