tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
14
Task/Probabilistic-choice/PARI-GP/probabilistic-choice.pari
Normal file
14
Task/Probabilistic-choice/PARI-GP/probabilistic-choice.pari
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
pc()={
|
||||
my(v=[5544,10164,14124,17589,20669,23441,25961,27720],u=vector(8),e);
|
||||
for(i=1,1e6,
|
||||
my(r=random(27720));
|
||||
for(j=1,8,
|
||||
if(r<v[j], u[j]++; break)
|
||||
)
|
||||
);
|
||||
e=precision([1/5,1/6,1/7,1/8,1/9,1/10,1/11,1759/27720]*1e6,9); \\ truncate to 9 decimal places
|
||||
print("Totals: "u);
|
||||
print("Expected: "e);
|
||||
print("Diff: ",u-e);
|
||||
print("StDev: ",vector(8,i,sqrt(abs(u[i]-v[i])/e[i])));
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue