Plot The volume of a cylinder between a cone and XY

I want to plot the volume of a cylinder between a cone and the plane XY

The equation of the cone is zz == √x2+y2\sqrt{x^2 + y^2}
and the cylinder equation y2−2y+x2=0y^2 – 2y + x^2 = 0

I am using the following code to plot the graphs:

p3 = Plot3D[{Sqrt[x^2 + y^2], 0}, {x, -2, 6}, {y, -5, 5}]
p4 = ContourPlot3D[{y^2 – 2 y + x^2 == 0}, {x, -5, 5}, {y, -5,
5}, {z, -5, 5}]
show [p3,p4]

And I get the following

How can I plot only the volume of the cylinder between the cone and the plane XY

=================

  

 

Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– Michael E2
Apr 28 ’15 at 23:34

=================

2 Answers
2

=================

You can use the RegionFunction option on ContourPlot3D to only plot the cylinder above the plane and below the cone.

ContourPlot3D[{y^2 – 2 y + x^2 == 0}, {x, -5, 5}, {y, -5, 5}, {z, -5, 5},
RegionFunction -> Function[{x, y, z}, 0 <= z <= Sqrt[x^2 + y^2]]] Edit The above is correct, but the plot will look better if it is focused on the relevant region. ContourPlot3D[ y^2 - 2 y + x^2 == 0, {x, -1, 1}, {y, 0, 2}, {z, 0, 2.5}, RegionFunction -> Function[{x, y, z}, 0 <= z <= Sqrt[x^2 + y^2]], BoxRatios -> {2, 2, 2.5}]

  

 

Thanks for your help
– Ur4
Apr 28 ’15 at 23:23

  

 

I edited your answer to show how the plot can be focused on the relevant region by making a more suitable choice of plot range.
– m_goldberg
Apr 29 ’15 at 2:59

The solution provided by @Edmund does not show the top (curved) face of the region. The following does:

RegionPlot3D[z < Sqrt[x^2 + y^2 ] && y^2 - 2 y + x^2 < 0 && z > 0,
{x, -1.5, 1.5}, {y, -.5, 2}, {z, 0, 2},
PlotPoints -> 100]