# Shotgun Pi

18 Feb 2020Monte Carlo is a beautiful process that can be used to address many, many problems. One of my favorites is that it can be used to estimate the value of [latex]\pi[/latex]. First of all, we know that [latex]\pi[/latex] is the ratio between the radius of a circle, squared, and its area. We can use that to Monte Carlo to estimate this ratio.

If you are not familiar with the Open Science Grid (OSG), it is a large high-throughput computer available as a national user facility. Unlike some other supercomputer facilities, the OSG is not intended for tightly-coupled jobs. And calculating [latex]\pi[/latex] via Monte Carlo is a very loosely-coupled job. In fact, one of the samples for using the OSG in R is exactly this.

About a year ago, I redid the sample using the newish programming language Rust. Rust is getting a lot of press as a new systems programming language and a lot of its memory safety features. I think this makes it a good candidate for numerical programming. So I ported the R example over to Rust, which required a bit of work, but was doable. You can see the result here:

## Using Rust on the Open Science Grid

I will admit that the Rust programming language fascinates me. It's got all the things I want in a programming language, that I normally get from C, and also gives me some measure of protection against really screwing up. Not that I do that much...or even have a use for, anymore.

Of course, there’s nothing quite like a physical analog, and this physicist decided to use a shotgun to replicate the Monte Carlo approach!

## Calculate Pi with a Shotgun

Support on Patreon: https://www.patreon.com/profkeester?ty=h Subscribe: https://www.youtube.com/user/ProfKeester Inspired by the Physicsgirl and Veritasium, ...

Do not try this at home.