Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Pi Revealed in a Pile of Toothpicks

Coding Train via YouTube

Overview

Discover how to approximate the value of pi using toothpicks in this 25-minute coding tutorial. Learn about Buffon's Needle problem and implement a simulation using p5.js. Explore the mathematical concepts behind the experiment, including probability density functions and area calculations. Follow along as the instructor guides you through coding the simulation, from drawing vertical lines to determining toothpick intersections. Improve your understanding of geometric probability while creating an engaging visual representation of this classic mathematical problem. Gain insights into potential variations of the experiment and explore additional resources for further learning.

Syllabus

Happy Pi Day 2023!
Introduce Buffon's Needle
Unpack the math
Let toothpick fall at an angle
The probability that the toothpick crosses the border
Uniform probability density function
Illustrate the probablity with a graph
Approximating the value of Pi
Calculating the area under the curve
Resources for Buffon's Needle
Start Coding
Draw vertical lines
Add a toothpick
Draw background in setup
We have to use the built-in value of Pi
Find the closest column
Determine if the toothpick intersects the column
Rotate the line relative to the y-axis
Draw the toothpick as a vertical line
Improve the visuals
Approximate the value of Pi using the probility that a toothpick intersects a column
Suggestions for variations
New Passenger Showcase page on the Coding Train website
Easter egg

Taught by

The Coding Train

Reviews

5.0 rating, based on 1 Class Central review

Start your review of Pi Revealed in a Pile of Toothpicks

  • Batocabe, Nerds C.
    "Pi Revealed in a Pile of Toothpicks" is a captivating exploration of mathematics and artistry intertwined. Through the lens of simple toothpicks arranged in patterns, the documentary delves into the profound complexity of Pi, revealing its omnipresence in nature and human creations. With stunning visuals and accessible explanations, it demystifies the enigmatic nature of this irrational number, making it accessible to both mathematical enthusiasts and novices alike. The film not only educates but also inspires, showcasing how a seemingly mundane object can unlock the secrets of the universe. It's a mesmerizing journey that leaves viewers in awe of the beauty and intricacy of mathematics.

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.