# Plot a cone and a cylinder [closed]

I have to plot 0=x^2-2y+y^2 and z=sqrt(x^2+y^2) for a class project but Mathematica does not accept raw input, any ideas? I have tried with "cylinder" in the functions but it does not work.

• Show us the code you have tried so far. Apr 27, 2016 at 14:57
• There is an image of what i have tried Apr 27, 2016 at 15:03
• Please post code in textual form, rather than images, so people can easily copy / paste it into their own Mathematica notebook and play with it. Here is some help on doing that: copying code; formatting. Apr 27, 2016 at 15:08
• 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) Take the tour! 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! Apr 27, 2016 at 15:20
• Lose the z = inside Plot. Apr 27, 2016 at 15:21

ContourPlot3D[
{x^2 + y^2 == 1, z == Sqrt[x^2 + y^2]},
{x, -2, 2}, {y, -2, 2}, {z, -.5, 2},
ContourStyle -> Opacity[.65]]


Here are two code samples to get you started. Both snippets achieve the same result:

Plot3D[Sqrt[x^2 + y^2], {x, y} ∈ Disk[{0, 0}, 4]]


or alternatively

Plot3D[
Sqrt[x^2 + y^2], {x, -4, 4}, {y, -4, 4},
RegionFunction -> Function[{x, y, z}, x^2 + y^2 <= 4^2]
]


Either one generates the following:

A different, possibly easier approach, using the fact that a cone is a solid of revolution:

RevolutionPlot3D[t, {t, 0, 4}]


If you are simply interested in drawing the solid object, rather than plotting it from an equation, you can also use graphics primitives:

Graphics3D[
Cone[{{0, 0, 4}, {0, 0, 0}}, 4],
Axes -> True
]


• Thank you all this is what i was looking for. Apr 27, 2016 at 15:36