Why doesn't this converge to $\pi$? $\lim_{n\to\infty}\frac12\sqrt{2-2\cos( \frac{2 \pi}{n} )} \times n$ Suppose a regular polygon with $n$ side has radius (line from center to point that connect sides *I don't know how to call it) of length $r$.
From cosine law, the side would has length of  $$\sqrt{2r^2-2r^2\cos( \frac{2 \pi}{n} )} $$
Perimeter would be $$\sqrt{2r^2-2r^2cos( \frac{2 \pi}{n} )}  \times n $$
Circle has infinitely-many sides and circumference of $2\pi r$
So $$\lim_{n \rightarrow \infty}  \sqrt{2r^2-2r^2\cos( \frac{2 \pi}{n} )}  \times n= 2 \pi r$$
And
 $$\lim_{n \rightarrow \infty} \frac{\sqrt{2-2\cos( \frac{2 \pi}{n} )}  \times n}{2}= \pi$$
But, when I plot it on Desmos, the graph scatters at $5.9\times 10^8$ (in the picture). Can anybody give me reason why this happens? 
Graph
 A: Doing a series expansion, $\cos(2\pi/n)=1-2\pi^2/n^2+o(1/n^2)$ so $\sqrt{2-2\cos(2\pi/n)}=\sqrt{4\pi^2/n^2+o(1/n^2))}=\frac{2\pi}{n}(1+o(1))$ and so $n/2$ times that is $\pi(1+o(1))$ i.e. it converges to $\pi$. Thus I conclude that the problem you are seeing on desmos is probably caused by numerical error due to catastrophic cancellation in the subtraction $2-2\cos(2\pi/n)$. 
Accurately computing a difference of two numbers that are so close together using floating point arithmetic needs a special routine that computes the difference directly, rather than performing a subtraction at all. One way to do that for $1-\cos(x)$ is to use a trig identity, which I usually remember as $\sin(x)^2=\frac{1-\cos(2x)}{2}$ (I remember it this way because this is the form that comes up all the time in calc II). From here you have $1-\cos(x)=2\sin(x/2)^2$ which now doesn't involve subtracting nearly equal numbers. By using that identity, you might try plotting $x \sin(\pi/x)$ for large $x$, you should see a better result.
A: As I commented, I can't seem to replicate your graph. However, there is this:
Note that, by a Half-Angle Identity, we have $1-\cos\theta = 2\sin^2(\theta/2)$, so your expression reduces to $$\lim_{n\to\infty}n\sin\frac{\pi}{n}$$ which we can cleverly rewrite as $$\pi\cdot\lim_{n\to\infty}\frac{\sin(\pi/n)}{\pi/n}=\pi\cdot\lim_{m\to 0}\frac{\sin m}{m}$$
(by taking $m=\pi/n$). It's a fundamental fact in Calculus (you'll find many proofs here) that the limit expression on the right-hand side is $1$ (when $m$ is in radians), so that, in fact, your limit should converge to $\pi$.
A: The limit set up is correct, indeed by standard limit we have that
$$\frac{ \sqrt{ 2-2cos( \frac{2 \pi}{n} )}n }{2}=\sqrt 2 \pi \sqrt{ \frac{1-cos( \frac{2 \pi}{n} )}{\left( \frac {2\pi} n\right)^2} }\to \pi$$
therefore the problem could be a numerical issue with desmos.
