Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
22
Task/Statistics-Basic/Pluto/statistics-basic.pluto
Normal file
22
Task/Statistics-Basic/Pluto/statistics-basic.pluto
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
require "table2"
|
||||
|
||||
for {100, 1000, 10000} as i do
|
||||
local a = table.create(i)
|
||||
for j = 1, i do a[j] = math.random() end
|
||||
print($"For {i} random numbers:")
|
||||
print($" mean = {a:mean()}")
|
||||
print($" std/dev = {a:stddev()}")
|
||||
local scale = math.round(i / 100)
|
||||
print($" scale = {scale} per asterisk")
|
||||
local sums = table.rep(10, 0)
|
||||
for a as e do
|
||||
local f = math.floor(e * 10)
|
||||
sums[f + 1] += 1
|
||||
end
|
||||
for j = 1, 9 do
|
||||
sums[j] = math.round(sums[j] / scale)
|
||||
print($" 0.{j - 1} - 0.{j}: {string.rep("*", sums[j])}")
|
||||
end
|
||||
sums[10] = 100 - sums:slice(1, 9):sum()
|
||||
print($" 0.9 - 1.0: {string.rep("*", sums[10])}\n")
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue