# Magnetic field inside of a long rotating cylinder

I have a simple question. I need to find out what is the magnetic field inside a rotating long cylinder with a charged density $\sigma$. The cylinder rotates around its axis with angular speed $\omega$. All of the parameters are constants.

I've tried using Amper's law but I can't seem to get to the right answer.

$J=\lambda \cdot v=\sigma\omega R dr$

$I=\sigma \omega R L$

L is just the the part of the length of the whole cylinder. So I i'll just use Amper's law :

$\mu_0 \cdot I_{in}=B\cdot 2\cdot\pi \cdot L$

$\mu_o\sigma \omega R \cdot2L=B\pi 2L$

$B=\mu_o \sigma \omega R/\pi$

The loop is a circle with a radius of $L$, and so the current flows thorough a line of length $2L$.

The correct answer seems to be the same answer just with the division by $\pi$.

Where did I go wrong?

$$\oint_L \vec{B}\cdot d\vec{l} =\mu_0 I_{enc}$$
where $L$ is the path of your Amperian loop. The dot product here signifies that only the component of $\vec{B}$ along the path contributes, so choosing a path along the field lines will simplify things greatly (or if its perpendicular, it contributes zero).