# Creating a plot for a solid (torus)

We have the following two equations: Sqrt[1 - (Sqrt[x^2 + y^2] - 3)^2], -Sqrt[1 - (Sqrt[x^2 + y^2] - 3)^2] and these have to be plotted into a parametricplot3D and regionplot3D, and these would yield an image of a torus.

For regionplot3D, I've tried doing the following:

RegionPlot3D[{z^2 > Sqrt[1 - (Sqrt[x^2 + y^2] - 3)],z^2 < Sqrt[1 - (Sqrt[x^2 + y^2] - 3)]}, {x, -4, 4}, {y, -4, 4}, {z, -4, 4}]


but no graph appears. I only get a graph when I start decreasing the x, y, z ranges but it doesn't look like a torus. As for the parametricplot3D, I know that to get a torus shape I can use the following

ParametricPlot3D[{(2 + Cos[2 Pi v]) Sin[
2 Pi u], (2 + Cos[2 Pi v]) Cos[2 Pi u], Sin[2 Pi v]}, {u, 0, 1}, {v, 0, 1}]


but I'm not sure if those are the right equations to use, in order to get a torus that is similar to the one the original equations would give when plotted using plot3D. So, my question is, how can I get a torus using regionplot3D and parametricplot3D for the above equations?

## 1 Answer

The right equation should be as below.

ImplicitRegion[
z^2 <= 1 - (Sqrt[x^2 + y^2] - 3)^2, {x, y, z}] // Region


Or

RegionPlot3D[
ImplicitRegion[z^2 <= 1 - (Sqrt[x^2 + y^2] - 3)^2, {x, y, z}],
PlotPoints -> 80]


Or

RegionPlot3D[
z^2 <= 1 - (Sqrt[x^2 + y^2] - 3)^2 , {x, -4, 4}, {y, -4, 4}, {z, -4,
4}, PlotPoints -> 80]


Or

ContourPlot3D[
z^2 - (1 - (Sqrt[x^2 + y^2] - 3)^2), {x, -4, 4}, {y, -4, 4}, {z, -4,
4}, Contours -> {0}, Boxed -> False, Axes -> False]


If you want to use ParametricPlot3D or ParametricRegion, you should change the $$z^2\leq 1-(\sqrt{x^2+y^2}-3)^2$$ by set $$\sqrt{x^2+y^2}-3=r\cos\theta,z=r\sin\theta$$ ,where $$0\leq r\leq 1$$ and then

$$x=(3+r\cos\theta)\cos\phi,y=(3+r\cos\theta)\sin\phi,z=r\sin\theta$$

ParametricRegion[{(3 + r*Cos[θ]) Cos[ϕ], (3 +
r*Cos[θ]) Sin[ϕ],
r*Sin[θ]}, {{r, 0, 1}, {θ, 0, 2 π}, {ϕ, 0,
2 π}}]


We draw the region by set r=1.

ParametricRegion[{(3 + r*Cos[θ]) Cos[ϕ], (3 +
r*Cos[θ]) Sin[ϕ], r*Sin[θ]} /.
r -> 1, {{θ, 0, 2 π}, {ϕ, 0, 2 π}}] // Region

• ContourPlot3D[z^2 == 1 - (Sqrt[x^2 + y^2] - 3)^2, {x, -4, 4}, {y, -4, 4}, {z, -4, 4}, Boxed -> False, Axes -> False] – cvgmt Jan 4 at 1:31