The optimally-sampled galaxy-wide stellar initial mass function -
  Observational tests and the publicly available GalIMF code
  Here we present a full description of the integrated galaxy-wide initial mass
function (IGIMF) theory in terms of the optimal sampling and compare it with
available observations. Optimal sampling is the method we use to discretize the
IMF into stellar masses deterministically. Evidence has been indicating that
nature may be closer to deterministic sampling as observations suggest a
smaller scatter of various relevant observables than random sampling would
give, which may result from a high level of self-regulation during the star
formation process. The variation of the IGIMFs under various assumptions are
documented. The results of the IGIMF theory are consistent with the empirical
relation between the total mass of a star cluster and the mass of its most
massive star, and the empirical relation between a galaxy's star formation rate
(SFR) and the mass of its most massive cluster. Particularly, we note a natural
agreement with the empirical relation between the IMF's power-law index and a
galaxy's SFR. The IGIMF also results in a relation between the galaxy's SFR and
the mass of its most massive star such that, if there were no binaries,
galaxies with SFR $<10^{-4}$ M$_\odot$/yr should host no Type II supernova
events. In addition, a specific list of initial stellar masses can be useful in
numerical simulations of stellar systems. For the first time, we show
optimally-sampled galaxy-wide IMFs (OSGIMF) which mimics the IGIMF with an
additional serrated feature. Finally, A Python module, GalIMF, is provided
allowing the calculation of the IGIMF and OSGIMF in dependence on the
galaxy-wide SFR and metallicity.
