A Simple Algorithm for Converting Random Number Generator Outputs to Universal Distributions to Aid Teaching and Research in Modern Physical Chemistry

Barry (Yangtao) Li,Tim Duong,Daniel Neuhauser,Anastassia N. Alexandrova,Justin R. Caram
DOI: https://doi.org/10.26434/chemrxiv-2024-4thlz
2024-05-07
Abstract:Molecules and materials often display distributed heterogeneous properties. Modeling the behavior of a single molecule with these properties (e.g. via Monte-Carlo simulations) requires a rapid way to sample distributions of interest and describe how they evolve. Here, we pedagogically introduce a simple algorithm that converts evenly distributed random number generator outputs to any defined probability density function (PDF) called the Random Number Converter (RNC). We demonstrate a numerical approach to obtain cumulative distribution functions (CDFs) and utilize a binary search algorithm to circumvent the need for analytical inverse CDFs. This simple method is demonstrated for various distributions, including single-exponential and Gaussian distributions and non-standard PDFs, for which neither the CDF nor its inverse are analytically solvable. We then apply this algorithm to the rate analysis of catalytic turnover cycles and Fourier spectroscopy, enabling the study of complex reaction kinetics and retrospective interferometry analysis. Our algorithm and examples can be used to train undergraduates on the tools that underlay Monte Carlo methods and connect physical chemistry to standard computer science and statistics. We provide a MATLAB and Python module in the Supporting Information with customizable parameters.
Chemistry
What problem does this paper attempt to address?
The paper attempts to address the problem of how to convert the output of a random number generator into an arbitrarily defined probability density function (PDF) in the context of physical chemistry teaching and research. Specifically, the author proposes a simple algorithm—the Random Number Converter (RNC)—to transform uniformly distributed random numbers into the desired probability distribution. This method can handle various complex probability distributions, including single exponential distributions, Gaussian distributions, and non-standard PDFs. Additionally, the algorithm has been applied to catalytic cycle reaction kinetics analysis and Fourier spectroscopy. For example, in the F1-ATPase model, the RNC can intuitively demonstrate the relationship between the average turnover time and ATP concentration. In the Fourier spectroscopy example, the RNC is used to simulate the distribution of photons of different colors and perform retrospective interferometric analysis. In summary, the paper aims to simplify the random number conversion process through the RNC, making it easier for students to understand and grasp the basic concepts of probability theory and statistical analysis, and apply them to the simulation of actual chemical phenomena.