# Volume integral vs Volume

I have to calculate the divergence of an electric field and the charge in a cylindrical space ($r=3$, $z=3$).

So the correct way of doing it would be taking a volume integral of that field as it's shown below:

$$\int_V \nabla\cdot E\,dV=\int_0^3\int_0^{2\pi}\int_0^3(90r-5)r\,drd\phi dz$$

where $90r-5$ is $\nabla\cdot E$.

Now, this may sound stupid, but why cannot I just multiply the field $E$ by the volume of the cylinder e.g. $( \nabla\cdot E \pi r^2 z )$ ?

-
You say you have to calculate the divergence of the electric field. Perhaps you mean something else? Because you seem to already know that $\nabla \cdot E = 90r - 5$. Maybe you need to calculate the charge enclosed by this cylinder instead? –  Muphrid Dec 28 '12 at 19:25
That's true. Didn't explain correctly. But it's not the case. The integrand does not matter. –  Arturs Dec 28 '12 at 19:29

First, since you're integrating the divergence of $E$, using $E$ itself would not make sense.

Second, as long as the divergence is not constant, well, you can't pull it out of the integral. You're basically suggesting you should be able to pull something out of the integral so that you can rewrite it as $(\nabla \cdot E) \int 1 \, dV$. You can only do this if the divergence is constant--if it doesn't depend on any of the integration variables $r, \phi, z$.

In short, how could you do this...

$$\int_V \rho(r, \phi z) \, r \, dr \, d\phi \, dz \to \rho(r, \phi, z) \int_V r \, dr \, \phi \, dz$$

...if integrating completely removes all dependence on $r, \phi, z$? You can't pull something out that depends on integration variables. That's the problem.

In your particular problem, however, you can use the divergence theorem to convert this volume integral into a surface integral. Then, you integrate $E$ directly on the surface of the cylinder. This can be convenient because then, for example, $E \cdot \hat n$ may be constant on the curved wall of the cylinder (this is often the case in problems involving cylindrical symmetry).

-
Sorry, I forgot to change E to divE. Thank you for your answer. I completely forgot that I cannot extract divE from the integral, because it depends on "r". –  Arturs Dec 28 '12 at 19:51
The right way to do it, knowing that the divergence of E is the charge density divided by $\epsilon_0$, then: $\epsilon_0\int_V\nabla\cdot E=\int_V\rho=Q$
I suppose you know that the integral of the charge density $\rho$ to the volume is the charge.
You know the value of the divergence of E so you're done. Take into acount, for another problems, that if your system has point charges, then the divergence of E will go up to infinity in those points and you won't be able to integrate, so you can look for some gaussian surface and use the gauss theorem: $\int_V\nabla\cdot E=\int_{\partial V}E$ being $\partial V$ the surface that's the limit to the volume.