-> Software by Joe Ganley -> Pi Calculator Applet

Estimating Pi

This applet demonstrates a (not particularly good) way to estimate the value of Pi: by calculating the perimeter-to-diameter ratio of an n-sided regular polygon (which becomes a circle as n approaches infinity). Use the slider to set the value of n; the n-sided polygon is shown and the corresponding approximate value of Pi. Note that since the drawn polygons become more difficult to distinguish from one another as n grows, the slider works on a logarithmic scale.
Source code: The main file, and a supporting class for manipulating n-sided regular polygons.