June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
18
Task/Statistics-Basic/Julia/statistics-basic.julia
Normal file
18
Task/Statistics-Basic/Julia/statistics-basic.julia
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function hist(numbers)
|
||||
maxwidth = 50
|
||||
h = fill(0, 10)
|
||||
for n in numbers
|
||||
h[ceil(Int, 10n)] += 1
|
||||
end
|
||||
mx = maximum(h)
|
||||
for (n, i) in enumerate(h)
|
||||
@printf("%3.1f: %s\n", n / 10, "+" ^ floor(Int, i / mx * maxwidth))
|
||||
end
|
||||
end
|
||||
|
||||
for i in 1:6
|
||||
n = rand(10 ^ i)
|
||||
println("\n##\n## $(10 ^ i) numbers")
|
||||
@printf("μ: %8.6f; σ: %8.6f\n", mean(n), std(n))
|
||||
hist(n)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue