# Graphing a solid between two structures using spherical coordinates

How can I graph the solid that lies above the cone $$z=\sqrt{x^2+y^2}$$ and below the sphere $$x^2+y^2+z^2=z$$?

I tried SphericalPlot3D[1, {\[Theta], 0, \[Pi]/4}, {\[Rho], 0, 2}] which doesn't give me a solid, how do I do this?

Sorry I am a beginner with mathematica

Try

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


• What if I want to use spherical coordinates? – suomynonA Aug 20 at 6:03
• You could define an ParametricRegion for the sphere in spherical coordineates. But the cartesian formulation is much more easy. I think! – Ulrich Neumann Aug 20 at 7:52
• Can you show me the spherical method for it please? – suomynonA Aug 21 at 0:41
• Try something linke halfsphere = ParametricRegion[{r {Sin[\[Theta]] Cos[\[Phi]], Sin[\[Theta]] Sin[\[Phi]], Cos[\[Theta]]} + {0, 0, 1/2}, (0 <= r <= 1/2) && (0 <= \[Theta] <= Pi/2) && (-Pi <= \[Phi] <= Pi) }, {r, \[Theta], \[Phi]}] . Should work in MMA v12 (Sorry I couldn't test it in v11) – Ulrich Neumann Aug 21 at 7:57

You can also combine two RevolutionPlot3Ds using Show:

Show[RevolutionPlot3D[{t, t}, {t, 0, 1/2}],
RevolutionPlot3D[{Cos[t] / 2, Sin[t] / 2 + 1/2}, {t, 0, Pi}],
PlotRange -> All]


You asked to do this in spherical coordinates so see if this is good enough for you.

r[phi_,theta_]:=Piecewise[{
{0,Pi/4<phi<Pi/2},
{10*phi+1-5/2*Pi,Pi/4-1/10<phi<Pi/4},
{1,0<phi<Pi/4-1/10}}];
SphericalPlot3D[r[phi,theta],{phi,0,Pi/2},{theta,0,2Pi},PlotPoints->100]


That r is zero outside the range of the cone, increases rapidly to make up the surface of the cone and then is 1 to make up the sphere on top of the cone.

That doesn't give a perfect cone because the tip and junction between the cone and the sphere aren't well rendered in the plot. You can increase the PlotPoints to make this better.

EDIT

Better rendering while still using SphericalPlot3D

Show[SphericalPlot3D[10*phi+1-5/2*Pi,{phi,Pi/4-.1,Pi/4},{theta,0,2Pi},PlotRange->{0,1}],
SphericalPlot3D[1,{phi,0,Pi/4},{theta,0,2Pi},PlotRange->{0,1}]]


You could use this method to graph a variety of surfaces in spherical coordinates.

As a hint, I found the coefficients of -10*phi+5/2*Pi by Solve[{m (Pi/4-1/10)+b == 0, m Pi/4+b == 1},{m,b}]