# Using Mathematica to Solve for Electric Field from finite cylinder

For a cylinder that is of length L and radius s and possesses a charge distribution of sigma across only the cylinder part and not the endcaps, I am trying to calculate the Electric-field. The cylinder is positioned with its center at the origin and I am trying to find the electric field at a point $P = (x,y,z)$.

I am not 100% sure if the formula that I've obtained is quite correct, but I would like to use Mathematica to see if it is meaningful.

The formula that I've gotten down to is:

$$E_{x}(x,y,z)=ks\int_{\Theta=0}^{2\pi}\int_{z'=-L/2}^{L/2}\sigma(x,y,z)\frac{dz'\,d\theta\,(x-s\cos(\theta))}{((x-s\cos(\theta))^{2}+(y-s\sin(\theta))^{2}+(z-z')^{2})^{3/2}}$$

$$E_{y}(x,y,z)=ks\int_{\Theta=0}^{2\pi}\int_{z'=-L/2}^{L/2}\sigma(x,y,z)\frac{dz'\,d\theta\,(y-s\sin(\theta))}{((x-s\cos(\theta))^{2}+(y-s\sin(\theta))^{2}+(z-z')^{2})^{3/2}}$$

$$E_{z}(x,y,z)=ks\int_{\Theta=0}^{2\pi}\int_{z'=-L/2}^{L/2}\sigma(x,y,z)\frac{dz'\,d\theta\,(z-z')}{((x-s\cos(\theta))^{2}+(y-s\sin(\theta))^{2}+(z-z')^{2})^{3/2}}$$

Now regardless of whether this is actually correct, I do want to test it. Since L, x, y, z, s, k, and σ are all "known" quantities, then this should in theory should have a numerical solution at least. However, with Mathematica, when I plug these equations in, taking σ to be constant, it just kind of sits there thinking for a very long time and does not come to any form of conclusion.

Is there anyway that I can actually do this on Mathematica numerically in terms of the parameters in a reasonable time and have it actually return something that can then be plotted? Sorry that I'm not the most familiar with how Mathematica operations.

Sorry for the odd format on the integrals, the thing seemed to wrap it around to the next line and I am pretty unfamiliar with formatting on this site.

-
Please include the relevant Mathematica code you've tried in your question. –  ciao Feb 10 '14 at 3:10
–  Kuba Feb 11 '14 at 6:02
The mathematica code is pretty simple. It is just in the notebook format for Mathematica 9 x = x y = y z = z k = k s = s sig = sig L = L Integrate[ ksigs*(x - sCos[theta])/((x - sCos[theta])^2 + (y - s*Sin[theta])^2 + (z - z1)^2)^(3/2), {z1, -L/2, L/2}, {theta, 0, 2*Pi}] –  Logan Dougherty Feb 12 '14 at 17:31