# Math Help - How do I integrate this part of a hemisphere

1. ## How do I integrate this part of a hemisphere

If i have a hemisphere:
$z=sqrt(3^2-x^2-y^2)$

Integrating this is no problem. For example, if the integration limits in the xy-plane are {x,0,1} and {y,0,1}, I can do it like this:

$\int_{0}^{1}\int_{0}^{1}sqrt(3^2-x^2-y^2) dx dy$,

which is easy to solve in mathematica for example.

BUT, how do I do if I also have the condition: 0<z<2?

$\int_{0}^{2}(\int_{0}^{1}\int_{0}^{1}sqrt(3^2-x^2-y^2) dx dy)dz$ is obviously wrong... How do I set it up?

2. No one knows how to integrate the hemisphere which is limited by z<a (and a is smaller than the radius of the hemisphere)? (integration limits in the xy-plane must be rectangular)

3. I'm sure a lot of them do. You just weren't clear what you wanted.

I assume you mean the red part in the figure below. So I'd integrate the blue part and then subtract from 1/2 the volume of the sphere. Since the blue part is radially symmetric, I'll integrate over the first quadrant and multiply by four:

$I_b=4\int_0^{9-a^2}\int_0^{\sqrt{9-a^2-x^2}}\int_a^{\sqrt{9-x^2-y^2}} dzdydx$.

Since the volume of the sphere is $4/3 \pi r^3=36\pi$ then the volume of the red part is:

$V_r=1/2(36\pi)-I_b$

However probably easier to calculate this in perhaps cylindrical or spherical coordinates. Pretty sure that's it but double check it.

4. ## ... not sure can't be solved ...

.
.
Originally Posted by jonitz
No one knows how to integrate the hemisphere which is limited by z<a (and a is smaller than the radius of the hemisphere)? (integration limits in the xy-plane must be rectangular)

0.5{ $\int_{Y_L}^{Y_H}\int_{X_L}^{X_H}sqrt(R^2-x^2-y^2) dx dy$

$-\int_{Y_L}^{Y_H}\int_{X_L}^{X_H}(sqrt(R^2-x^2-y^2)-a)dx dy$

$+2a(Y_H-Y_L)(X_H-X_L)$}

... or, that might be crap ... ;-)*

.
Where'd you get that smart graphic from? Did you make it up yourself just for this problem from some graphics program? If so, can you make them up to specification? I'm thinking of paraboloids, and off-axis sections of them, as illustrated in the following Powerpoint document, for example, the current Slide #41 (the slide #s are subject to change):

http://home.att.net/~gijxixj/Parabol...nstrLatest.ppt

... though there are several other similar slides with paraboloid shapes there ... trouble is, the best one (with sufficient detail) that I could find on the Internet has the paraboloid "upside down".

This PPT doc. refers to another interesting integration problem I posted here a while ago, and eventually solved myself:

http://www.mathhelpforum.com/math-he...d-section.html

Ditto to shawsend: where's your fancy graphic from?

Thanks,
Dennis Revell.
.
.
* but it might not be ...
.
.

5. You are almost right. It's true that i'm interested in the red part. But not the whole red part, only small quadratic (in the xy-plane) elements.

I can give you an example:

We have the function for the hemisphere with radius of 2:
f(x,y) = sqrt (2^2-x^2-y^2)
And the maximum value of the function is 1:
f(x,y)<=1

I want to integrate this function for small quadratic elements (is supposed to be pixels) in the xy-plane. For example, integration limits: {x,1,2} and {y,0,1}

The problem arises when a quadratic element contains both one part of the hemisphere which is truncated and a part that is not (because f(x,y) is not a continuos function in that area)

Can you help me with this?

Originally Posted by shawsend
I'm sure a lot of them do. You just weren't clear what you wanted.

I assume you mean the red part in the figure below. So I'd integrate the blue part and then subtract from 1/2 the volume of the sphere. Since the blue part is radially symmetric, I'll integrate over the first quadrant and multiply by four:

$I_b=4\int_0^{9-a^2}\int_0^{\sqrt{9-a^2-x^2}}\int_a^{\sqrt{9-x^2-y^2}} dzdydx$.

