Mathematica codes used to generate figures in the paper 'Witnessing a Poincaré recurrence with Mathematica', Results in Physics 7, 3373 (2017).
https://arxiv.org/abs/1705.01444
The often elusive Poincaré recurrence can be witnessed in a completely separable system. For such systems, the problem of recurrence reduces to the classic mathematical problem of simultaneous Diophantine approximation of multiple numbers. The latter problem then can be somewhat satisfactorily solved by using the famous Lenstra-Lenstra-Lovász (LLL) algorithm, which is implemented in the Mathematica built-in function \verb"LatticeReduce". The procedure is illustrated with a harmonic chain. The incredibly large recurrence times are obtained exactly. They follow the expected scaling law very well.
Just run the mathematica codes to generate the figures.