# How to plot a volume for triple integral enclosed by surfaces

My main issue (multivariate calculus), I want to plot the body made within the surfaces

y + z = 4, y = 4 - x^2, y = 0 and z = 0.

the shape of which I am going to triple integrate as soon as I figure out how (not this topic but help is always welcome).

So far I have been trying using Plot3d, Contourplot3D and RegionFunction to show the area,

First try:

Show[
{Plot3D[{z = 4 - y, y = 4 - x^2}, {x, -2, 2}, {y, -1, 5},
Mesh -> None],
ContourPlot3D[{z == 0, y == 0}, {x, -2, 2}, {y, -1, 5}, {z, -1, 7}]},
PlotRange -> All, AxesLabel -> {x, y}, Mesh -> None]


Second try:

Show[
Plot3D[{4 - y, 4 - x^2, 0,}, {x, -2, 2}, {y, 0, 4.1},
PlotStyle ->
{{Blue, Opacity[0.7]}, {Yellow, Opacity[0.4]},
{Green, Opacity[0.4]}, {Red, Opacity[0.4]}},
AxesLabel -> Automatic,
Mesh -> None]] (Was going to use y = 0 in red but I can't seem to get that one going so I limited to y > 0)

Now adding a RegionFunction here could maybe possibly show the shape I am working on, but I would need to use some kind of conditions since the "roof" is not simply made of one function but a mix of two. Any ideas on how I could solve this issue?

the issue being that If I add say

RegionFunction -> Function[{x, y, z}, 4 - x^2 > (4 - y)]


half of the shape will disappear. Does anyone have a good solution? As you can see from my code I am not proficient in Mathematica yet.

• Have you looked at RegionPlot3D[]? – J. M.'s technical difficulties May 7 '16 at 15:07
• Looking into it now =), lets see if I can figure it out, thanks – Celebrin May 7 '16 at 15:12
• Is the desired result something like the output of this: RegionPlot3D[ 0 <= z <= 4 - y && 0 <= y <= 4 - x^2, {x, -2, 2}, {y, -1, 5}, {z, 0, 6}, Mesh -> None, PlotPoints -> 100, PlotStyle -> Directive[Yellow, Opacity[0.5]]]? – kglr May 7 '16 at 15:14
• Yes definetely, I would wish on some differences in color to visualize better, but yes, this is more or less what I want, thanks alot!, now I just need to figure this out so I can replicate it. I still find it kinda hard to visualize in my head, not to mention which limits to put on x y z, , thanks for this =) – Celebrin May 7 '16 at 15:35
• @Celebrin, with Plot3D you can use RegionFunction -> Function[{x, y, z}, 0 <= z <= Min[4 - x^2, (4 - y)]] to get the same region. – kglr May 7 '16 at 15:36

Plot3D[{4 - y, 4 - x^2, 0}, {x, -2, 2}, {y, 0, 4.1},
PlotStyle -> {{Blue, Opacity[0.7]}, {Yellow, Opacity[0.4]}, {Green,  Opacity[0.4]}},
AxesLabel -> Automatic, Mesh -> None,
RegionFunction -> Function[{x, y, z}, 0 <= z <= Min[4 - x^2, (4 - y)]]] ParametricPlot3D:

ParametricPlot3D[{{x, y, ConditionalExpression[4 - x^2, 4 - x^2 <= (4 - y)]},
{x, y, ConditionalExpression[4 - y, 4 - x^2 > (4 - y)]}, {x, y, 0},
{x, 0, Min[y, 1] (4 - x^2)}},
{x, -2, 2}, {y, 0, 4.1}, Mesh -> None,  PlotPoints -> 100,
PlotStyle -> {Opacity[0.5, Blue], Opacity[0.5, Green],
Opacity[0.5, Yellow], Opacity[0.9, Red]}] • Great! =) that is really great =) , in my opinion a better visualisation, no? I am however getting syntax errors with that code and cannot seem to find the fault, are you running it in a Show[] or something? Expression "Plot3D[{4-y,4-x^2,0},{x,-2,2},{y,0,4.1},PlotStyle-><<1>>" has no closing "]". – Celebrin May 7 '16 at 16:02
• @Celebrin, I agree; it is faster than RegionPlot3D too. I added the missing { that was causing the error error message. – kglr May 7 '16 at 16:23
• Btw, any ideas if I wanted to bring in the y=0 plane too?, could I bring it into plot3d? – Celebrin May 7 '16 at 16:30
• @Celebrin, i updated with an alternative approach using ParametricPlot3D that includes a way to depict the y==0 plane. – kglr May 7 '16 at 16:56
r = ImplicitRegion[{y + z <= 4, y <= 4 - x^2, y >= 0 , z >= 0}, {x, y,
z}];
i = HoldForm[Integrate[1, {x, -2, 2}, {y, 0, 4 - x^2}, {z, 0, 4 - y}]];
cp = ContourPlot3D[{z == 0, y == 0, 4 - y - x^2 == 0,
y + z == 4}, {x, -2, 2}, {y, 0, 4}, {z, 0, 4}, Mesh -> None,
ContourStyle -> {Red, Green, Blue, Orange},
PlotLegends -> "Expressions"];
rp = RegionPlot3D[r, PlotPoints -> 100, Background -> Black]; 