ScratchData LogoScratchData
Back to ivan321's profile

Approximating Pi by Counting Collisions

IVivan321•Created March 16, 2019
Approximating Pi by Counting Collisions
47
34
667 views
View on Scratch

Instructions

This project approximates pi by simulating the motion of two perfectly elastic objects on a frictionless plane. Counting the number of times object 1 touches either object 2 or the screen's left edge yields a surprising approximation of pi! The ratio of the masses of object 1 and object 2 (in powers of 100) determines the number of digits in the pi approximation. Press 1, 2, 3, 4, 5, or 6 to see simulations at ratios of 1 to 100^0, 100^1, 100^2, 100^3, 100^4, and 100^5, yielding 1, 2, 3, 4, 5, or 6 digits of pi, respectively.

Description

This was inspired and informed by Daniel Shiffman's Javascript simulation of the same phenomenon: https://youtu.be/PoW8g67XNxA ...which was in turn inspired by this amazing YouTuber: https://youtu.be/HEfHFsfGXjs I don't pretend to fully understand the math at work here, but the graph up top shows the relationship between the velocities of the two objects. Its circular shape is dictated by the formula for conservation of energy in elastic collisions: m1*v1^2 + m2*v2^2 = a constant (which is essentially the formula for a circle: x^2 + y^2 = a constant). The collisions divide up the circle at regular intervals, which get smaller and smaller as the number of collisions increases.

Project Details

Project ID294568219
CreatedMarch 16, 2019
Last ModifiedJune 29, 2019
SharedMarch 17, 2019
Visibilityvisible
CommentsAllowed