You must always choose a set of coordinates when evaluating an integral. It usually makes sense to choose coordinates that match the symmetry of your object or system. For a cube, you might choose regular Cartesian coordinates \(dV = dx dy dz\text{,}\) while for a cylinder you might choose cylindrical coordinates \(dV = s ds d\phi dz\text{.}\) You might even decide that your object or system can be treated as two-dimensional (or even one-dimensional), in which case you do not need all three dimensions. In any case, you will need to integrate over the entire object with respect to every relevant coordinate.
Section 22.9 Chop-Multiply-Add: Calculating Electric Fields
For an object with a continuous charge density, you can use the Chop-Multiply-Add strategy, as introduced in the sections on Non-Constant Motion and Chop-Multiply-Add: Calculating Moment of Inertia, to construct and evaluate an integral for the electric field. An example for a one-dimensional object with charge density \(\lambda(x)\) is included below.
Chop: You can start by chopping up the object into small pieces. Each piece of the object has charge \(dq = \lambda dx\text{,}\) where the \(dx\) represents the infinitesimal length of the piece and \(\lambda(x)\) is the charge density of the object. In general, \(\lambda\) can be either uniform (constant over the entire object) or non-uniform (non-constant over the object).
Note 22.9.1. Choosing Coordinates for Integrals.
Multiply: Once you know the charge on each small piece \(dq\text{,}\) you multiply to find the electric field created by that small piece:
\begin{equation*}
d\vec{E} = k\frac{dq}{r^2}\hat{r} = k\frac{\lambda(x)dx}{r^2}\hat{r}
\end{equation*}
Here \(r\) is the distance from the location of \(dq\) to the location where you are evaluating the electric field, and \(\hat{r}\) is the unit vector that points in this direction. It can be highly useful to draw a diagram of the charge distribution, including an example \(dq\text{,}\) and label \(r\) and \(\hat{r}\) so they can be easily written in terms of your chosen coordinates.
Add: Last, once you have the infinitesimal \(d\vec{E}\text{,}\) you add together every \(d\vec{E}\) over the entire object:
\begin{equation*}
\vec{E} = \int d\vec{E} = \int k\frac{\lambda(x)dx}{r^2}\hat{r}
\end{equation*}