Since the volume of the sphere is $4/3 \pi r^3=36\pi$ then the volume of the red part is:

$V_r=1/2(36\pi)-I_b$

However probably easier to calculate this in perhaps cylindrical or spherical coordinates. Pretty sure that's it but double check it.

6. Can you explain how you are thinking?

The "smart" graphics is done in Mathematica, and can easily be done to specification.

Originally Posted by mathwimp
.
.

0.5{ $\int_{Y_L}^{Y_H}\int_{X_L}^{X_H}sqrt(R^2-x^2-y^2) dx dy$

$-\int_{Y_L}^{Y_H}\int_{X_L}^{X_H}(sqrt(R^2-x^2-y^2)-a)dx dy$

$+2a(Y_H-Y_L)(X_H-X_L)$}

... or, that might be crap ... ;-)*

.
Where'd you get that smart graphic from? Did you make it up yourself just for this problem from some graphics program? If so, can you make them up to specification?
.

7. Originally Posted by jonitz
I want to integrate this function for small quadratic elements (is supposed to be pixels) in the xy-plane. For example, integration limits: {x,1,2} and {y,0,1}

The problem arises when a quadratic element contains both one part of the hemisphere which is truncated and a part that is not (because f(x,y) is not a continuos function in that area)

Can you help me with this?
You mean the region in the x-y plane below right?

8. Here's what I got if we're integrating that. See Plot below. I believe the volume of the indicated element is:

$V=\int_0^a \int_0^1\int_1^{\sqrt{4-y^2-z^2}} dxdydz$

You guys agree?

Also, here's the Mathematica code I used to generate the plot for those interested. That way you can upload the code and then interactively rotate (ver 6 or higher) it to better see how the integration is being performed. See second plot.

Code:
pic1 = Graphics3D[
{Polygon[{{2, 2, 0}, {-2, 2, 0},
{-2, -2, 0}, {2, -2, 0},
{2, 2, 0}}], Polygon[{{1, 0, 0},
{1, 1, 0}, {1, 1, 1}, {1, 0, 1},
{1, 0, 1}}], Line[{{-2, 0, 0},
{2, 0, 0}}], Line[{{0, 2, 0},
{0, -2, 0}}], Line[{{1, 1, 0},
{Sqrt[3], 1, 0}}],
Line[{{1, 0, 0}, {1, 1, 0}}],
Line[{{1, 1, 1}, {Sqrt[2], 1, 1}}],
Line[{{1, 0, 1}, {Sqrt[3], 0,
1}}]}];
bottom = ContourPlot3D[x^2 + y^2 + z^2 ==
4, {x, -2, 2}, {y, -2, 2}, {z, 0, 1},
PlotRange -> {{-2, 2}, {-2, 2},
{-2, 2}}, BoxRatios -> {1, 1, 1},
ContourStyle -> {Opacity[0.2], Red},
Mesh -> None]
shellsurface = ContourPlot3D[
x^2 + y^2 + z^2 == 4, {x, -2, 2},
{y, -2, 2}, {z, 0, 1}, PlotRange ->
{{-2, 2}, {-2, 2}, {-2, 2}},
BoxRatios -> {1, 1, 1},
ContourStyle -> {Opacity[0.2], Red},
Mesh -> None, RegionFunction ->
Function[{x, y, z}, 1 <= x <= 2 &&
0 <= y <= 1 && 0 <= z <= 1]]
Show[{bottom, pic1, shellsurface}]

9. ## BRILLIANT!

.
.
shawsend's got the answer - a lesson in: if you can't manage to think "outside the box", at least try turning the box around! Thanks for the lesson on lateral thinking. Nevertheless, I have a bone to pick with him! (see later).*

As to "how I was thinking", jonitz, forget it, I wasn't - not too well, anyway - I was basically going down a similar path as shawsend started out on, but approached differently: "How do I remove the "offending" volume taken up by the disappeared 'polar cap(s)'?" Except I was looking at removing the volume of the (centre) cylinder (and/or rectangular sections thereof) from the (volume) integral of the cylindrical cut-out from the bottom to the top of the sphere ("horizontal" limits being the extent of the polar caps themselves): Such a subtraction must also give the volume of the caps. But then that messes up when trying to go for rectangular limits. My first description of the answer I gave (ie: crap) was the correct one!

