  Single-file diffusion is a paradigm for strongly correlated classical
stochastic many-body dynamics and has widespread applications in soft condensed
matter and biophysics. However, exact results for {single-file} systems are
sparse and limited to the simplest scenarios. We present an algorithm for
computing the non-Markovian time-dependent conditional probability density
function of a {tagged-particle} in a {single-file} of $N$ particles diffusing
in a confining external potential. The algorithm implements an eigenexpansion
of the full interacting many-body problem obtained by means of the coordinate
Bethe ansatz. While formally exact, the Bethe eigenspectrum involves the
generation and evaluation of permutations, {which becomes unfeasible
  for single-files with an increasing number of particles $N$.} Here we exploit
the underlying {exchange} symmetries between the particles to the left and to
the right of the {tagged-particle} and show that it is possible to reduce the
complexity of the algorithm from the worst case scenario $\mathcal{O}(N!)$ down
to $\mathcal{O}(N)$. A C++ code to calculate the non-Markovian probability
density function using this algorithm is provided. Solutions for simple model
potentials are readily implemented incl. {single-file diffusion} in a flat and
a 'tilted' box, as well as in a parabolic potential. Notably, the program
allows for implementations of solutions in arbitrary external potentials under
the condition that the user can supply solutions to the respective
single-particle eigenspectra.
