Question:
If you roll a die n times, what is the expected value
for the sum of the faces? Write a MATLAB program that finds the
expected value of die rolling experiment.
1.[%50] Geometrical Approximation of Pi Random numbers offer an interesting strategy for approximating the value of x. Imagine that you have a green dartboard hanging on your wall that consists of a circle painted on a square backdrop, as in the following diagram: What happens if you throw a sequence of darts completely randomly, ignoring any darts that miss the board altogether? Some of the darts will fall inside the green circle, but some will be outside the circle in the white corners of the square. If the throws are random, the ratio of the number of darts landing inside the circle to the total number of darts hitting the square should be approximately equal to the ratio between the two areas. The ratio of the areas is independent of the actual size of the dartboard, as illustrated by the formula darts falling inside the circle darts falling inside the square area inside the circle area inside the aquare To simulate this process in a program, imagine that the dartboard is drawn on the standard Cartesian coordinate plane with its center at the origin and a radius of 1 unit. The process of throwing a dart randomly at the square can be modeled by generating two random numbers, X and y, each of which lies between-1 and +1. This (x, y) point always lies somewhere inside the square. The point (x, y) lies inside the circle if √x² + y² <1 This condition, however, can be simplified considerably by squaring each side of the inequality, which yields the following more efficient test: x² + y² <1 If you perform this simulation many times and compute what fraction of the darts falls inside the circle, the result will be an approximation of z/4. Write a MATLAB program that simulates throwing 10,000 darts and then uses the results to display an approximate value of x. Don't worry if your answer is correct only in the first few digits. The strategy used in this problem is not particularly accurate, even though it often provides useful approximations. In mathematics, this technique is called Monte Carlo integration, after the capital city of Monaco, famous for its casinos.
2. [%50] Expectation When you roll a fair die you have an equal chance of getting each of the six numbers 1 to 6. The expected value of your die roll, however, is 3.5. But how can this be? That number isn't even on the die! In probability theory the expectation or expected value is an idealized average that reflects the probability of the possible outcomes of something. In our die example, each of the six numbers has a probability of 1/6thof being rolled. This means that if you roll the die lots and lots of times, you should see a 1 in roughly 1/6/of all the rolls, a 2 in roughly 1/6th of all the rolls, a 3 in roughly 1/6thof all the rolls, and so on. So, if you have rolled the die times, then each of the numbers comes up roughly "/imes. The number you get when averaging all the outcomes of the rolls is therefore roughly equal to (n/6x1+n/6x2+n/6x3+n/6x4+n/6x5+n/6x6) A- - (1+2+3+4+5+6)/6-3.5. The strong law of large numbers says that the larger the number, the closer the actual average gets to 3.5. The number 3.5 is, in a sense, the average you'd get if you'd rolled the die an infinite number of times. The same idea works more generally. Suppose your die is not fair, so the six numbers don't all have the same probability of coming up. Suppose the probability of a 1 is P1, the probability of a 2 is P2, and so on. The average outcome of a large number of rolls is then roughly (p₁n x1 + ₂ x 2 + pn x3+p₁n x4 + pn x5 + x 6) 71 = P₁x1+p2x2+ps x 3 + px 4+ps x 5+px6 This is the idea behind the general definition of expectation. If a random variable has m possible outcomes up to X, with corresponding probabilities Pup to P, then the expected value of the outcome is
1.[%50] Geometrical Approximation of Pi Random numbers offer an interesting strategy for approximating the value of x. I
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am