# Magnetic field from a half-cylinder [closed]

I am preparing for an exam, on this problem I had the opposite direction of the magnetic field.

A conductor-cylinder with radius R has been cut in half ($\phi \in [0,\pi]$) A DC current $I$ runs along $\hat Z$, and can be assumed to be evenly distributed.

The problem is to calculate the magnetic field at $\rho=0$ (i.e. the center of the cylinder and on the diameter of the half-cylinder).

I took an infinitesimal contribution $dB=\frac{\mu_0 di}{2\pi \rho}$ with $di=\frac{2I}{\pi R^2}dr d\theta$, $dB$ is along $\hat \phi$ but the total $B$ at $\rho=0$ won't be. Integrating $dB$ first for $B_x$ gives me $-2\frac{\mu_0 I}{\pi^2R}$ and afterwards for $By$ gives me $B_y=0$

The magnitude is right, but the answer has instead $B_x$ in the positive direction. Intuitively it makes sense that it is positive (flows along the boundary).

I think I made the mistake here: $\hat \phi = -\hat x sin(\phi) + \hat y cos(\phi)$ gives: $dB_x = -sin(\phi) dB$

It seems (mathematically) correct to me, but the direction is wrong. Would be very thankful for any thoughts on where I am going wrong. Thanks.

-

## closed as too localized by Sklivvz♦, dmckee♦Dec 23 '12 at 4:31

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

any chance of a diagram of the geometry, have you got $x$ in the right direction? –  Nic Aug 24 '11 at 13:52
It's an interesting assumption to say that the current through any given $d\phi$ is the same. Interesting because this is most certainly not true for the charge distribution. I believe, however, that it is correct. –  Alan Rominger Aug 24 '11 at 15:07
I'm adding the "homework" tag since this is a question of educational value. –  David Z Aug 24 '11 at 18:04
@nic, updated with a diagram. –  j-a Aug 25 '11 at 7:12
$\hat{\phi}$ is just a direction, but in line with your sign convention and defined origin (as in the diagram) this requires $\hat{\phi} = \hat{x}$ at $\phi=0$. Don't worry about rigour, you can define your axes and origin as you like, you just have to stick with them through the solution. Try to make sure that in your equations vectors = vectors. –  Nic Aug 25 '11 at 15:25

In your picture the electric current flows towards us from the screen (as indicated by $\odot$), hence by Lorentz rule each element $di$ creates field which is directed counter-clockwise, as seen by us on the screen. Hence, under the half-cylinder the field is always directed rightwards.
The sign in front of $\hat x$ in the expression for $\hat \phi$ should be then positive.