A Monte Carlo Simulation of a Rainbow
Imagine a large
number of of parallel rays hitting a spherical
rain drop. For
each ray we plot a single point of light in accordance
with the laws
of reflection and refraction. For each ray of light we
a color that will be seen by an observer once it has
& reflected either resulting in a point of light in
the primary or
secondary rainbow. Since we are randomly assigning a
color from the
spectrum to a ray, the process is using a Monte Carlo
order to get the angles correct we use the refraction
index of the
colored light for the mediums air and water. This also
placement of the corresponding dot of light in our picture.
The crucial line
of code is the expression for N. By changing this
line we can simulate
rainbows in various mediums.
INPUT: ptlimit = number
of point (rays) to use in the simulation.
(If no input is specified 10,000 are used.)
OUTPUT: primary and secondary
source: "Monte Carlo Computer Simulation of a Rainbow", by
Olsen, et al., The Physics Teacher, April 1990, pp. 226-227
the result of an NSF summer program involving eighth and ninth
The original program was written in Applesoft Basic.
David R. Hill,
Mathematics Dept., Temple Univ.
PA. 19122 Email: firstname.lastname@example.org
CONSTRUCTED for use with NSF Project
DEMOs with POSITIVE IMPACT