Simulació amb daus
Author: Pep Bujosa

Sumes

Tirades acció/pausa

n = 0

Nombre de tirades

F. Absol.

F. Rel.

Total:

Probabilitats

Gràfic probabilitats teòriques

Valors predeterminats

Gràfic probabilitats entrades

Probabilitats

n = 0 (slider from 0 to nf, step 1)
val = Sequence(i, i, 1, 19)
Daus = 2 (slider from 1 to 3, step 1)
n3 = If(Daus ≟ 3, 1, 0)
n2 = If(Daus ≥ 2, 1, 0)
nf = 1000
simu = Sequence(Random[1, 6] + (n2 * Random[1, 6]) + (n3 * Random[1, 6]), i, 1, nf)
simun = First(simu, n)
A2 = 1
A3 = 2
A4 = 3
A5 = 4
A6 = 5
A7 = 6
A8 = 7
A9 = 8
A10 = 9
A11 = 10
A12 = 11
A13 = 12
A14 = 13
A15 = 14
A16 = 15
A17 = 16
A18 = 17
A19 = 18
fa = Frequency(val, simun)
fr: fa / n
np = 0
CampDeText1 = Textfield(nf)
llista1 = Sequence(Text[Element[fr, i], (Element[val, i] - 0.25, Element[fr, i] + 0.005)], i, 1, 18)
B2 = Element(fa, A2)
B3 = Element(fa, A3)
B4 = Element(fa, A4)
B5 = Element(fa, A5)
B6 = Element(fa, A6)
B7 = Element(fa, A7)
B8 = Element(fa, A8)
B9 = Element(fa, A9)
B10 = Element(fa, A10)
B11 = Element(fa, A11)
B12 = Element(fa, A12)
B13 = Element(fa, A13)
B14 = Element(fa, A14)
B15 = Element(fa, A15)
B16 = Element(fa, A16)
B17 = Element(fa, A17)
B18 = Element(fa, A18)
B19 = Element(fa, A19)
C2 = Element(fr, A2)
C3 = Element(fr, A3)
C4 = Element(fr, A4)
C5 = Element(fr, A5)
C6 = Element(fr, A6)
C7 = Element(fr, A7)
C8 = Element(fr, A8)
C9 = Element(fr, A9)
C10 = Element(fr, A10)
C11 = Element(fr, A11)
C12 = Element(fr, A12)
C13 = Element(fr, A13)
C14 = Element(fr, A14)
C15 = Element(fr, A15)
C16 = Element(fr, A16)
C17 = Element(fr, A17)
C18 = Element(fr, A18)
C19 = Element(fr, A19)
B20 = Sum(B2:B19)
D3 = 0
D4 = 0
D5 = 0
D6 = 0
D7 = 0
D8 = 0
D9 = 0
D10 = 0
D11 = 0
D12 = 0
D13 = 0
D14 = 0
D15 = 0
D16 = 0
D17 = 0
D18 = 0
D2 = 0
D19 = 0
prob: {D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19}
c = false
prob2: {"Probabilitats", 0, 0.027777777777777776, 0.05555555555555555, 0.08333333333333333, 0.1111111111111111, 0.1388888888888889, 0.16666666666666666, 0.1388888888888889, 0.1111111111111111, 0.08333333333333333, 0.05555555555555555, 0.027777777777777776, 0, 0, 0, 0, 0, 0}
d = 0
e = 0
f = 0
g = 0
h = 0
prob1: {"Probabilitats", 0.16667, 0.16667, 0.16667, 0.16667, 0.16667, 0.16667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
prob0: {"Probabilitats", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
val0: {"Sumes", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, "Total:"}
prob3: {"Probabilitats", 0, 0, 0.004629629629629629, 0.013888888888888888, 0.027777777777777776, 0.046296296296296294, 0.06944444444444445, 0.09722222222222222, 0.11574074074074074, 0.125, 0.125, 0.11574074074074074, 0.09722222222222222, 0.06944444444444445, 0.046296296296296294, 0.027777777777777776, 0.013888888888888888, 0.004629629629629629}
fa0 = Append("F.Absol.", fa)
cc = true
bb = BarChart(A2:A19, D2:D19, 0.6)
a = BarChart(A2:A19, fr, 0.3)
C20 = Sum(C2:C19)
D20 = Sum(D2:D19)
T2 = 0
T3 = 0.028
T4 = 0.056
T5 = 0.083
T6 = 0.111
T7 = 0.139
T8 = 0.167
T9 = 0.139
T10 = 0.111
T11 = 0.083
T12 = 0.056
T13 = 0.028
T14 = 0
T15 = 0
T16 = 0
T17 = 0
T18 = 0
T19 = 0
b = BarChart(A2:A19, T2:T19, 0.8)
T21 = Sum(T2:T19)