Chapter 10

Simple random problems

Many systems behave unpredictably and randomly, or at least seem to. Some are random due to a lack of information such as a coin toss or the golden autumn leaves fluttering and falling in the wind. Other systems, though perfectly deterministic and well defined, are still random because of their intrinsic, probabilistic nature, such as the radioactive particle decay and measurement of quantum systems.

We consider several simple random systems in this chapter so as to be familiar with random sampling and distributions needed in the next two chapters. First we introduce random numbers and model particle decay by random sampling. We also discuss random walks in 1D and 2D, as well as a stochastic model for Brownian motion, a simple but important phenomenon. Finally we introduce Monte Carlo integration to evaluate multidimensional integrals including electrostatic potential energies.

10.1 Random numbers and radioactive decay

The first step to represent a random problem starts with the generation of random numbers. At initial glance, this appears paradoxical: on the one hand, the digital computer is as deterministic a machine as it gets, yet on the other hand we want it to produce random numbers. This is a dilemma. We cannot generate truly random numbers on the computer. We can, however, hope to generate a sequence of pseudo-random numbers that mimics the properties of a series of true random numbers.

The generation of pseudo-random numbers usually involves ...

Get Computational Modeling and Visualization of Physical Systems with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.