Use functions and polygon thinking to squeeze the value of pi from both sides.
Big Idea
Start with a circle of radius 1. Put one polygon inside the circle (lower bound) and one outside the circle (upper bound). As you double the number of sides, both bounds close in on pi.
a_n is the inscribed side length.
b_n is the circumscribed side length.
a_(2n) = sqrt(2 - sqrt(4 - a_n^2)), b_n = (2 * a_n) / sqrt(4 - a_n^2)
This lab uses only square roots in the core update rule, which mirrors the geometric reasoning Archimedes used.
Interactive Lab
Choose how many doubling rounds to run. Start from a hexagon (6 sides), like Archimedes did.
| n sides | pi lower | pi upper | midpoint | interval width |
|---|
Programming Task
circumscribed_side(a), next_inscribed_side(a), and pi_bounds(n, a).0.00001.math.pi needed)from math import sqrt
def circumscribed_side(a):
return (2 * a) / sqrt(4 - a * a)
def next_inscribed_side(a):
return sqrt(2 - sqrt(4 - a * a))
def pi_bounds(n, a):
b = circumscribed_side(a)
lower = (n * a) / 2
upper = (n * b) / 2
return lower, upper
def starting_inscribed_side(start_sides):
n = 6
a = 1.0
while n < start_sides:
a = next_inscribed_side(a)
n *= 2
return a
def archimedes_table(rounds=4, start_sides=6):
n = start_sides
a = starting_inscribed_side(start_sides)
rows = []
for _ in range(rounds + 1):
lower, upper = pi_bounds(n, a)
rows.append((n, lower, upper, (lower + upper) / 2, upper - lower))
a = next_inscribed_side(a)
n *= 2
return rows