Data update
This commit is contained in:
parent
52a6ef48dd
commit
157b70a810
604 changed files with 14253 additions and 2100 deletions
|
|
@ -53,7 +53,6 @@ BEGIN # calculate the mean and standard deviation of some data and draw a #
|
|||
FOR i FROM LWB count TO UPB count DO
|
||||
IF count[ i ] > max count THEN max count := count[ i ] FI
|
||||
OD;
|
||||
INT len = ( UPB data - LWB data ) + 1;
|
||||
REAL v := 0;
|
||||
REAL scale = max count / h scale;
|
||||
FOR i FROM LWB count TO UPB count DO
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
module statistics1 {
|
||||
open "out1.txt" for output as #f
|
||||
sample(100)
|
||||
sample(1000)
|
||||
sample(10000)
|
||||
sample(100000)
|
||||
sample(1000000)
|
||||
close #f
|
||||
Win "NotePad", dir$+"out1.txt"
|
||||
Sub sample(n)
|
||||
local samp(1 to n) as double<<rnd
|
||||
|
||||
' calculate mean, standard deviation
|
||||
local sum, sumSq, i, max, mean, bins, b
|
||||
for i = 1 to n
|
||||
sum += samp(i)
|
||||
sumSq += samp(i)^2
|
||||
next i
|
||||
print #f, n; " Samples used."
|
||||
mean = sum / n
|
||||
print #f, "Mean = "; mean
|
||||
|
||||
print #f, "Std Dev = "; (sumSq /n -mean^2)^0.5
|
||||
|
||||
'------- Show histogram
|
||||
bins = 10
|
||||
dim bins(bins)
|
||||
for i = 1 to n
|
||||
bins(int(bins * samp(i)))++
|
||||
next i
|
||||
max=bins()#max()
|
||||
for b = 0 to bins -1
|
||||
print #f, b;" ";string$("*",bins(b)/max*60);" ";bins(b)/n*100;"%"
|
||||
next b
|
||||
print #f
|
||||
end sub
|
||||
}
|
||||
statistics1
|
||||
Loading…
Add table
Add a link
Reference in a new issue