# Plotting vector field in polar coordinates

Is there an easy way(other than painfully decomposing into Cartesian components) to plot a vector field in polar coordinates? Basically I have a vector function $\vec V (r,\phi,z)$. How do I plot it ?

• Can you provide some basic code? The form of the function. Preferably in a way that would be easy to cope and paste it? – Konstantinos May 12 '18 at 15:40

You can use CoordinateTransform to transform between different coordinate systems. Beware that you might have to use the differential of certain coordinate transformation in order to transform the vector components of the vector field appropriately

Φ = {x, y, z} \[Function] Evaluate[CoordinateTransform["Cartesian" -> "Cylindrical", {x, y, z}]];
Ψ = {r, ϕ, z} \[Function] Evaluate[CoordinateTransform["Cylindrical" -> "Cartesian", {r, ϕ, z}]];
DΨ = {r, ϕ, z} \[Function] Evaluate[D[Ψ[r, ϕ, z], {{r, ϕ, z}, 1}]];


Mathematically, this is

$$\varPhi \colon \mathbb{R}^3 \to {[0,\infty[} \times {]-\pi,\pi[} \times \mathbb{R}, \quad \varPhi(x,y,z) = \left(\sqrt{x^2+y^2},\arctan(x,y),z \right)$$

and

$$\varPsi \colon {[0,\infty[} \times {]-\pi,\pi[} \times \mathbb{R} \to \mathbb{R}^3, \quad \varPsi(r ,\varphi,z) = \left(r \,\cos(\varphi),r \, \sin(\varphi),z \right)$$

Here is a vector field V in cylindrical coordinates and its transformation into cartesian coordinates.

V = {r, ϕ, z} \[Function] {r, 1, 3};
F = {x, y, z} \[Function] Evaluate[(DΨ @@ Φ[x, y, z]).V @@ Φ[x, y, z]];


In polar coordinates, V has to be interpreted as a mapping with values in the tangent bundle of ${[0,\infty[} \times {]-\pi,\pi[} \times \mathbb{R}$:

$$V \colon {[0,\infty[} \times {]-\pi,\pi[} \times \mathbb{R} \to T({[0,\infty[} \times {]-\pi,\pi[} \times \mathbb{R}), \quad V(r,\varphi,z) = \left(r \tfrac{\partial}{\partial r} + \tfrac{\partial}{\partial \varphi} + 3\, \tfrac{\partial}{\partial z} \right) \Big|_{(r,\varphi,z)}.$$

It has to be transformed like this:

$$F(x,y,z) = D\varPsi(\varPhi(x,y,z)) \cdot V(\varPhi(x,y,z)).$$

And this is the plot:

R = Pi;
VectorPlot3D[
F[x, y, z], {x, -R, R}, {y, -R, R}, {z, -R, R}, • @Lelouch V = Function[{r, ϕ, z}, {r, 1, 3}]; – b3m2a1 May 12 '18 at 16:59