Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Viewing Inside Faces of a Cube

  1. Sep 23, 2011 #1

    I have no knowledge of Calculus. I am actually studying Computer Science. One of the exercises in the textbook I am using ("Python Programming" by John Zelle) suggests that the answer to the problem can be solved either through a simple simulation program or through calculus. I am still struggling with this, but even if I do find a solution, t I have no way of checking my answer, so I was wondering what solutions using calculus might bring.

    The problem (Chapter 9, Exercise 15) is as follows:

    You are at the exact center of a cube. You can see all six faces of the cube equally, so you can say that each face of the cube occupies 1/6 of your vision.

    Say you move exactly half of the distance from the center of the cube to the center point of one of its faces.

    What fraction (or percentage) of your vision does the closest face now occupy?

    I would love to know what solution using calculus produces - it would give me a point of reference from which to work through the simulation.

    I am having trouble even doing this as a "simple" simulation, because my linear algebra is not up to snuff. Granted it's important for me to get it up to snuff, I am not studying it right now, and this book did not say that knowing it was a requirement.

    Thanks, everyone.
  2. jcsd
  3. Sep 24, 2011 #2
    This is not a calculus problem, it's a simple trigonometry problem. At the center, you know the angles to the edges of a side, so if you move halfway to the face you know the new angles and therefore the new solid angle.
  4. Sep 25, 2011 #3
    It is possible that you may do some calculus, because you have to find the surface area of a region on a sphere-- that's how the solid angle is defined.
  5. Dec 4, 2011 #4
    Hi everyone,

    It's been a while, but I'm still interested in finding an answer to the above problem.

    Since I wrote the original post, I have figured out a CS method of getting to an approximate answer by producing random results and calculating a rough average(this was the objective of the exercise), but I still have no certain mathematical answer.

    I came up with 7/20 or 35% (remember, this is an approximate answer). I am of neutral confidence on this: it could be correct, or it could be wrong. I would like to know for sure, if someone can solve this using other means.

    For those wondering, my CS method of solving this problem was this: using a premade library of graphical objects, first I created a square object with side length L, then I placed a point object in the square L/2 from the top and bottom faces, L/4 from one of the horizontal faces.

    Next I created a loop, which generates a line emanating from the point to the edge of the field using a random angle. To check for vertical tilt, the loop then generates a line at a random angle from the point, but only where the x of the end of the line is less than the x of the original point. The loop counts how many times both of the lines succeed in intersecting the face of the square closest to the point. (So, in effect, I'm reusing the same objects I used to find the line's place in two dimensions to find its place in the third).

    Running hundreds of thousands of simulations got me an average of 35 hits out of 100.

    I understand this might not be interesting to many (or anyone), but I thought I'd put it out there.
  6. Dec 7, 2011 #5
    Hi PercivalAsks,

    I calculate that 0.2952 of your vision should be covered by the nearest face when youare half the distance of the cube from the center to the face.

    This is based on the formula for the solid angle of a four-sided right rectangular pyramid found here: http://en.wikipedia.org/wiki/Solid_angle#Pyramid
    You can find a derivation of the formula here: http://www.slac.stanford.edu/~bgerke/notes/solid_angle.pdf
    Caveat: the writer of the derivation reverses the roles of theta and phi in spherical coordinates from the usage I am familiar with.

    The apex angle of the pyramid is 2 * arctan(2) = 126.9 degrees, approximately, yielding a solid angle of 3.709 steradians using the Wikipedia formula. Dividing by 4 pi steradians, we find that is 0.2952 of the surface area of a sphere.

    If your Monte Carlo approach does not agree with my calculated answer, one possibility is that you are not generating points uniformly distributed on the surface of the sphere. This is a bit tricky. It is incorrect to simply generate the inclination (or polar angle) uniformly distributed in the range from 0 to 180 degrees (0 to pi radians). This link explains why: http://mathworld.wolfram.com/SpherePointPicking.html
  7. Dec 7, 2011 #6
    Thanks for the excellent exposition, awkward.

    I tried plugging in a new [itex]\phi[/itex] function as your link provided, and it did not seem to affect very much. I noticed a problem with the way my lines were being generated. When I fixed that problem, the average went down to 15%. Don't know what's going on there. Other problems, no doubt - certainly due to more kinks in the program.

    Thanks for all the insight and for providing a goal for me to shoot towards. Hopefully this thread will be helpful for other people using this textbook.
  8. Dec 8, 2011 #7
    The solid angle can be understood as follows. Say you are at the center of a point. First of all note that the solid angle of any sphere around you with any radius is 4*pi. Moreover if any surface around you completely encloses you it is again 4*pi. This value can be calculated from the formula given for solid angle calculating. It is infinitesimally proportional to Area/r^2. In the case of a sphere this is global and you get for instance (4pi r^2)/r^2 = 4*pi but in the case of less symmetric surfaces you have to calculate it by integration. So if a for instance you are at the center of a half sphere then the solid angle of the half sphere will be 2*pi and just as expected you will have 2*pi/4*pi = 1/2 of your "vision" blocked by the sphere.

    Now coming back to the cube, the geometric picture of the solid angle is as follows: from the point you are standing draws rays to the corners of closest face of the cube. This is the outline of a pyramid (assume that it is a full pyramid with interior points included) as explained above. Now draw a unit sphere around you so (that r=1) and look at the intersection between the sphere and the full pyramid you have. This will give you a surface on the sphere. Then (area of that surface) / 4*pi*r^2 (but r=1) is how much of your vision that surface or equivalently, the side of the cube covers. So infact this outlines another numeric method for you to calculate what you want.

    Analytically you do as above and find the solid angle occupied by the pyramid descirbed above. This requires trigonometry ofcourse to find the angles and side lengths etc then using the formula given above calculate the solid angle and divide it by 4*pi.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook