grandpa2390 said:
So what I said before is correct then?
It's hard to say because it's not very clear what you're doing. In one of your posts you said something about a technique not working for a circle but working for a square. I can't figure out what you're trying to do there. Writing out some equations instead of only describing what you're doing in words would help.
Anyway, based on some of your questions in another thread as well as this thread, let me make a few comments.
You can have objects of different dimensions. A line charge resides on a one-dimensional object, like a curve or a line segment; a surface charge is spread out over a two-dimensional object; and a volume charge is three-dimensional. In each case, you usually have a corresponding charge density, and to get the infinitesimal charge, you multiply the charge density by some geometric element of the appropriate dimensionality.
For example, if you have a charge Q uniformly distributed on thin rod of length L, the linear charge density is ##\lambda = Q/L##. The length of an infinitesimal piece of the rod could be described by its length ##dx##, and the charge of that piece is ##dq = \lambda\,dx##.
If you have a charge Q uniformly distributed over a square with sides of length ##a##, the charge density is ##\sigma = Q/a^2##. The area of an infinitesimal piece of the square is ##dx\,dy##, and the charge of that piece is ##dq = \sigma\,dx\,dy##.
If you have a charge Q uniformly distributed over a disc of radius R, the charge density is ##\sigma = Q/\pi R^2##. For a circular region, polar coordinates are often more convenient. The area of an infinitesimal piece of the disk is ##r\,dr\,d\theta##, and the charge of that piece is ##dq = \sigma\,r\,dr\,d\theta##.
In each of these cases, the infinitesimal charge looks like a point charge, so the integrand is basically Coulomb's law (for the electric field) where the charge is ##dq##.
But sometimes you'd like to leverage a previous result. For example, if you've derived the electric field due to a ring of charge, you can use this result to calculate the electric field due to a disk of charge. The Hyperphysics page shows that the z-component of the electric field due to a ring of charge is given by
$$E_z = \frac{kQz}{(z^2+R^2)^{3/2}}.$$ You can think of the disc as a collection of concentric rings. To find the charge of a ring of radius r, you can integrate over ##\theta##:
$$dq = \int_0^{2\pi} \sigma\,r\,dr\,d\theta = 2\pi r \sigma\,dr.$$ You can plug this result in for Q in the formula for the electric field of the ring.
$$dE_z = \frac{kz (2\pi r \sigma\,dr)}{(z^2+r^2)^{3/2}}.$$ Finally, integrate from 0 to R to get the final result:
$$E_z = \int dE_z = \int_0^R \frac{kz (2\pi r \sigma\,dr)}{(z^2+r^2)^{3/2}}.$$