Monte Carlo methods use random values to generate something that is not random. So today, I will use Excel to generate random numbers and then calculate the value of Pi, which is approx. 3.14. Pi is used to measure the area of a circle. Basically what our plan is to generate a circle with radius 1.0 from the origin and from the equation of a circle (Area = Pi*r*r) we can see that the area of a circle with radius 1 is Pi. We will use excel to generate random values for X-Coordinate and Y-Coordinate and then graph them. What you will see after you graph the (x,y) is a rectangle, with length 2 and width 2. Next we will separate the values for (x,y) that hit inside the circle with radius 1 from the ones that hit outside of the circle. We can do that by using the formula X^2 + Y^2 = R^2. Afterward, we will calculate the area of the circle and area of the rectangle. From their we will calculate the value of Pi.
In C Plus Plus, C Sharp, Java, PHP, Algorithms, Computer Science and more.... By Gurpreet Singh
Showing posts with label Probability And Statistics. Show all posts
Showing posts with label Probability And Statistics. Show all posts
Wednesday, July 3, 2013
Tuesday, June 18, 2013
Sample Spaces and The Algebra of Sets | Probability And Statistics Tutorial
Before being introduced to probability, you need to be familiar with Sample Spaces and the Algebra of sets. Sample Spaces is referred to the potential outcomes of an event. To understand better, consider the following examples:
What is the sample space of the experiment of flipping a coin 3 times?
Basically you are going to flip a coin three times and record outcome of each toss and the ordered triples would be your sample outcome.
Sample Space, S, = {HHH, HHT, HTH, THH, HTT, THT, TTH, TTT}.
What is the sample space for choosing an even number from 0 to 10 at random?
S = {2, 4, 6, 8, 10}.
What is the sample space of the experiment of flipping a coin 3 times?
Basically you are going to flip a coin three times and record outcome of each toss and the ordered triples would be your sample outcome.
Sample Space, S, = {HHH, HHT, HTH, THH, HTT, THT, TTH, TTT}.
What is the sample space for choosing an even number from 0 to 10 at random?
S = {2, 4, 6, 8, 10}.
Subscribe to:
Posts (Atom)