O'Reilly logo

Computational Modeling and Visualization of Physical Systems with Python by Jay Wang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required