Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Statistics-Basic/Icon/statistics-basic.icon
Normal file
26
Task/Statistics-Basic/Icon/statistics-basic.icon
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
procedure main(A)
|
||||
|
||||
W := 50 # avg width for histogram bar
|
||||
B := 10 # histogram bins
|
||||
if *A = 0 then put(A,100) # 100 if none specified
|
||||
|
||||
while N := get(A) do { # once per argument
|
||||
write("\nN=",N)
|
||||
|
||||
N := 0 < integer(N) | next # skip if invalid
|
||||
|
||||
stddev() # reset
|
||||
m := 0.
|
||||
H := list(B,0) # Histogram of
|
||||
every i := 1 to N do { # calc running ...
|
||||
s := stddev(r := ?0) # ... std dev
|
||||
m +:= r/N # ... mean
|
||||
H[integer(*H*r)+1] +:= 1 # ... histogram
|
||||
}
|
||||
|
||||
write("mean=",m)
|
||||
write("stddev=",s)
|
||||
every i := 1 to *H do # show histogram
|
||||
write(right(real(i)/*H,5)," : ",repl("*",integer(*H*50./N*H[i])))
|
||||
}
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue