# Help me with Cylinder -coordinates problem, back to Cartesian or not? How to do it fast?

Source of the problem, 3b here.

Problem Question

Electricity density in cylinder coordinates is $\bar{J}=e^{-r^2}\bar{e}_z$. Current creates magnetic field of the form $\bar{H}=H(r)\bar{e}_{\phi}$ where $H(0)=0$. Define $H(r)$ from the maxwell equations

$$\nabla\times\bar{H}=\frac{1}{r}\begin{vmatrix}\bar{e}_r & r\bar{e}_\phi & \bar{e}_z \\ \partial_r & \partial_\phi & \partial_z \\ H_r & r H_\phi & H_z \\ \end{vmatrix} = \bar{J}.$$

So

\begin{align} \nabla\times\bar{H} &= \frac{1}{r} \bar{e}_r \begin{vmatrix} \partial_\phi & \partial_z \\ r H_\phi & H_z \\ \end{vmatrix} - r\bar{e}_\phi \begin{vmatrix} \partial_r & \partial_z \\ H_r & H_z \\ \end{vmatrix} + \bar{e}_z \begin{vmatrix} \partial_r & \partial_\phi \\ H_r & r H_\phi \\ \end{vmatrix} \\ &= \frac{1}{r} \left( \bar{e}_r (\partial_\phi H_z-\partial_z H_\phi) - r\bar{e}_\phi (\partial_r H_z-\partial_z H_r) + \bar{e}_z (\partial_r rH_\phi-\partial_\phi H_r) \right). \end{align}

I messed the calculations here up when I tried to go back to Cartesian coordinates because it is otherwise hard for me to see the math. So I tried to think things with them

$$\begin{cases} x=r\cos(\phi) \\ y=r\sin(\phi) \\ z=h \\ \end{cases}$$

but it took me many pages of erroneous calculations and I could not finish on time. Now my friend suggested the below.

My friend's approach which I could not understand yet or his purpose, something to do with independence

\begin{align} H &= H(r)e_\phi\\ &=0+H_\phi e_\phi+0 \end{align}

where

$$\begin{cases} H_\phi = H(r) <---\text{ independent of R}\\ H_r = 0 \\ H_2 =0 \\ \end{cases}.$$

Could someone explain what I am doing wrong in going back to the Cartesian? I know it is not wrong but it is extremely slow way of doing things. I am not sure whether I was meant to remember the page 817 here or what is really essential to solve this problem?

-
Perhaps related here. –  hhh Mar 29 '12 at 6:23
For cylindrical-to-cartesian coordinates, $z=z$ is unchanged (so probably there was no need to rename $z$ to $h$). This is probably also what your friend had: $\frac{\partial H}{\partial z}=H_z=0$ (not $H_2$). –  bgins Mar 29 '12 at 6:30
Since you didn't say what you did to get Cartesian coordinates, we cannot say where you went wrong. In principle it is possible to perform the computation entirely in Cartesian coordinates. However, I would not recommend it, as you'd be making the problem more difficult then it ought to be. –  Willie Wong Mar 29 '12 at 12:03

What you are meant to remember is simply this:

Let $\vec{v}$ and $\vec{w}$ be two vectors in some vector space $V$. Let $\vec{e}_1, \ldots, \vec{e}_n$ be a basis of $V$, and let $\vec{v} = \sum v_i \vec{e}_i$ and $\vec{w} = \sum w_i\vec{e}_i$. Then $\vec{v} = \vec{w}$ if and only if for every $1 \leq i \leq n$ we have $v_i = w_i$.

In other words, the basis decomposition of a vector is unique. Hence the vector equation

$$\nabla\times\vec{H} = \vec{J}$$

is exactly equivalent to the equation on their components expressed relative to a basis (and in this case we take the basis vectors of the cylindrical coordinates system)

$$\begin{cases} 0 = J_r &= \left(\nabla\times H\right)_r = \frac{1}{r}(\partial_\phi H_z - r\partial_z H_\phi) \\ 0 = J_\phi &= \left(\nabla\times H\right)_\phi = \partial_rH_z - \partial_z H_r \\ e^{-r^2} = J_z &= \left(\nabla\times H\right)_z = \frac{1}{r}\left(\partial_r(rH_\phi) - \partial_\phi H_r\right) \end{cases}$$

Now by assumption $H_r = H_z = 0$, since $\vec{H}$ only has the $\phi$ component, which we write as $H_\phi$. By assumption $H_\phi$ depends only on $r$. This shows that the first two equations in the system are automatically satisfied. To solve for $H_\phi$, you examine the third equation, which now reduces to

$$r e^{-r^2} = \partial_r (r H_\phi)$$

Noticing that

$$\partial_r e^{-r^2} = -2r e^{-r^2}$$

you get

$$\partial_r \left( -\frac12 e^{-r^2} + C\right) = \partial_r (r H_\phi)$$

Taking the antiderivative on both sides, you have the solution for $H_\phi$ in terms of $r$, with a free parameter $C$, which you can then set using the boundary condition $H_\phi(r=0) = 0$.

-

This service blocked my original answer with stupid two days' ban so shortly

$$\nabla\times\bar{H}= \begin{pmatrix}\partial_x \\ \partial_y \\ \partial_y\end{pmatrix}\times\bar{H}\not = \begin{pmatrix}\partial_r \\ \partial_\alpha \\ \partial_\phi\end{pmatrix}\times\bar{H}$$

where I want to stress

$$\nabla \not = \begin{pmatrix}\partial_r \\ \partial_\alpha \\ \partial_\phi\end{pmatrix}.$$

Then with the WW, you will get first degree-differential equation. Sorry I am now missing all references but this was the crux point to realize, not to mix the $\nabla$ from cartesian coordinates to polar coordinates.

I will update this if I can find the original answer, stupid censorship, well perhaps this is just gamification -- I lost my answer, stupid. Now I am too angry to concentrate on this junk, $\nabla$ is defined in cartesian -- to calculate mock $\nabla$ in polar coordinates you need to do some weekend calculations... (I mean to verify the conversion formula).

-