For the following discussions, please pull up the fact-sheet of last week, where we discussed the harmonic density matrix, and the harmonic path sampling.

We have provided it again today.

To simulate ideal bosons in a 3D harmonic trap,

we start with the identity permutation and with random positions sampled from the diagonal harmonic density matrix in x, y and z.

For each particle move, we sample a random particle, identify its permutation cycle,

and sample a new Lévy quantum path for the entire cycle.

For each permutation move, we sample 2 random particles like this and this,

and we attempt an exchange of their permutation partners.

In Python, this gives the following program, markov_harmonic_boson.py

This program has 2 functions: the first function, levy_harmonic_path,

is used at multiples of the inverse temperature beta, corresponding to the length of the permutation cycle.

We use it to resample the positions of the entire cycle.

The second function computes the off-diagonal harmonic density matrix.

We use it to organize the exchange of two elements.

And here is the second part of this program.

After an initialization, exactly as announced, we enter a short iteration loop.

We sample a random particle and compute the permutation cycle it is on.

Then, we simply resample the entire path of the cycle from the Lévy quantum path.