# Using RegionPlot3D to make a cone under restrictions

I have to plot a cone that satisfies this statement:

Use the RegionPlot3D command to draw a picture of a cone with its point at the origin. The other end of the cone is a circle with radius 5 located at x = 5 and is parallel to the yz-plane. The cone is 5 units long (in other words, it lies along 0 [LessSlantEqual] x [LessSlantEqual] 5). Construct and evaluate a triple integral that correctly finds the volume of the cone. Finally, find the mass of the cone if it has density function of [Delta](x,y,z)= x+2.

I also need help with the integral and how to do that in mathematica, my teacher used$\int^a_b \int^{f(x)}_{f(x)} \int^{g(x,y)}_{g(x,y)}$ like that literallly to do it, while i Think that Integrate could suffice. So far, this is my best attempt at doing this:

RegionPlot3D[(y^2 + x^2 )^(1/2) <= z && 0 <= z <= 5, {x, -5,  5}, {y, -5, 5}, {z, 0, 5}, PlotPoints -> Automatic]


• sorry to whoever edited, while i was typing the integrals you edited it and my edit erased what you added. – user21805 Oct 31 '14 at 1:28

## 2 Answers

By adding axes labels to your plot we can see that the base of the cone is not in the zy plane as requested. You need to rework your inequality so that the radius is proportional to the distance from origo along the x-axis, i.e. $z^2+y^2\leq x^2$.

RegionPlot3D[
(y^2 + z^2)^(1/2) <= x && 0 <= x <= 5,
{x, 0, 5}, {y, -5, 5}, {z, -5, 5},
AxesLabel -> {"X", "Y", "Z"}
]


You can also visualize this cone by using the graphics primitive Cone:

Graphics3D[
Cone[{{5, 0, 0}, {0, 0, 0}}, 5],
AspectRatio -> 1,
Axes -> True,
AxesLabel -> {"X", "Y", "Z"}
]


Regarding how to integrate over a cone, I'm guessing from your question that you want to do it in the cartesian coordinate system. This is not a particularly well suited coordinate system for the problem at hand, but maybe that is the point, since we are using Mathematica.

Again, we have that the radius is smaller than the distance along the x axis.

• $z^2+y^2\leq x^2\Leftrightarrow \sqrt{z^2+y^2} \leq x \leq 5$

If we project the base of the cone down onto the yz plane we see that it's a circle with radius five. This means that we have $y^2+z^2\leq 5^2$. This gives us two more inequalities:

• $-\sqrt{5^2-y^2}\leq z\leq \sqrt{5^2-y^2}$
• $-5\leq y\leq 5$

Now let's integrate over these. We will assume a uniform density of 1, which is the assumption under which you get the volume of a solid.

i1 = Integrate[1, {x, Sqrt[z^2 + y^2], 5}];
i2 = Integrate[i1, {z, -Sqrt[25 - y^2], Sqrt[25 - y^2]}, Assumptions -> {-5 < y < 5}];
i3 = Integrate[i2, {y, -5, 5}]


(125 π)/3

I'm using Assumptions to provide Mathematica with information that helps Mathematica return the solution we are looking for. Integrating over a volume with a nonuniform density does not change much, except for the very first expression:

i1 = Integrate[x + 2, {x, Sqrt[z^2 + y^2], 5}];
i2 = Integrate[i1, {z, -Sqrt[25 - y^2], Sqrt[25 - y^2]}, Assumptions -> {-5 < y < 5}];
i3 = Integrate[i2, {y, -5, 5}]


(2875 π)/12

It's always good to have a way to check one's calculations. Mathematica can integrate over graphics primitives. So we can just grab the graphics primitive used to draw the cone above, and integrate over that:

First@Integrate[x + 2, x ∈ Cone[{{5, 0, 0}, {0, 0, 0}}, 5]]


(2875 π)/12

I would use Cone:

cone = Cone[{{5, 0, 0}, {0, 0, 0}}, 5];
RegionPlot3D @ cone


The volume and mass can then be obtained using:

Volume @ cone
Integrate[x+2, {x, y, z} ∈ cone]


125 π/3

2875 π/12

The volume and mass computations are more direct than @CE's answer.