shawsend's method, or a slight extension thereof, will give an analytic answer for any rectangular limits - if any part of the limits occur within the inner circle, radius given by r² = R² - a², just figure which part of that volume (if any part, otherwise trivial) will have a side(s) or section(s) of a side wholly on the curved surface of the sphere: the type of integral that shawsend last gave then solves for this. The rest, to be added to this, then just comprises the volume of a rectangular block (or blocks) of height a, "horizontal" dimensions given according as to where the limit lines cross the inner circle - so you have to calculate these coincidences.

I very much doubt that there is one single equation that covers all possible combinations of the horizontal rectangular limits, but with (a great deal of) care, you should(might?) be able to write a routine that figures out the relationship of the limits to the r circle, and so decide which (shawsend type) integral(s) to add to which rectangular block volume(s), to give the final answer. Some of the factors at least part of the way down such a routine might look like:
.

Assuming always that: XH > XL & YH > YL; r = |r| = |sqrt (R² - a²)|:

IF
-rXL ≤ +r AND -rXH ≤ +r AND XL²+ YL² ≤ r² AND XH²+ YL² ≤ r² AND XL²+ YH² ≤ r² AND XH²+ YH² ≤ r² => Ans. = |a(XH - XL)(YH - YL)| ... (Region 1: circle radius r: completely encloses limits "rectangle")

ELSE IF
XL > r OR XH < -r OR YL > r OR YH < -r => Ans. = you first thought of ... (Region 2: (limits rectangle) everywhere outside the square circumscribing circle of radius r)

ELSE IF
XL ≥ 0 AND YL ≥ 0 AND XL² + YL² ≥ r² ( ... "standard" quadrant 1)
OR
XL ≥ 0 AND YH ≤ 0 AND XL² + YH² ≥ r² ( ... "standard" quadrant 4)
OR
XH ≤ 0 AND YH ≤ 0 AND XH² + YH² ≥ r² ( ... "standard" quadrant 3)
OR
XH ≤ 0 AND YL ≥ 0 AND XH² + YL² ≥ r² ( ... "standard" quadrant 2)
=>
Ans. = you first thought of ... (Region 3: (limits rectangle) everywhere outside the circle of radius r. Region 2 (above) is contained within Region 3; Region 3 tests have "more finesse" than the Region 2 tests above - but are unnecessary if Region 2 tests prove TRUE. On the other hand, Region 3 tests make Region 2 tests redundant, ie: can either choose to always do Region 3 tests and omit Region 2 tests, or do Region 2 tests first, and if get a "hit", Region 3 tests can be looped around (ie: not done). The latter might occasionally save time, if that's an issue).

ELSE IF NONE OF THE ABOVE:
(ie: have a mix of (contiguous) Regions 1 & 3)
... Simple sum of "shawsend type" (s) and rectangular block(s) of height a ... UNLESS a corner or corners of the rectangle formed by the given X, Y limits fall between the r circle and the R "circle" (plan view!): this would require more working involving construction of new sets of limits based on the relation of the given X, Y limits with the r circle and the R "circle", and looks likely will involve difference(s) between the couple of types of s seen so far ("standard" & "shawsend") added, as before, to rectangular block(s) of height a.

.
It's more a hell of a problem in the general case than I'd first thought after comprehending the shawsend intregal, but I'm near certain that all combinations of limits and sphere size (R) and "cutoff" circle size (a) are analytic.

.
.
shawsend, I guess the Mathematica code you gave is only of use if you happen to have Mathematica? Mathematica can solve integrals? Damn! How clever is that! Probably costs a bomb. Do you (anybody) know of any good free ;-) programs that'll do fancy 3-d graphics, and all that?

After all that, I think jonitz should tell us what it's all for, don't you? ;-)

.
.
* Where were you when I wanted the answer to THIS (which I eventually figured myself) ;-)
.
.

10. ## Correction / Elaboration to immediately preceding post ...

.
.
See corrected/elaborated post ...

I'm done with this now ;-)

I think ;-)
.
.