Electric field above polygonal loop (and the limiting case of a circular loop) The electric field at a point a distance $z$ above the midpoint of a segment of length $2L$ and uniform charge density $\lambda$ is given by
$$\mathbf{E} = \frac{1}{4\pi\varepsilon_0}\frac{2\lambda L}{z\sqrt{z^2 + L^2}}\hat{\mathbf{z}} \tag{1}$$

Square loop. This is an elementary problem in Griffith's Introduction to Electrodynamics. Suppose we have four of these segments forming a square, and we want to calculate the electric field at a point $P$ a distance $z$ above the center of the square. Setting up Cartesian coordinates with origin at its center and axes parallel to its sides, considering only the side $AB$ that is parallel to the $y$ axis and lies in the first and fourth quadrant, we use $(1)$ to conclude that
$$\mathbf{E}_{AB} = \frac{1}{4\pi\varepsilon_0}\frac{2\lambda L}{\sqrt{(z^2 + L^2)(z^2 + 2L^2)}}\hat{\mathbf{k}} \tag{2}$$
(just substituting for the new distance $z \to \sqrt{z^2 + L^2}$), where $\hat{\mathbf{k}} = \mathbf R / R$, if $\mathbf R$ is the separation vector between the point $P$ and the the midpoint of $AB$. Since $R = \sqrt{z^2 + L^2}$ and $\mathbf R = - L\hat{\mathbf x} + z\hat{\mathbf z}$, we see that
$$\begin{split}
\mathbf E_{AB} &= \frac{1}{4\pi\varepsilon_0}\frac{2\lambda L}{\sqrt{(z^2 + L^2)(z^2 + 2L^2)}}\left(- \frac{L}{\sqrt{z^2 + L^2}}\hat{\mathbf x} + \frac{z}{\sqrt{z^2+L^2}}\hat{\mathbf z}\right) \\
&= \frac{1}{4\pi\varepsilon_0} \frac{2\lambda L}{(z^2 + L^2)\sqrt{z^2 + 2L^2}} (- L\hat{\mathbf x} + z\hat{\mathbf z})
\end{split}$$
The electric field produced by the side $CD$ has equal $z$ component and opposite $x$ component, so that we have
$$\mathbf E_{AB\cup CD} = \frac{1}{4\pi\varepsilon_0} \frac{4\lambda L z}{(z^2 + L^2)\sqrt{z^2 + 2L^2}} \hat{\mathbf z} $$
Similar reasoning leads us to determining that the electric field contributed by sides $BC$ and $DA$ together is found by the same formula; therefore we conclude that, in total,
$$\mathbf E = \frac{1}{4\pi\varepsilon_0} \frac{8\lambda L z}{(z^2 + L^2)\sqrt{z^2 + 2L^2}} \hat{\mathbf z}$$
When $z \gg L$ we see that the field goes like $1/z^2$ as we expected. It is also directly proportional to $8\lambda L$ which is the total charge on the loop.

Polygonal loop. Now suppose that instead the loop is shaped like an $n$-sided polygon. Let one side $AB$ be again parallel to the $y$ axis and lying in the first and fourth quadrant. If $a$ is the apothem of our polygon, formula $(2)$ becomes
$$\mathbf{E}_{AB} = \frac{1}{4\pi\varepsilon_0}\frac{2\lambda L}{\sqrt{(z^2 + a^2)(z^2 + a^2 + L^2)}}\hat{\mathbf{k}} = \frac{1}{4\pi\varepsilon_0}\frac{2\lambda L}{(z^2 + a^2)\sqrt{z^2 + a^2 + L^2}}\hat{\mathbf{k}}(- a\hat{\mathbf x} + z \hat{\mathbf z}) $$
since $\mathbf R = - a\hat{\mathbf x} + z \hat{\mathbf z}$. By a symmetry argument similar to the one I provided above, the total electric field should have no lateral component, and my conjecture is that it should be given by
$$\mathbf E = \frac{1}{4\pi\varepsilon_0} \frac{2n\lambda L z}{(z^2 + a^2)\sqrt{z^2 + a^2 + L^2}} \hat{\mathbf z}$$
although I don't know the exact steps to show this formula in the general $n$ case (it should be trivial). Now, basic geometry informs us that
$$a = L \cot\left(\pi/n\right)$$
so that we arrive at
$$ \mathbf E = \frac{1}{4\pi\varepsilon_0} \frac{2n\lambda L z}{(z^2 + L^2\cot^2(\pi/n))\sqrt{z^2 + L^2\csc^2(\pi/n)}} \hat{\mathbf z}$$
The limit as $n \to \infty$ should give us the electric field above a circular loop of radius $L$, but Wolfram tells me it vanishes. Where is my mistake? Is my reasoning even correct in the first place?
 A: The limit will not work in wolfram as a representation of the your quoted circle as long as, taking more and more sides in your polygon, L tends to zero. This can be seen in multiple ways:
(1)  Taking $a= L cot(\pi /n)$, when $n \rightarrow \infty $, $cot(\pi /n) \rightarrow \infty $ then, in order to have $a \rightarrow radius$, limited, you $must$ have $L \rightarrow 0$ (necessary but not sufficient).
(2) From an intuitive point of view, maintaining finite $a$, represents taking $L \rightarrow 0$ when $n$ if huge. So you must specify the path for the limit in order to obtain the right answer.n-
(3) Just taking $n \rightarrow \infty$ in wolfram, the program supposes $L \neq 0$ which means this limit represents physically, the electric field of an infinite radius ring.
One way of solving the problem is thinking  $n \rightarrow \infty$ when the polygon is circumscribed to a circle. In this case, the path for $L$ in the large $n$ case is given by $L = r\sqrt{2-2cos(2\pi /n)}$, in which $a \rightarrow r$ when $n \rightarrow \infty$. I didn't try it, but I'm pretty sure if you put this in wolfram you will obtain the electric field of a ring in its central axis, as expected...
