Skip to content

albertliangcode/Pi_MonteCarloSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pi_MonteCarloSim

3/26/15 Albert Liang

Approximates Pi using a simple Monte Carlo method. User can adjust accuracy by controlling how many samples are taken before the final calculation.

s_mcPi.py is a modified version of mcPi.py that generates two extra files: mcPi_Data.dat and mcPi_Report.txt. The .dat file stores the approximations of multiple trials. The .txt file displays the mean, standard deviation, relative error, and expected relative error of all the trials.

This is about 2 weeks late for the Pi day of the century, but still, Happy Pi Day!

A Monte Carlo method is any algorithm that draws random samples over and over again to do some sort of computation. It's a great family of tools when you need to, for instance, optimize something or create a probability distribution. For info on Monte Carlo methods, this is a nice jumping-off point: en.wikipedia.org/wiki/Monte_Carlo_method

About

A simple monte carlo approximation of Pi.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages