Solve Dice Probability Homework - Mean, Standard Deviation

In summary, to simulate rolling two dice and find the mean and standard deviation after 100 rolls, you can use the following steps: 1. Generate two random numbers between 1 and 6, representing the roll of each die. 2. Add the two numbers together to get the result of the roll. 3. Repeat this process 100 times. 4. Calculate the mean by adding up all 100 results and dividing by 100. 5. Calculate the variance by subtracting the mean from each result, squaring the difference, and adding all these values together. 6. Divide the variance by 100 to get the standard deviation.
  • #1
iRaid
559
8

Homework Statement



Well I need to design a program that simulates rolling 2 dice. After the dice have been rolled 100 times, I need to find the mean and standard deviation of each (from the data that I get from the simulation). I can't seem to figure out how to do this.. Seems simple right?

Homework Equations


The Attempt at a Solution



Lead me in the right direction, thanks lol.

Edit if it's not clear...

The data is as shown:
Number-Frequency
2-w/e
3-w/e
4-w/e
5-w/e
6-w/e
...so on
 
Physics news on Phys.org
  • #2
iRaid said:

Homework Statement



Well I need to design a program that simulates rolling 2 dice. After the dice have been rolled 100 times, I need to find the mean and standard deviation of each (from the data that I get from the simulation). I can't seem to figure out how to do this.. Seems simple right?

Homework Equations





The Attempt at a Solution



Lead me in the right direction, thanks lol.

Edit if it's not clear...

The data is as shown:
Number-Frequency
2-w/e
3-w/e
4-w/e
5-w/e
6-w/e
...so on

Yes, it does seem pretty straightforward. What computer language are you coding in? C? Excel? Other?

How do you generate a random number in that language? There should be some sort of random number function call...

So can you at least do the part that generates the pair of random numbers and adds them up?

And what sort of array would you declare to store the results in?
 
  • #3
berkeman said:
Yes, it does seem pretty straightforward. What computer language are you coding in? C? Excel? Other?

How do you generate a random number in that language? There should be some sort of random number function call...

So can you at least do the part that generates the pair of random numbers and adds them up?

And what sort of array would you declare to store the results in?

It's in visual basic and I have it done, I just need to figure out the math behind it, it seems easy I just can't think of it.
 
  • #4
iRaid said:
It's in visual basic and I have it done, I just need to figure out the math behind it, it seems easy I just can't think of it.

Can you post your code? Be sure to use "code" tags to preserve the indentations.

What math are you asking about? How to generate random numbers? How to calculate a Mean and Standard Deviation?
 
  • #5
I'd rather not post the code. All it does is generate data from the number you role and the frequency it is rolled. (100 times)

The only thing I need is how to calculate the mean and standard deviation from data. (For example, if you had a excel sheet with both of those, how would I calculate the mean and standard deviation)
 
  • #6
iRaid said:
I'd rather not post the code. All it does is generate data from the number you role and the frequency it is rolled. (100 times)

The only thing I need is how to calculate the mean and standard deviation from data. (For example, if you had a excel sheet with both of those, how would I calculate the mean and standard deviation)

In Excel, there are standard math functions that you can use to calculate Mean and Standard Deviation of a selected group of cells.

In many programming languages, there will be library function calls that you can use. But it sound like in this assignment you are supposed to just do it with basic math operations. Here is how you do it:

http://en.wikipedia.org/wiki/Standard_deviation

BTW, what do you predict the Mean will be?
 
  • #7
The mean and standard deviation of what? Perhaps the sum of the numbers on the two dice?
 
  • #8
The mean will be around 6... I looked at that not sure how to implement it into a set of data.

@rcgldr, I'm not sure what either, the example has 6.7 as the mean and standard deviation as 2.5 so I really don't know
 
  • #9
iRaid said:
The mean will be around 6... I looked at that not sure how to implement it into a set of data.

What do you mean you're not sure? The Mean calculation is easy, right? Just add up the 100 roll results and divide by what?

And the wikipedia page shows how to calculate the Standard Deviation. Why can't you just do that on your data? Do you store the data in an array?
 
  • #10
berkeman said:
What do you mean you're not sure? The Mean calculation is easy, right? Just add up the 100 roll results and divide by what?

And the wikipedia page shows how to calculate the Standard Deviation. Why can't you just do that on your data? Do you store the data in an array?

