0% found this document useful (0 votes)
15 views5 pages

Estimate Pi with Monte Carlo Method

Uploaded by

akash.stha444
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views5 pages

Estimate Pi with Monte Carlo Method

Uploaded by

akash.stha444
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1

TITLE : TO DETERMINE THE VALUE OF PI USING MONTE


CARLO SIMULATION

OBJECTIVE:
The objective of this experiment is to determine the value of π (PI) using the
Monte Carlo simulation method. This stochastic method solves mathematical problems
that may be deterministic in nature by approximating mathematical constants through
random sampling.

THEORY :
It is a computerized mathematical technique to generate random sample data based on some
known distribution for numerical experiments. This method is applied to risk quantitative
analysis and decision making policies.
This method is used by the professionals of various profiles such as finance, project
management, energy, manufacturing, engineering, research, & development, transportation
etc.

A r e a o f q u a d r a n t o f C ir c le N o . o f p o i n t s in s id e t h e c ir c le
=
Ar e ao f squ ar e N o . o f p o in t s i n s i d e t h e s q u a r e
πr2 n
or , =
(2 r 2) N
π
o r , =f r a c n N
4
T h e r e f o r e , π=4∗f r a c n N

The idea is to simulate random (x, y) points in a 2-D plane with domain as a square of side 2r
units centered on (0,0). Imagine a circle inside the same domain with same radius r and in-
scribed into the square. We then calculate the ratio of number points that lied inside the circle
and total number of generated points(inside the square).
2

ALGORITHM:
1. Initialize circle_points, square_points and interval to 0.
2. Generate random point x.
3. Generate random point y.
4. Calculate d = x*x + y*y.
5. If d <= 1, increment circle_points.
6. Increment square_points.
7. Increment interval.
8. If increment < NO_OF_ITERATIONS, repeat from 2.
9. Calculate pi = 4*(circle_points/square_points).
10. Terminate.
3

OUTPUT:
About 1056 square points and circle points were taken for the simulation but only 30 points
are shown in the output.
4
5

CONCLUSION:
An efficient way to estimate the value of π is through Monte Carlo simulation. In this experi-
ment, we estimated π using 1000 random points. The result was remarkably close to the ac-
tual value of π, demonstrating the effectiveness of this method.

You might also like