# Turn a two-dimensional function with cylindrical symmetry into a three-dimensional function

Say I have a function that I solved from a differential equation in 2-dimensions because I know in advance that there is cylindrical symmetry in the solution. For instance, say we obtain the solution:

f[x_,z_]=x^2+z^2


How would one go about turning this "slice" of a three-dimensional cylindrically symmetric function into its full three-dimensional form?

The function above should describe this three dimensional function along any plane that goes through the x axis. I feel like there should be an easy solution but I'm just not seeing it.

• f[x_, y_, z_] := f[x_, z_]? Or g[x_, y_, z_] := f[x_, z_], if you want less confusion. Is that what you mean? Jul 25, 2022 at 21:49
• thanks for the response! but i dont think thats what i mean. the full 3D function should reduce down to the 2D function listed above along every plane that crosses the x axis. Jul 25, 2022 at 21:53
• I don't know what you mean by a 3D function or a 2D function, I guess. Give an example of a function that reduces "down to the 2D function listed above along every plane that crosses the x axis." I think mine does it, but you say it doesn't. Thus I must be misunderstanding something. Jul 25, 2022 at 22:03
• Some test cases would help. As you've written this, I see @MichaelE2's suggestion as matching your requirement exactly. Jul 25, 2022 at 22:17
• maybe a lower dimensional case would help? for example, if i know that a 2D solution to a PDE has cylindrical symmetry, i would exploit that by solving the PDE in 1 dimension along a line going through the origin. for instance, say the 1D solution i get is f[x_]=Abs[x]. Then when I project it back into its original 2D form, it would become a cone, f[x_,y_]=Sqrt[x^2+y^2] because if you plot the cone along a line going through the origin you will get back f[x_]=Abs[x]. i dont know if this helps. im really bad at explaining things, so please let me know if that made sense! Jul 25, 2022 at 22:21

I assume OP uses the "standard" convention where the cylindrical axis is the $$z$$-axis. Cylindrical symmetry means that the function does not depend on the azimuth $$\varphi$$.

If f[x_,z_] is the restriction of some function f[x_,y_,z_] to the $$x \geq 0$$ part of the $$xz$$-plane, and if f[x_,y_,z_] is cylindrically symmetric, then it is given by

f[x_,y_,z_]:=f[Sqrt[x^2+y^2],z];


Note that I am using the same symbol f to denote two different things, which in Mathematica is no problem because it can distinguish things with 2 arguments and things with 3 arguments.

Example. Suppose the restriction to the $$x \geq 0$$ part of the $$xz$$-plane is known ("slice"):

f[x_,z_] := x^2+z^2;


Then the original, cylindrically symmetric function is

f[x,y,z]
(* x^2+y^2+z^2 *)