Solved problem 4.

This commit is contained in:
Filipe Rodrigues 2023-06-15 18:37:09 +01:00
parent fba2f7284b
commit bcb1a403f9
2 changed files with 6 additions and 2 deletions

1
4/answer.txt Normal file
View File

@ -0,0 +1 @@
1.50632911392405

View File

@ -38,6 +38,9 @@ occurrences <- mapply(function(x, is_step) {
}, nums_cumsum, steps)
occurrences <- occurrences[!is.na(occurrences)]
occurrences_mean <- mean(occurrences)
message("Occurrences mean: ", occurrences_mean)
# TODO: Calculate expected value (theoretical) and
# compare it to the experimental value discovered here
# TODO: Is the mean really `21`? That'd make sense, but
# might be too simple?
message("Absolute deviation: ", abs(occurrences_mean - 21))