update chapters 4 and 5

This commit is contained in:
Bogumił Kamiński
2022-02-11 00:14:38 +01:00
parent bbd8bbf571
commit e73dbaf370
3 changed files with 181 additions and 169 deletions

12
appB.jl
View File

@@ -16,9 +16,7 @@ y = collect(x);
@btime sort($y);
@edit sort(x)
# CODES BELOW REQUIRE RE-NUMBERING
# Code for exercise 3.1
# Code for exercise 4.1
using Statistics
using BenchmarkTools
@@ -36,7 +34,7 @@ aq = [10.0 8.04 10.0 9.14 10.0 7.46 8.0 6.58
@benchmark [cor($aq[:, i], $aq[:, i+1]) for i in 1:2:7]
@benchmark [cor(view($aq, :, i), view($aq, :, i+1)) for i in 1:2:7]
# Code for exercise 3.2
# Code for exercise 4.2
function dice_distribution(dice1, dice2)
distribution = Dict{Int, Int}()
@@ -73,17 +71,19 @@ end
test_dice()
# Code for exercise 3.3
# Code for exercise 4.3
plot(scatter(data.set1.x, data.set1.y; legend=false),
scatter(data.set2.x, data.set2.y; legend=false),
scatter(data.set3.x, data.set3.y; legend=false),
scatter(data.set4.x, data.set4.y; legend=false))
# Code for exercise 3.4
# Code for exercise 5.1
parse.(Int, ["1", "2", "3"])
# CODES BELOW REQUIRE RE-NUMBERING
# Code for exercise 4.1
years_table = freqtable(years)