# Plotting a function in a toroidal domain

Consider a function in cylindrical coordinates given by $\Psi(\rho,\theta,z)$. I want to plot this function in a domain which is toroidal(assume the necessary geometric parameters of the toroid). What should be the conditions in my Plot3d function after entering $\Psi$.

I have been trying this for a while now but I keep messing up and am unable to reach the correct formulation of the required domain. Any help / hint is appreciated.

• If I'm understanding you right, you could try CoordinateTransform["Cylindrical" -> {{"Toroidal", {c}}, "Euclidean", 3}, {r, θ, z}] and then plug the results into your $\Psi$. – J. M.'s technical difficulties Mar 31 '18 at 8:05

MMA cannot draw 3D plots in coordinates other than Cartesian. Thus, you have to transform your $\Psi$ function to these coordinates. I am assuming you do not want to transform $\Psi$ to a toroidal coordinate system, but restrict the plot to a toroidal region.

Considering this example function in Cylindrical coordinates (I change $z$ symbol coordinate, as MMA cannot do the transformation naming with the same symbol the variables to be transformed):

$$\Psi (\rho,\theta,\zeta)=\exp (-0.001 \zeta )\, J_3(0.001 \rho )\, (\sin (4 \theta )+\cos (4 \theta ))$$

then, we transform the function:

\[CurlyPhi][\[Rho]_, \[Theta]_, \[Zeta]_] :=
Exp[-0.001 \[Zeta]] (Cos[4 \[Theta]] + Sin[4 \[Theta]]) BesselJ[3, 0.001 \[Rho]];

TransformedField["Cylindrical" -> "Cartesian",
\[CurlyPhi][\[Rho], \[Theta], \[Zeta]], {\[Rho], \[Theta], \[Zeta]} -> {x, y, z}]

(* E^(-0.001 z) BesselJ[3, 0.001 Sqrt[x^2 + y^2]]
(Cos[4 ArcTan[x, y]] + Sin[4 ArcTan[x, y]])
*)


Now, you can plot your function in the Cartesian coordinates with any MMA 3D function in a restricted domain defined by a torus. Here I use DensityPlot3D:

DensityPlot3D[E^(-0.001 z)BesselJ[3, 0.001 Sqrt[x^2 + y^2]]
(Cos[ 4 ArcTan[x, y]] +  Sin[4 ArcTan[x, y]]), {x, -20, 20}, {y, -20, 20}, {z, -20, 20},
PlotPoints -> 70,
RegionFunction -> Function[{x, y, z}, (14 - Sqrt[x^2 + y^2])^2 + z^2 <= 6^2 ]] You can play with the options at your convenience.