Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,35 @@
|
|||
Function run_test(p As Double, longitud As Integer, runs As Integer) As Double
|
||||
Dim As Integer r, l, cont = 0
|
||||
Dim As Integer v, pv
|
||||
|
||||
For r = 1 To runs
|
||||
pv = 0
|
||||
For l = 1 To longitud
|
||||
v = Rnd < p
|
||||
cont += Iif(pv < v, 1, 0)
|
||||
pv = v
|
||||
Next l
|
||||
Next r
|
||||
Return (cont/runs/longitud)
|
||||
End Function
|
||||
|
||||
Print "Running 1000 tests each:"
|
||||
Print " p n K p(1-p) delta"
|
||||
Print String(46,"-")
|
||||
|
||||
Dim As Double K, p, p1p
|
||||
Dim As Integer n, ip
|
||||
|
||||
For ip = 1 To 10 Step 2
|
||||
p = ip / 10
|
||||
p1p = p * (1-p)
|
||||
n = 100
|
||||
While n <= 100000
|
||||
K = run_test(p, n, 1000)
|
||||
Print Using !"#.# ###### #.#### #.#### +##.#### (##.## \b%)"; _
|
||||
p; n; K; p1p; K-p1p; (K-p1p)/p1p*100
|
||||
n *= 10
|
||||
Wend
|
||||
Print
|
||||
Next ip
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue