graduapp.com

Exploring the Fascinating Methods of Calculating Pi

Written on

Chapter 1: The Celebration of Pi Day

Every year, on March 14, we honor Pi Day, particularly at Uber Amsterdam. This year, we intended to celebrate on Friday by exploring various algorithms using PyAlgoViz. However, due to the pandemic, our in-person festivities were replaced by a virtual gathering with the Amsterdam Tech Team. We conducted a few live estimations, and the outcomes are documented below.

In 2006, Akira Haraguchi impressively recited 100,000 digits of Pi from memory, a feat that took him 16 hours. How many digits can you recall?

This article presents diverse methods for calculating Pi, accompanied by visual demonstrations.

Archimedes's Method

Archimedes first approximated Pi by estimating the circumference of a circle, a technique dating back over 2,200 years. His algorithm was a groundbreaking iterative process that refined each approximation. Previous estimations had approximated Pi to values like 3 or 256/81 (which equals approximately 3.1604), which sufficed for many years.

In 1850, William Shanks dedicated 15 years to calculating Pi to 707 digits, only to discover an error at the 527th digit. This certainly puts our leisure activities into perspective!

A simplified version of Archimedes's method can be found at PyAlgoViz, where the estimation runs in N steps, doubling the number of inscribed triangles within the circle with each iteration. Each triangle's shorter edge length is computed using square roots, a challenging task without modern technology.

The first video, The Discovery That Transformed Pi, illustrates Archimedes's contributions and the significance of his calculations.

Estimating Pi with Inscribed Polygons

In step 2 of Archimedes's approach, we use 8 rectangles to estimate Pi, yielding a value of 3.12144515226. As we add more triangles, our approximation improves. By step 6, with just 128 triangles, we get an estimate of 3.14127725093—remarkably close! After 28 iterations, we achieve 15-digit precision, sufficient for planetary navigation.

Gregory-Leibniz Series

Later mathematical advancements allowed the iterative method of Archimedes to be expressed as an alternating series. This series converges to Pi, albeit slowly, requiring many computations for accuracy.

A visual representation of this incremental approach can also be viewed on PyAlgoViz, where you can interactively explore how each step brings us closer to Pi.

The second video, Calculating π by hand, provides a practical demonstration of this series and its applications.

Monte Carlo Simulation

The fixed ratio between a circle's circumference and its radius is the foundation of the Monte Carlo Simulation for estimating Pi. This method involves random sampling—akin to throwing darts at a board. In a demonstration at PyAlgoViz, we randomly selected points inside a square, noting that 3,942 landed inside the circle, leading to an estimate of Pi as 4 * 3,942 / 5,000 = 3.1536. The accuracy improves with more random throws.

In our planned experiment at Uber Amsterdam, we intended to use a large cardboard board, allowing colleagues to randomly throw darts to approximate Pi. Unfortunately, due to the pandemic, we postponed this hands-on activity.

Buffon's Needle

Buffon's method for estimating Pi also employs randomness. This involves dropping needles onto a table with parallel lines drawn at a distance related to the needle's length. By counting how many needles intersect these lines, we can derive an estimate of Pi.

Our experiments yielded estimates of 3.12, 3.12, 3.27, and even 4.0—though the last was due to a lack of randomness in the throws.

Conclusions

Pi is a remarkable number, appearing in unexpected contexts. Some individuals have committed hundreds of thousands of digits of Pi to memory or computed it to trillions of digits. While the practical need for such precision can be debated, NASA's calculations for lunar and Martian missions only require 15 digits—3.141592653589793. Interestingly, Python's built-in function for Pi offers the same accuracy.

Happy Pi Day

March 14 is not only Pi Day but also the birthday of renowned figures like Albert Einstein and Stephen Curry. My birthdate coincidentally appears at position 95,062,032 of Pi—what about yours?

Happy Pi Day, everyone!

Share the page:

Twitter Facebook Reddit LinkIn

-----------------------

Recent Post:

# Catastrophic Cosmic Event May Have Annihilated Ancient City

New evidence suggests a massive cosmic explosion may explain a historical gap in the Jordan Valley and the tale of Sodom and Gomorrah.

Mind-Blowing Psychology Experiments That Will Change Your Perspective

Explore 25 fascinating psychology experiments that reveal profound insights into human behavior and the complexities of the mind.

Unlocking the Secrets of LLM Knowledge: A Deep Dive

Exploring the scaling laws of LLMs and their knowledge capacity, examining the relationship between data, parameters, and model performance.

Reimagining Economic Discourse Through Empathy and Collaboration

A letter exploring the integration of social ontology and empathy into economic policies and education.

The Challenge of Colonizing Mars and Beyond: A Realistic Outlook

Exploring the realistic challenges of colonizing Mars and the potential for interstellar travel.

Working and Living Abroad: 10 Essential Considerations

Explore vital factors to think about before pursuing a remote lifestyle in your dream destination.

Intriguing Images of Nature and Biology: A Visual Journey

Explore fascinating images showcasing the wonders of nature and unique biological phenomena in this captivating visual narrative.

# Enhancing Your Solo Business Through Meditation Practices

Discover how meditation can elevate your solo business through improved health, emotional regulation, and creative visualization.