Background
Random walks were initially found to be useful as a way to compute solutions to some difficult diffusion problems. One class of examples is in the transfer of radiation in a system, and in this exercise, we will consider a simple radiation transfer problem that is well adapted to modelling with a random walk.
Consider the transfer of energy by radiation through a stack of plates. A source emits photons which are absorbed by the first plate in the stack. This plate, in turn, reradiates (as new photons) some of the absorbed energy back to the source and some of it on to the next plate in the stack. The process occurs for each plate in the stack, receiving photons from its neighbors and reradiating them. Eventually, some photons arrive at the last plate in the stack and can escape to space. We'd like to know what fraction of the photons originally emitted by the source actually get transmitted through the stack and escape.
This problem is an example of something which can be solved with a
random walk to simulate the process. The random walk goes something like this:
The random walk starts at source with a step to the first plate, where
the energy is absorbed. At the first plate, the energy absorbed is reemitted
as a new photon. The new photon can be emitted from the top of the plate,
in which case it will be absorbed by plate number 2, or it can go back to
the source where it is reabsorbed. Either direction has equal probability,
so the track of the energy through the system is a random walk. We follow
our random walker from the source until it is either reabsorbed by the source,
or it escapes the system.
Obviously following the history of just one photon through this process will
not lead to a very precise estimate of the transmission through the stack of
plates. We need to follow a large number of photons through their complete
history in order to get a good answer. So lets write a MATLAB script that
will perform a large number of random walks and then
estimate the transmission
through the stack of plates.
Assignment
First, I suggest that you write a script to do a single
random walk for a number of plates specified by the user. The walk should continue until the trial photon either escapes
or returns to the source. This first step will let you test whether your
random walk logic will work. (I don't need to see this script. It is just
a suggested way to get started.)
Then add a loop to the above program
to carry out a large number of these trials. At the end
of the trials, your program should write, as output, the percentage of
events that escape.
Extra Credit
Try running your program for 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10 plates
and determine the transmission for each case. Submit a graph of the
transmission as a function of the number of plates. Can you see a pattern?
Copy your completed program into the directory
~schloerb/ph281/username,
where username is your user name. Submit the plot requested above
for extra credit.
See this link for examples of how to
copy a file to this directory.
If you do the extra credit calculation, please submit the plot
requested.
Please write your name in a comment field
near the beginning of the script.