The next program finds all possible outcomes in the experiment of throwing two dice. Then, it calculates
Question:
The next program finds all possible outcomes in the experiment of throwing two dice. Then, it calculates the number of outcomes in which the sum of the dice equals six as well as the probability of that event.
In[1]:= m=6;n=6;
twodice=Flatten[Table[{i,j}, {i,1,m}, {j,1,n}],1]
total=Length[twodice];
s=0;
Do[y=twodice[[i]];
If[y[[1]]+y[[2]]==6,s=s+1],
{i,1,total}]
Print["Probability=",s/total]
Out[2]= {{1,1},{1,2},{1,3},{1,4},{1,5},{1,6},{2,1},{2,2},
{2,3},{2,4},{2,5},{2,6},{3,1},{3,2},{3,3},{3,4},
{3,5},{3,6},{4,1},{4,2},{4,3},{4,4},{4,5},{4,6},
{5,1},{5,2},{5,3},{5,4},{5,5},{5,6},{6,1},{6,2},
{6,3},{6,4},{6,5},{6,6}}
Probability=5/36 Make suitable modifications to the above program so that the following questions, relating to the same experiment, can be answered using Mathematica: what is the probability that when throwing two dice, (i) the sum of the two outcomes is less than or equal to six?
(ii) the difference between the two outcomes is exactly three?
(iii) the sum of the squares of the two outcomes is less than or equal to 36?
(iv) the largest of the two outcomes equals five?
(v) the smallest of the two outcomes equals three?
(vi) at least one of the outcomes equals six?
Step by Step Answer:
Introduction To Probability Volume 2
ISBN: 9781118123331
1st Edition
Authors: Narayanaswamy Balakrishnan, Markos V. Koutras, Konstadinos G. Politis