← Math & statistics

Pi Approximation Explorer

Compare four ways to approach pi: a regular polygon, the Gregory series, the Nilakantha series, and a Monte Carlo simulation. Each run shows the estimate, the error, and a convergence chart.

Runs locally in your browser. Use the shareable URL to reopen the same classroom example later.

Ready to compare speed under the same target? Open Pi Algorithm Race. Need a practical decimal output after that? Use Pi Digits Generator.

Other languages ja | en | zh-CN | es | pt-BR | fr
3 quick steps
  1. Choose one method and keep the default inputs for your first run.
  2. Compare the estimate and error, then read the chart and sampled step table together.
  3. Load another example or copy the URL when you want to reuse the setup.
Polygon

Increase the side count of an inscribed polygon to see a geometric approximation of pi.

Try 6, 12, 24, 96, or 384 sides to see how the perimeter approaches the circle.

Estimate
Reference pi
Absolute error
Relative error
Matching digits
Input summary

Convergence chart

Read the chart with the sampled table below. The red dashed line marks the reference value of pi.

Sampled steps

Step Estimate Absolute error Relative error

Teacher notes

FAQ

Why is Monte Carlo not exact?

Monte Carlo uses random points inside a square. More points usually improve the estimate, but each run is still a simulation rather than an exact formula.

Why does Gregory converge so slowly?

The Gregory-Leibniz series is simple, but every new term changes the estimate only a little. That makes it a good teaching tool and a poor speed contest.

Why do more polygon sides help?

An inscribed polygon fits the circle more closely as the side count increases, so its perimeter becomes a better approximation of the circumference.

What do matching digits mean?

Matching digits count how many leading digits of the estimate agree with the reference value of pi before the first mismatch.

Which method should I try first?

Start with polygon, then compare Gregory and Nilakantha, and finally use Monte Carlo to talk about randomness and reproducibility.

Related calculators