Home : Map : Chapter 7 : Java : Tech : Physics:
Random Numbers and Simulations
JavaTech
Course Map
Chapter 7

Introduction
Event Overview
Event Processing
Button Events
  Demo 1
 Demo 2
Mouse Events
  Demo3

More Components
  Demo 4  Demo 5
  Demo 6  Demo 7

LayoutManagers-1
  Demo 8     Demo 9
  Demo 10  Demo 11
  Demo 12

LayoutManagers-2
  Demo 13  Demo 14
  Demo 15  Demo 16
  Demo 17

Inner Classes
Anonymous Class
Adapter Classes
  Demo 18  Demo 19
Frames & Menus
  Demo 20  Demo 21
Exercises

    Supplements
AWT Components
  Button
     Demo 1
  Canvas
     Demo 2
  AWT GUI Demo
     Demo 3
Swing Dialogs
JOptionPane Dialog
  Demo 1
JDialog
  Demo 2
UI Enhancement: P1
  Demo 1   Demo 2
  Demo 3

UI Enhancement: P2
  Demo 1
     About JavaTech
     Codes List
     Exercises
     Feedback
     References
     Resources
     Tips
     Topic Index
     Course Guide
     What's New

For many types of scientific simulations, randomness is a key feature. In the microscopic world, quantum mechanics works with probabilistic analysis rather than strict determinism. For example, in the simulation of elastic collisions (that is, the particle types don't change) in a high energy particle experiment, the scattering angle of a particle off another should differ from collision to collision just as they do in an experiment. The theory gives us the distributions over many events of angles, energies, and momenta for the scattered particles.

Similarly, in the macroscopic world we deal with many random processes. A simulation of the lifetime of a low earth orbiting satellite must deal with the fluctuations in atmospheric density due to solar flares and other solar heating variations. A simulation of a mechanical system, such as a pump, might allow for random variations in material strengths and dimensions to see how performance and lifespan will vary among many such devices produced from an assembly line.

Not Your Usual Random Distribution

The random parameters in such cases don't always follow a nice flat uniform distribution or a Guassian. For example, in the the particle collision case, the scattering angle would typically peak in the forward direction and drop to low, but not necessarily zero values (as Rutherford discovered) for scatteing of 180 degrees backwards.

Furthermore, real world details can bias the distributions in unique ways. Our particle scattering simulation might also simulate a detector surrounding the collisions. The detector will typically cover less than the full solid angle and might have inefficiencies and dead areas at the seams between detector components.

Running our scattering simulator will result in most scattered particles going down the beampipe and not into the detector. If we are studying the efficiencies of our detector we might want to skip the simulation of the collisions and just "artificially" produce particles going through our detector. We could use a random "angle generator" that only produces particles at angles that enter active areas of the detector.

Generating Custom Random Distributions

In Chapter 4: Tech we discussed the uniform random number generators available in the core language packages. In Chapter 7: Tech we discussed generating non-uniform distributions with the transformation and rejection techniques. In the next section - Generating Custom Random Distributions - we use the rejection method to generate a random distribution that follows a sloped line. In the Histogram Distribution page we will use a given histogram distribution to guide the generation of random values via the rejection technique.

Last Update: Feb.1.04

           Tech
Histogram UI
  Demo 1
Probablity Distrib.
  Demo 2 Demo 3
RejectionMethod
Histogram Stats
  Demo 4
Exercises

           Physics
Sim & Randomness
Custom Prob. Dist.
   Demo 1
Histogram Dist.
   Demo 2
Monte Carlo
  Demo 3
Exercises

  Part I Part II Part III
Java Core 1  2  3  4  5  6  7  8  9  10  11  12 13 14 15 16 17
18 19 20
21
22 23 24
Supplements

1  2  3  4  5  6  7  8  9  10  11  12

Tech 1  2  3  4  5  6  7  8  9  10  11  12
Physics 1  2  3  4  5  6  7  8  9  10  11  12

Java is a trademark of Sun Microsystems, Inc.