Buffon’s Needles simulation in Processing

Buffon’s Needle is a famous way to (slowly) estimate \pi.
Here’s a processing.org program to calculate \tau (to keep the math-hipster hatred of \pi-day at a critical point and concave up).

Link to live simulation and code. All variables are easy to change, size of window, length of needle, spacing of lines, etc.

2014-03-14_12h23_26

Neat program to write. Funnily enough, the code wasn’t working in the javascript version of processing because javascript didn’t understand the constant TAU. Ha.

note: I got the graph idea at the bottom idea from this sketch, but I never looked at the actual code.

This entry was posted in Full Posts and tagged , , , . Bookmark the permalink.

One Response to Buffon’s Needles simulation in Processing

  1. Pingback: 109 – Pi day | 180 Classroom Photos

Leave a Reply

Your email address will not be published. Required fields are marked *