SCIENCE MATTERS - Computer coding tackles element of chance in research


Monte Carlo is recognized as a Mecca for high stakes gambling. In the realm of computer software, the term "Monte Carlo" refers to a method of doing simulations of complex phenomena where odds play an essential role.

Scientists use formulas and mathematical expressions to characterize how things interact. Equations yield trajectories of satellites, the relationships between voltages, currents and impedances in electrical circuits, and characterizations of reactions between chemicals.

This list could go on and on, but the items all have one thing in common. There are equations that precisely prescribe an outcome that arises from some known initial condition.

Not every phenomenon or property lends itself to being characterized by an all-encompassing equation. In very large systems of very many individual parts, the system as a whole behaves in a manner that is not evident from the simple interactions of its parts.

In many instances, only a probability distribution of outcomes is known rather than exact outcomes of individual interactions. For instance, an interaction between A and B might yield the following percentage distribution of results: C -- 20 percent; D -- 15 percent; E -- 35 percent; F -- 10 percent; and G -- 20 percent.

Suppose the number of interaction events is very large. Also, imagine the reaction products undergo further random interactions -- C with E, A with D, E with G and so on. A whole multitude of unique paths are possible. There is a cascading effect, making determination of the behavior of the entire system difficult.

With the great speed and huge memory capacity of modern computers, scientists write computer software mimicking such system behavior. The software generates a large number of interaction events. The outcome of each event is determined from a known probability distribution.

The result is tallied and provides input for succeeding interactions. Throughout, changes in parameters characterizing the behavior of the whole system are monitored.

Software of this kind is called "Monte Carlo coding" because of the element of chance in the individual interactions. Often the system behavior is surprising. Whole new levels of complexity emerge that weren't self-evident from the actions of the parts alone.

Theses codes are powerful because investigators can ask a variety of "what if?" questions. By tweaking the conditions of individual interactions, or some other constraint on the overall system, one can see how the system responds.

Experiments in the real world can be prohibitively expensive, dangerous or impractical because of limitations on resources or time. Indeed, computer generated experiments with MC codes can investigate processes that are so slow or so fast they are difficult or impossible to study in nature.

I once wrote a Monte Carlo code to solve a problem with data collected in an experiment. The group I was working with had built an array of detectors designed to determine what kind of atomic fragments were created when atomic nuclei were bombarded with a beam of energetic protons.

To successfully identify a fragment's mass, charge and energy, it had to pass through all the detectors. The sensitive parts of the detectors were composed of thin foils or low pressure gas. Passing fragments were also exposed to electrical and magnetic fields required in the design of two detectors.

The fragments were atomic nuclei stripped of their electrons. When the nuclei passed through a foil or gas their path could be deflected. We knew the probability distribution for deflections and their magnitude, but orientation of the scatter was random.

The nuclear fragments of interest had a variety of masses and charges. Detectors with electric and magnetic fields also deflected passing charged fragments, though in a predictable fashion.

If a fragment started out on a path to intercept the most distant detector, it might not make it. Scattering from foils, gas or electric and magnetic fields could deflect a fragment so severely it would not register in the final detector of the array.

The extent of deflection a particle experienced depended on its charge, mass and velocity. So the array of detectors discriminated against fragments depending on their properties. We needed a computer simulation to correct for this skewing of the data.

My MC code generated a large number of fragments over the range of expected velocities. The trajectories of the fragments started out in the direction of the last detector. In each detector trajectories were allowed to be deflected in accordance with the known probability distribution.

If the net deflection of the trajectory was so large the fragment would not register in the last detector, the loss was recorded. This information gave corrections to our data accounting for the preferential discrimination.

Other applications abound. Genetic algorithms have proven particularly useful. As an environment changes, MC codes can test the competitiveness of different organisms having a variety of genetic mutations.

For many natural systems the results of individual interactions are hugely magnified or rapidly compounded. They are said to be non-linear. Such systems are very sensitive to small changes in conditions and often behave chaotically. Monte Carlo simulations of these systems enable us to explore processes that would otherwise be beyond our reach.

Steve Luckstead is a medical physicist in the radiation oncology department at St. Mary Medical Center. He can be reached at


Use the comment form below to begin a discussion about this content.

Sign in to comment

Click here to sign in