# Convert vector-field from cylindrical to cartesian

1. Jun 20, 2013

### wellmax

1. The problem statement, all variables and given/known data
I have a vector field (which happens to be a magnetic field)
H = -$\frac{I }{2 \pi r}$u$\varphi$
u$\varphi$ is the unit vector

which is in the cylindrical coordinate system with only the $\varphi$ component nonzero so it circles around the z-axis. r is the radius of the circle.
the question is: write H in the cartesian coordinate system.

2. Relevant equations
i already know the answer through common sense but I'm not able to derive it myself:
H = $\frac{-I}{2 \pi \sqrt{x^2+y^2}}$[$\frac{y}{\sqrt{x^2+y^2}}$ - $\frac{x}{\sqrt{x^2+y^2}}$]

3. The attempt at a solution
now I know these relations:
x = r Cos[$\varphi$]
y = r Sin[$\varphi$]
r = $\sqrt{x^2+y^2}$
but i can't produce the answer with these

Last edited: Jun 20, 2013
2. Jun 20, 2013

### LCKurtz

If $\theta$ is the usual polar coordinate angle, then the unit vector in the $r$ direction is $\langle \cos\theta, \sin\theta\rangle$. You want to rotate this vector $90^\circ$ to get a unit vector in the $\theta$ direction. So put $\varphi = \frac \pi 2 +\theta$ to get$$\hat u_\varphi = \langle \cos(\frac \pi 2 +\theta),\sin(\frac \pi 2 +\theta)\rangle = \langle \sin\theta,-\cos\theta\rangle = \langle \frac y r,-\frac x r\rangle = \langle \frac y {\sqrt{x^2+y^2}},-\frac x {\sqrt{x^2+y^2}}\rangle$$

3. Jun 23, 2013

### wellmax

Thank you very much, this solves my question

4. Jun 23, 2013

### vela

Staff Emeritus
The righthand side, as you've written it, isn't a vector. Typo? It also looks like you made a sign error. Note that $\hat{u}_\varphi = (-\sin \phi, \cos \phi,0)$. It points in the direction that $\vec{r}$ moves if you increase $\varphi$ by a small amount.

5. Jun 23, 2013

### wellmax

Yes indeed a typo forgot the unit vectors
and H points in the minus $\varphi$ direction so i think it's alright

6. Jun 23, 2013

### vela

Staff Emeritus
If it points in the $-\hat{u}_\varphi$ direction, you have a sign error.

7. Jun 23, 2013

### wellmax

I don't see this error and my professor didn't see it as an error either when i first handed it in so could you please elaborate a bit more?

8. Jun 23, 2013

### vela

Staff Emeritus
I'm not sure what's there to elaborate on. Your expression is equal to $\frac{I}{2\pi r}\hat{u}_\varphi$, not $-\frac{I}{2\pi r}\hat{u}_\varphi$.

9. Jun 23, 2013

### wellmax

Well I plotted it in Mathematica and I rotates clockwise around the z-axis as expected so I still don't see the error

10. Jun 23, 2013

### vela

Staff Emeritus
According to your expression and assuming I>0, when x=y=1, for example, you have H pointing in the -x and +y direction. That's not clockwise.

11. Jun 23, 2013

### wellmax

Then it will point in the +x and -y direction because there is a minus sign in front of the entire vector
H = $\frac{-I}{2$\pi$\sqrt{x^2+y^2}}$[$\frac{y}{\sqrt{x^2+y^2}}$ux + $\frac{-x}{\sqrt{x^2+y^2}}$uy]

12. Jun 23, 2013

### vela

Staff Emeritus
Did you actually plug x=y=1 into that expression? Because of the minus sign out front, H points in the -x and +y directions.

13. Jun 23, 2013

### wellmax

I see you are right and my professor didn't even notice