$\pi$ Estimation & Error Analysis

In this lesson, we observe how increasing the number of sides reduces the approximation error. As $N \to \infty$, the error approaches zero.




Number of Sides ($N$):
Exact Surd Form:
Estimated $\pi$ (15 Sig Figs):
Estimation Error ($|\pi_{true} - \pi_{est}|$):

How Error is Calculated

The Absolute Error measures how far our polygon perimeter is from the actual circumference of the circle:

$$E = | \pi - \frac{N \cdot s_n}{2} |$$

As you increase $n$, you will notice the error drops significantly. However, once the error reaches approximately $10^{-16}$, it will stop decreasing. This is because the computer has reached the limit of its Floating Point Precision.

Algorithm Steps:

  1. Start with $N=6, s=1$.
  2. Double sides using the stable formula: $s_{new} = \frac{s_{old}}{\sqrt{2 + \sqrt{4 - s_{old}^2}}}$.
  3. Estimate $\pi \approx \frac{N \cdot s_n}{2}$.
  4. Compare against the built-in constant Math.PI.