# How do I plot a hemisphere on top of a cone

RegionPlot3D[ Sqrt[x^2 + y^2] <= z && x^2 + y^2 + z^2 <= 2, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, Mesh -> None, AxesLabel -> {x, y, z}, PlotRange -> All, PlotPoints -> 120, PlotStyle -> Directive[Yellow, Specularity[White, 20], Opacity[0.8]]]


It gives me the result (Hemisphere on top on a cone ) I want but because I have never taken high level of math courses I do not have any explanation why I use Sqrt[x^2 + y^2] <= z as the equation for the cone. I will appreciate your kindness

Thanks

-
Sqrt[x^2 + y^2] <= c where c is a constant defines a circle. So you can picture Sqrt[x^2 + y^2] <= z as being a small circle when z is small and a larger circle when z is large. Hence, over the range of z values, you get the cone. – bill s Sep 22 '13 at 3:20

I don't know how best to explain it, but I'll try.

Sqrt[x^2 + y^2] gives you a distance to (x, y) from the origin (0, 0) because it is the solution to the Pythagorean Theorem. Viewed as a density plot it looks like this:

DensityPlot[Sqrt[x^2 + y^2], {x, -2, 2}, {y, -2, 2}]


Dark values represent small distance while light values represent large distance.

If you plot this in three dimensions with the distance as height (z axis) you get a cone with square edges because you are plotting over a square region:

ParametricPlot3D[{x, y, Sqrt[x^2 + y^2]}, {x, -2, 2}, {y, -2, 2}, BoxRatios -> 1]


To get a "normal" cone you need to cut the top off in a level line as viewed from the x and y axes. To do this you could clip any value with a distance (z-value) greater than the radius of the circle that should make up the base of your cone:

ParametricPlot3D[{x, y, Sqrt[x^2 + y^2]}, {x, -2, 2}, {y, -2, 2}, BoxRatios -> 1,
RegionFunction -> (#3 < 2 &)]


Another way to express that is to limit the z-value to 2 by using Min[2, z]:

ParametricPlot3D[{x, y, Min[2, Sqrt[x^2 + y^2]]}, {x, -2, 2}, {y, -2, 2}, BoxRatios -> 1]


Here the corners are not removed but instead flattened, and the circular base is again revealed.

-
Thank you so much – Maggie Sep 22 '13 at 4:45
@Maggie You're welcome. If you are satisfied with an answer you can Accept it by clicking the check-mark to the left of it. – Mr.Wizard Sep 23 '13 at 13:20