Illustrative MS Paint diagram 1 |
Imagine a spherical structure of radius r, which has within it multiple circular floors (see illustrative MS Paint diagram 1). You want to know the total area of those floors. The area of a circle is pi*radius^2, so you can easily calculate the surface of a floor located in the exact centre, since its radius is the same as that of the sphere, but the other floors are trickier. Let's say that all the other floors are separated by a distance h. How do we find the total area?
The most obvious approach is to find a formula for the radius of each floor, plug it into the pi*r^2 formula, and repeat for each floor. Let's try that, first.
Illustrative MS Paint diagram 2 |
Take a look at our second MS Paint diagram, with coloured lines labelled x, r, and h. The green r length and red h length we already know (and are, in fact, r and h, i.e. the radius of the sphere and distance between floors). You can see that the blue x line is the one whose length we want to know, the radius of a circle located at a distance h from the centre. X, r, and h form a right triangle, so by Pythagoras' theorem, we know that x^2 + h^2 = r^2. From which we can deduce that x^2 = r^2 - h^2. We could take the square root to find out the value of r, but we don't need to. Why? Because all we want x for is to replace it in the circle formula pi*radius^2, where it is already squared.
Illustrative MS Paint diagram 3 |
Replacing, we know that, for a circular section of a sphere at a distance h from the centre, the area is pi*(r^2-h^2). That's the floor directly above the centre, at any rate. It's also the floor directly below the centre, since they are the same size. But we want to know the total surface, so we need to know all floors. So what we do is we name each floor by the scheme in diagram 3, and amend the formula to be pi*[r^2-(n*h)^2], where n is the floor number. That way, we are in effect doing the same thing that in the paragraph above, but replacing each h with n times h. So, for floor 1, the formula remains unchanged. For floor 2, we use twice h rather than just h, because it's twice as high. Notice that, cleverly enough, for floor 0 the formula is just the old pi*r^2. Also notice that I gave some of the floors negative numbers, but I could just as well have made them positive. It doesn't make a difference, because n^2=(-n)^2.
So there we have our complete formula,, for every n floor. Now it's a relatively simple matter of replacing every floor in the formula, and adding them all up. Easy if you have 3 floors, to be sure, but what if you have more?
Well, in the original problem I considered, the radius was 150m and the distance was 3m. That is to say, ~50 floors in each direction. Admittedly, at that point I declared myself too lazy, left the person who was asking me the question with the general formula, and told them that if they wanted it they could do it themselves. (They didn't, but I remembered what little I have of skill with Python and wrote a short script to do it for me). But I then thought of this simple trick to compute an approximate answer. It's useful if you don't need an exact answer and can't ask a computer or another person to do it for you. In fact, it's because I was surprised the trick worked so well that I ended up writing this blog post.
The reason I thought of this trick is because the idea of slicing up a sphere in lots of smaller pieces and adding them up reminded of the concept of an integral. Very rough explanation: An integral is something you can use to calculate the area below a curve. The idea is that you divide the area into small rectangles, whose surface is easy to find. The more rectangles, the closer you get to the exact value. See diagram to the right, which this time I didn't make myself in MS Paint but rather took from Wikipedia*. You're welcome. Anyway, the same principle can be used for volumes (and happens to be something I've been doing in class a lot, lately). The trick we need for today's problem is to go backwards from an integral. I'll explain how that works in a moment.
So let's go back to the beginning. You've got a sphere and many parallel slices, whose area you want to know. You already know the radius of the sphere , so you can easily find its volume as 4/3*pi*r^3. And then you think: "I have all these parallel slices at the same distance of each other. I bet that if I took each slice, made it into a cylinder, and stacked them all on top of each other I'd get something very similar to the sphere". You can imagine something like our 4th illustrative MS Paint diagram. The red is the stacked cylinders, black is the actual sphere (I know they look like rectangles on a circle, I don't feel like adding 3d effects and the idea is the same). Anyway, you can see that is a reasonable approximation, though of course not perfect. The more slices, the better the approximation, so for the ~100 slices of my original problem this is more than good enough.
So, you add the volumes of the cylinders and get a result that is close to the volume of the sphere. But what are you doing when you are adding the volume of the cylinders? Well, a cylinder's volume is height times area of the base. So we have base area of the first cylinder (ba1) times its height (h1), plus those of the second (ba2*h2), plus those of the third (ba3*h3)... But wait, all those h1, h2, h3 are the same, so we can just call it h. So we have: Volume of the sphere ~= ba1*h + ba2*h +ba3*h +.... The symbol ~= means "approximately equal".
With me so far? We have everything multiplied by h, so we can just write it as volume of the sphere ~= h*(ba1 + ba2 + ba3 + ba4 + ...). But what is this sum of ba's? The sum of the base areas of all the cylinders. And what is the base area of those cylinders? It happens to be the area of the circular sections we were trying to calculate in the first place!
So we just divide both sides of the equation by h, and we have that (volume of the sphere)/h ~= sum of the areas of the circular sections. And the volume of the sphere, I remind you, we already know from its radius. So this long explanation adds up to a very simple formula, which is the biggest advantage of this method: It's ridiculously easy to use. Just take r and h, and plug them in here:
.
As for that "approximately", how approximate is it? In my original problem, radius = 150 m and h = 3 m, the result I got from my Python script is 4,711,917.9068 (pi to ten decimal places, just because that's as much as I know from memory). Using the formula above, I get 4,712,388.9804. That's an error of about 0.01%. So, y'know, pretty good. Considering the result I reported to the person who asked me was "about 4,700,000 m^2", far more accurate than I needed.
To my imaginary readers, I promise I will get back to writing fiction rather than math and shitty .bmps. Eventually.
*The image's copyright holder is Wikipedia user KSmrq. Since it's under a Creative Commons Attribution-Share Alike license, so is this individual post.
Image stolen from Wikipedia |
Illustrative MS Paint diagram 4 |
So, you add the volumes of the cylinders and get a result that is close to the volume of the sphere. But what are you doing when you are adding the volume of the cylinders? Well, a cylinder's volume is height times area of the base. So we have base area of the first cylinder (ba1) times its height (h1), plus those of the second (ba2*h2), plus those of the third (ba3*h3)... But wait, all those h1, h2, h3 are the same, so we can just call it h. So we have: Volume of the sphere ~= ba1*h + ba2*h +ba3*h +.... The symbol ~= means "approximately equal".
With me so far? We have everything multiplied by h, so we can just write it as volume of the sphere ~= h*(ba1 + ba2 + ba3 + ba4 + ...). But what is this sum of ba's? The sum of the base areas of all the cylinders. And what is the base area of those cylinders? It happens to be the area of the circular sections we were trying to calculate in the first place!
So we just divide both sides of the equation by h, and we have that (volume of the sphere)/h ~= sum of the areas of the circular sections. And the volume of the sphere, I remind you, we already know from its radius. So this long explanation adds up to a very simple formula, which is the biggest advantage of this method: It's ridiculously easy to use. Just take r and h, and plug them in here:
.
As for that "approximately", how approximate is it? In my original problem, radius = 150 m and h = 3 m, the result I got from my Python script is 4,711,917.9068 (pi to ten decimal places, just because that's as much as I know from memory). Using the formula above, I get 4,712,388.9804. That's an error of about 0.01%. So, y'know, pretty good. Considering the result I reported to the person who asked me was "about 4,700,000 m^2", far more accurate than I needed.
To my imaginary readers, I promise I will get back to writing fiction rather than math and shitty .bmps. Eventually.
*The image's copyright holder is Wikipedia user KSmrq. Since it's under a Creative Commons Attribution-Share Alike license, so is this individual post.
No comments:
Post a Comment