The standard deviation is my only problem, I have never done it in math before and I see the formula and understand it, just not when applied to a set of data (I've done calc tho..).


And yes my data is in an array.
 
  • #11
How did you end up calculating the mean? Describe what you did in detail. Calculating the standard deviation is pretty similar.
 
  • #12
I attached an excel sheet with what I did, the standard deviation is wrong, I'm not sure how to do it manually (without excel commands)

Can someone tell me what's wrong..?
 

Attachments

  • meanstd.xls
    20.5 KB · Views: 225
  • #13
OK, to calculate the mean, you did this:
$$\bar{x} = \frac{x_1 + x_2 + \cdots + x_N}{N} = \frac{n_2\times 2 + n_3 \times 3 + n_4 \times 4 + \cdots + n_{12} \times 12}{N}$$ where N is the total number of rolls and nx is the number of times you rolled x. It makes sense, right? You rolled a two n2 times, so it contributes ##2\times n_2## to the total and so on.

Now the standard deviation is the square root of the variance ##\sigma^2##, and the variance is given by
$$\sigma^2 = \frac{(x_1 - \bar{x})^2 + (x_2 - \bar{x})^2 + \cdots + (x_N - \bar{x})^2}{N} = \frac{n_2\times(2-\bar{x})^2 + n_3\times(3-\bar{x})^3 + \cdots + n_{12}\times(12-\bar{x})^2}{N}.$$ Again, this should make sense. There will be n2 terms in the numerator which equal ##(2-\bar{x})^2## and so on. Compare that last formula to what you're calculating on your spreadsheet, and you should see that you're not implementing the formula correctly.
 
  • #14
vela said:
OK, to calculate the mean, you did this:
$$\bar{x} = \frac{x_1 + x_2 + \cdots + x_N}{N} = \frac{n_2\times 2 + n_3 \times 3 + n_4 \times 4 + \cdots + n_{12} \times 12}{N}$$ where N is the total number of rolls and nx is the number of times you rolled x. It makes sense, right? You rolled a two n2 times, so it contributes ##2\times n_2## to the total and so on.

Now the standard deviation is the square root of the variance ##\sigma^2##, and the variance is given by
$$\sigma^2 = \frac{(x_1 - \bar{x})^2 + (x_2 - \bar{x})^2 + \cdots + (x_N - \bar{x})^2}{N} = \frac{n_2\times(2-\bar{x})^2 + n_3\times(3-\bar{x})^3 + \cdots + n_{12}\times(12-\bar{x})^2}{N}.$$ Again, this should make sense. There will be n2 terms in the numerator which equal ##(2-\bar{x})^2## and so on. Compare that last formula to what you're calculating on your spreadsheet, and you should see that you're not implementing the formula correctly.

Thank you so much. That's what I needed.
 

1. What is the mean in dice probability?

The mean in dice probability refers to the average value that is expected when rolling a fair dice multiple times. It is calculated by adding up all the possible outcomes and dividing by the total number of outcomes.

2. How do you calculate the standard deviation in dice probability?

The standard deviation in dice probability measures how much the outcomes vary from the mean. It is calculated by taking the square root of the sum of the squared differences between each outcome and the mean, divided by the total number of outcomes.

3. Are mean and standard deviation important in dice probability?

Yes, mean and standard deviation are important in dice probability as they provide information about the central tendency and spread of the outcomes. They can help in making predictions and analyzing the likelihood of certain outcomes.

4. How does the number of dice affect the mean and standard deviation?

The number of dice rolled can affect the mean and standard deviation. As the number of dice increases, the mean tends to approach the expected value (3.5 for a single dice) and the standard deviation decreases as the outcomes become more consistent.

5. Can mean and standard deviation be used to determine the fairness of a dice?

No, mean and standard deviation cannot be used to determine the fairness of a dice as they only provide information about the expected outcomes and variability. Other factors such as the material and shape of the dice can also affect the fairness.

Similar threads

  • Precalculus Mathematics Homework Help
2
Replies
53
Views
5K
  • Precalculus Mathematics Homework Help
Replies
2
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
  • Precalculus Mathematics Homework Help
Replies
11
Views
2K
  • Precalculus Mathematics Homework Help
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
11
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
2K
  • General Math
Replies
2
Views
801
  • Precalculus Mathematics Homework Help
Replies
2
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
846
Back
Top