Consider tossing two dice with faces labelled 1, 2 and 3. (a) What is the probability distribution of the sum of the values? (b) Use Matlab to simulate the tossing of these 2 dice for 10,000 times. Plot the histogram of the sum face values. From the simulation, estimate the probability of the sum face values in part (a). (Hint: use the function randi() to simulate pseudorandom integers.)
(a)
There are 2 die with faces labelled 1, 2 and 3
Total possible combinations of tossing 2 die = 3*3 = 9
Possible sum obtained by tossing 2 die : {2,3,4,5,6}
Total possible combinations of obtaining sum 2 : {{1,1}} =
1/9
Total possible combinations of obtaining sum 3 : {{1,2},{2,1}} =
2/9
Total possible combinations of obtaining sum 4 :
{{2,2},{1,3},{3,1}} = 3/9
Total possible combinations of obtaining sum 5 : {{2,3},{3,2}} =
2/9
Total possible combinations of obtaining sum 6 : {{3,3}} = 1/9
Probability distribution is P(x):
1/9 , if x={2,6}
2/9 , if x={3,5}
3/9 , if x={4}
(b)
% Matlab script to simulate the tossing of 2 dice(3 sided) for
10,000 times
% Plot the histogram of the sum face values.
% From the simulation, estimate the probability of the sum face
values
% get the result of sum of simulating 2 3-sided die 10,000
times
rolling_2_dice_sum =
randi([1,3],1,10000)+randi([1,3],1,10000);
% vector to contain the frequency of occurence of the each possible
sum
count_sum_face_values = zeros(1,5);
% loop to get the number of times each sum occurs
for i=1:length(rolling_2_dice_sum)
count_sum_face_values(rolling_2_dice_sum(i)-1)=
count_sum_face_values(rolling_2_dice_sum(i)-1) + 1;
end
% calculate the probability distribution of the sum face
values
probability_dist = count_sum_face_values ./
sum(count_sum_face_values);
% output the probability distribution of the sum face values
fprintf('Probability distribution :\n%10s
%10s\n','Sum','Count');
for i=1:length(count_sum_face_values)
fprintf('%10d %10.4f\n',(i+1),probability_dist(i));
end
% plot the histogram bar chart
bar((2:6),count_sum_face_values);
title('Histogram of the sum face values');
xlabel('Sum');
ylabel('Frequency of occurrence');
%end of script
Output:
Consider tossing two dice with faces labelled 1, 2 and 3. (a) What is the probability...
Simulate rolling two, fair, six-sided dice 10000 times and adding the "up" faces together each time using the "Dice Generator." Plot a relative frequency histogram of the results. Please note that your data will be randomly generated; therefore, select the answer below that is most similar to the histogram that you generated from your random data. If this is challenging, consider all four simulation questions in this assignment at the same time and look for the expected pattern in the...
the question is to simulate the result of tossing n die and generate a probability graph based on your simulation in python3 the result is supposed to be normal distribution, but mine isn't. i would like to know what's wrong in my code. def roll_and_add_dice(num_dice, num_trials = 10**6): outcomes = [] sum_of_die = 0 for j in range(num_trials): for i in range(num_dice): sum_of_die += randint(1,7) outcomes.append(sum_of_die) sum_of_die = 0 return outcomes # Your code here show_distribution (roll_and_add_dice(2), title='Probability Distribution for...
Can someone help me to solve it by Matlab? ) Many dice games use two 6-sided dice, where each side faces up with equal probability, each turn consists of rolling both dice, and where the SUM of the two dice values is the outcome used in the game. Figure out how to simulate 3600 such die rolls, and then to make a nicely designed histogram displaying the outcomes as a PERCENT of the total rolls
In the following examples, you are asked to do a simulation, calculate a relative frequency probability and compare it to a theoretical probability. Begin with the following simulation: Use MATH ► PRB ► RandInt function on your calculator to simulate tossing a 10-sided die 250 times and store the results in L1. Do a second simulation of tossing another 10-sided die 250 times and store the results in L2. Add the outcomes of the two simulations and store the results...
Question 1 In role-playing games, such as the original, Dungeons and Dragons, gamers use a variety of dice shapes, not just the standard cube. For example one version of a d10' has ten faces numbered 0,1,2,. .. ,9, and each face is equally likely to become the top face (the face that is read) when the die is 'thrown'. Suppose gamer Alice does not have one of these dice but does have a d6 (i.e. a regular cubic die with...
Consider two fair, FOUR sided dice, with faces labeled 1, 2, 3, 4. Compute the probability of rolling a) a sum of 3 b) a sum of 6 c) a sum of 9 d) the most likely sum(s) along with its probability.
Please show your work. Tossing 2 regular dice (each has 6 faces), find the probability for getting nine dots.
Consider three six-sided dice, and let random variable Y = the value of the face for each. The probability mass of function of Y is given by the following table: y 1 2 3 4 5 6 otherwise P(Y=y) 0.35 0.30 0.25 0.05 0.03 0.02 0 Roll the three dice and let random variable X = sum of the three faces. Repeat this experiment 50000 times. Find the simulated probability mass function (pmf) of random variable X. Find the simulated...
Write a Code in Java or Python, for the following scenario(s): Consider three six-sided dice, and let random variable Y = the value of the face for each. The probability mass of function of Y is given by the following table: y 1 2 3 4 5 6 otherwise P(Y=y) 0.35 0.30 0.25 0.05 0.03 0.02 0 Roll the three dice and let random variable X = sum of the three faces. Repeat this experiment 50000 times. Find the simulated...
This problem investigates how you can use random numbers to simulate a computer dice game write a function called twooice that simulates the rolling of two sik-sided dice. The function takes no inputs. Instead, it generates two random integers between 1 and 6, and output their sum. You may submit your work as many times as you want Try to get 100%) Your Function MATLAB Documentation Reset Code to call your function C Reset 1s-tuoDice ss-twoDice This problem investigates how...