Mathematical model for dice
Mathematical model for dice
Here is a single die with six sides
In[]:=
s=6;(*sidesonadie*)d=(*modelofadie*)
s
∑
i=1
i
x
Out[]=
x+++++
2
x
3
x
4
x
5
x
6
x
And here is the result of rolling a set of three such dice.
In[]:=
n=3;(*numberofdice*)r=;(*diceroll*)Expand[r]
n
d
Out[]=
3
x
4
x
5
x
6
x
7
x
8
x
9
x
10
x
11
x
12
x
13
x
14
x
15
x
16
x
17
x
18
x
The exponent in each term is the sum of the dice, and the coefficient is the chance weight of that outcome.
In[]:=
c=CoefficientList[r,x];(*extractlistofchanceweights*)c=Drop[c,n](*trimthelisttostartatcountofdice*)
Out[]=
{1,3,6,10,15,21,25,27,27,25,21,15,10,6,3,1}
In[]:=
ListPlot[c]
Out[]=