Suppose an alignment of four charges in the vertices of a square. The first pair on one diagonal has positive charge and the other negative charge, all charges are of the same absolute value. length of a is specified. How do you compute the Work necessary to assemble this configuration if all the charges are infinitely distant in the beginning. I presume you integrate the Force somehow. Also, don't you need to expend energy every second to stop the charges from approaching each other? If there is an explained solution on the internet, link will be greatly appreciated. Thanks in advance.
You can compute the integrals $W=\int\vec F\cdot d\vec r=q\int E\cdot d\vec r$ for each charge $q$ you bring from infinity, where $\vec E$ is the electric field generated by the other charges present and then add them all together. On the other hand, since electrostatic fields are conservative the work done is independent of the path, so it is conservative and you can assign a potential energy to it, $U=qV=-W$, where $V$ is the potential generated by the others charges. You just sum all the potential energies among the pairs of charges and you get the work done.