Percolation/Mean run density: Difference between revisions

m
→‎{{header|J}}: Corrected missing factor of 100 in normal case of delta
(FORTRAN entry)
m (→‎{{header|J}}: Corrected missing factor of 100 in normal case of delta)
Line 297:
<lang J>
NB. translation of python
 
NB. 'N P T' =: 100 0.5 500 NB. silliness
 
newv =: (> ?@(#&0))~ NB. generate a random binary vector. Use: N newv P
runs =: {: + [: +/ 1 0&E. NB. add the tail to the sum of 1 0 occurrences Use: runs V
mean_run_density =: [ %~ [: runs newv NB. perform experiment. Use: N mean_run_density P
 
main =: 3 : 0 NB. Use: main T
T =. y
Line 312:
for_N. 2 ^ 10 + +: i. 3 do.
SIM =. T %~ +/ ".@:('N mean_run_density P'"_)^:(<T)0
smoutput 4 5j2 6 6j3 6j3 4j1 ": T, P, N, LIMIT, SIM, SIM (100 * [)`(|@:(- % ]))@.(0 ~: ])) LIMIT
end.
end.
Line 320:
Session:
<pre>
main 9500
T P N P(1-P) SIM DELTA
 
9 0.10 1024 0.090 0.081 0.1
9 0.10 4096 0.090 0.079 0.1
9 0.10 16384 0.090 0.079 0.1
 
9 0.30 1024 0.210 0.190 0.1
9 0.30 4096 0.210 0.186 0.1
9 0.30 16384 0.210 0.187 0.1
 
9 0.50 1024 0.250 0.220 0.1
9 0.50 4096 0.250 0.224 0.1
9 0.50 16384 0.250 0.223 0.1
 
9 0.70 1024 0.210 0.186 0.1
9 0.70 4096 0.210 0.186 0.1
9 0.70 16384 0.210 0.189 0.1
 
9 0.90 1024 0.090 0.081 0.1
9 0.90 4096 0.090 0.080 0.1
9 0.90 16384 0.090 0.079 0.1
 
main 500
T P N P(1-P) SIM DELTA
 
500 0.10 1024 0.090 0.089090 0.01
500 0.10 4096 0.090 0.090 0.02
500 0.10 16384 0.090 0.090 0.02
 
500 0.30 1024 0.210 0.210 0.02
500 0.30 4096 0.210 0.210209 0.03
500 0.30 16384 0.210 0.210 0.01
 
500 0.50 1024 0.250 0.250 0.02
500 0.50 4096 0.250 0.250 0.01
500 0.50 16384 0.250 0.250 0.02
 
500 0.70 1024 0.210 0.210 0.0
500 0.70 4096 0.210 0.210 0.02
500 0.70 16384 0.210 0.210 0.02
 
500 0.90 1024 0.090 0.091 01.01
500 0.90 4096 0.090 0.090 0.01
500 0.90 16384 0.090 0.090 0.01
</pre>
 
Anonymous user