Buffon's Needle Simulation
Like Derek Mata

Buffon's Needle Simulation

Buffon's Needle Simulation

Description:

Published: April 7, 2021 1 0 12
By: Derek Mata, Cal Poly Pomona
Category: Computer Science
Hashtags: #Coding #Programming #Statistics

In short, the Buffon's Needle problem is a classical statistics problem in which the probability of a person randomly throwing a needle (stick in this case) across the room will land on the edge of a wooden plank. The wooden planks in this problem are vertical and are infinitely long. Please check the provided wikipedia pager for more information on the problem.

Using C++, I created a program that simulates Buffon's Needle problem. This program gets the user input for the width of stick thrown, and the width of the wooden plank. The user is then asked to enter a number of simulations they would like to run of the problem. The program calculates how many needles land on the edge of a plank and lists the distance of the closest end point of the stick to the closest plank edge and the angle at which the stick lies relative to the plank edge. Finally, the experimental probability is displayed to the user.

Likers

Derek Mata