Consider a cylinder of radius 1 aligned along the z axis which
goes from z= -2 to z = 2. Consider another cylinder of radius 1 aligned
along the x-axis with x going from -2 to 2.
A picture of the shape, and random points on the surface of the
two cylinders making up the shape, color coded by which cylinder they
come from (red or blue) if they are valid, and color coded green if
they are *inside* the other cylinder (and thus not valid points on the
surface).
Estimate
- The volume of this shape
- The surface area of this shape, the answer should be near 34.2
- When you get to the correct answer, Show the TA a
plot of your points randomly distributed within the volume (for the
first part), and on the surface (for the second part), and answers to
the questions at the bottom of this page
For each problem, you need to specify (these can be well written
comments in your code)
- Over what volume/region/surface are you generating random numbers?
- What is the area of the region or surface?
- Justify why you are sampling points evenly over this surface.
- what is your criteria for accepting a sample?
- For your number of samples, what is the standard deviation of your
estimate?
Hints: To compute the surface area of part of a
sphere, you first need to create random points on the sphere.
In class we talked about an inefficient method to find points "near"
the surface of the sphere (find points whose distance from the origin
was "close enough" to 1. Another method is to randomly create a point
(x,y,z) inside the sphere. Then think of that as a vector from the
origin, and normalize that vector to have length 1. That gives you a
random points on the sphere.
Then, you should know or be able to look up the surface area of a
complete sphere. Once you have random points on the sphere, and the
ration of (points in the region you care about / all the points), then
the monte-carlo estimate of the surface is the area of the complete
sphere multiplied by the ratio.