## How you can determine a value of pi,the mathematical wonder.

Posted by tendstoinfinity on January 23, 2011

“PI” is one of the beauty mathematics has given the world. can you find the value of this mathematics marvel.

first I am giving a simple sentence which will help you to memorize the value of to13 places of decimal. Simply you have to count the number of letters in the following sentence.

**Why I want 2 learn calculate pi, for I have a large spherical shape**

= 3.1415923141595

But have you ever thought how we can calculate the value?

We want to find the area of a circular region of radius 1cm. Obviously we can easily find it out by the formula

“Area of the circular region = “so the area of our region will be

Now can we use a little bit of “*probability theory*” and the above to determine the value .

Suppose we throw a tiny particle in square of side 2 units in which a circle of radius 1 unit is inscribed(see the fig. below) What is the probability that the particle will fall inside the circle, it is supposed that falling of the stone at every point of square is equally likely.

Required probability = area of circular region/area of square region

=

Suppose the stone falls 75 times in the circular space and 25 times in the empty space in hundred throws. So by definition of probability will be . These two values should be equal.

i.e =

We can calculate the value for from this. Surely the value will be more accurate if we throw the stone a great number of times. Obviously the experiment will take a lot of time. So we want to speed it up. we construct a mathematical model of the above experiment. considering a quadrant of the circle (you can use b’coz circle is symmetric) we will have the same effect. so we are taking only the 1st quadrant of . let the stone falls on an arbitrary point P(x,y) in the the part of the square in 1st quadrant,surely and . If then the point will be inside the quadrant of circle otherwise exterior to the circle.

this is the mathematical model of the experiment. Now instead of performing the actual experiment we can calculate the results of the experiments directly using pen and paper, all we need a set of random numbers between 0 and 1. but it is very tough to calculate all these manually. instead use a computer programme. you can use any computer programming language. I have used the C programming language. copy the following and compile and run in any C compiler.

**C programme for calculate the pi**

#### #include<stdio.h>

#### #include<conio.h>

#### #include<stdlib.h>

#### double pi()

#### {

#### long int z;

#### double x,y,P,N,n=0,b=0,a;

#### printf(“How many times you want to throw?\n”);

#### scanf(“%ld”,&z);

#### for(N=1;N<=z;N++)

#### {

#### x=rand();

#### x=x/32767.0;

#### y=rand();

#### y=y/32767.0;

#### a=(x*x)+(y*y);

#### if(a>1)

#### b=b+1;

#### else

#### n=n+1;

#### }

#### N=N-1;

#### P=(n/N)*4;

#### return P;

#### }

#### void main()

#### {

#### double p;

#### clrscr();

#### p=pi();

#### printf(“\n Value of pi is %lf”,p);

#### getch();

#### }

*you can throw as many times as you wish. hope this is working on your machine. Good day.*

## Leave a Reply