Skip to content

Estimation of the irrational number pi by utilizing the Monte Carlo Algorithm.

Notifications You must be signed in to change notification settings

stevensikorski/estimate-pi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Monte Carlo Algorithm to Estimate Pi (π)

The Monte Carlo Algorithm interprets the probability of a randomized algorithm. Its funnily named after the famous casino in Monte Carlo, Monaco. The basis of estimating pi with this algorithm utilizes concept of a circle inscribed in a square. It interprets the ratio of randomly plotted points inside the circle to overall points plotted within the square. By multiplying this ratio by four (4), we get a very close estimation of the irrational number pi. More knowledge can be found here:
Monte Carlo Algorithm

montecarlo.cpp

This program utilizes C++ object-orientated programming in order to estimate pi. The user must input a given number of points within the square. This allows the backend of the Monte Carlo Algorithm to calculate this estimation. Thus giving a result of the estimate of pi, value of pi, and a percent error that is all outputted within the command-line interface.

Compiling

git clone https://github.com/stevensikorski/estimate-pi.git
cd estimate-pi
g++ montecarlo.cpp
./a.out

About

Estimation of the irrational number pi by utilizing the Monte Carlo Algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages