Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Statistics-Basic/11l/statistics-basic.11l
Normal file
22
Task/Statistics-Basic/11l/statistics-basic.11l
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
F sd_mean(numbers)
|
||||
V mean = sum(numbers) / numbers.len
|
||||
V sd = (sum(numbers.map(n -> (n - @mean) ^ 2)) / numbers.len) ^ 0.5
|
||||
R (sd, mean)
|
||||
|
||||
F histogram(numbers)
|
||||
V h = [0] * 10
|
||||
V maxwidth = 50
|
||||
L(n) numbers
|
||||
h[Int(n * 10)]++
|
||||
V mx = max(h)
|
||||
print()
|
||||
L(i) h
|
||||
print(‘#.1: #.’.format(L.index / 10, ‘+’ * (i * maxwidth I/ mx)))
|
||||
print()
|
||||
|
||||
L(i) (1, 5)
|
||||
V n = (0 .< 10 ^ i).map(j -> random:())
|
||||
print("\n####\n#### #. numbers\n####".format(10 ^ i))
|
||||
V (sd, mean) = sd_mean(n)
|
||||
print(‘ sd: #.6, mean: #.6’.format(sd, mean))
|
||||
histogram(n)
|
||||
Loading…
Add table
Add a link
Reference in a new issue