Member-only story
Published at 2025–03–14T15:9:26
1. Geometric Methods (Geometry)
Archimedes’ Polygon Method (250 BC)
Archimedes approximated π using a geometric approach by circumscribing and inscribing polygons inside a circle. The perimeter of these polygons gives the bounds of π. The higher the number of sides the polygon has, the better the approximation.
n × sin(π/n) < π < n × tan(π/n)
As the number of polygon sides (n
) increases, the approximation improves, but convergence is slow.
Speed/Convergence level: ⭐☆☆☆☆ (Very Slow)
Code
import math
def archimedes_pi(n_sides=96):
theta = math.pi / n_sides
inner_approx = n_sides * math.sin(theta)
outer_approx = n_sides * math.tan(theta)
return (inner_approx, outer_approx)
if __name__ == "__main__":
low, high = archimedes_pi(96)
print(f"Archimedes (n=96): {low:.6f} < pi < {high:.6f}")
# archimedes(n=96): 3.141032 < pi < 3.142715
2. Infinite Products
2.1 Viète’s Formula (1593)
Viète derived an elegant infinite product for π
2/π = √2/2 × √(2+√2)/2 × √(2+√(2+√2))/2 × ...