Solved problem 7.

This commit is contained in:
Filipe Rodrigues 2023-06-15 19:48:27 +01:00
parent 18a149dc7b
commit c5ae79b41a
4 changed files with 17 additions and 0 deletions

View File

@ -10,6 +10,7 @@
"Ocupação",
"País",
"pessoais",
"probs",
"readxl",
"remunerado",
"Sexo",

BIN
7/P7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

1
7/answer.txt Normal file
View File

@ -0,0 +1 @@
0.0809

15
7/script.R Executable file
View File

@ -0,0 +1,15 @@
#!/bin/env Rscript
# Set the seed for the RNG
set.seed(1310)
# Generate all the numbers
n <- 18
nums_len <- 3000
nums <- sapply(1:nums_len, function(idx) {
sum(rnorm(18, mean = 0, sd = 1)^2)
})
found_q <- quantile(nums, probs = 0.45, type = 2, names = FALSE)
expected_q <- 16.610782192541615317452678264022358815695613493397815519636198613
print(round(abs(found_q - expected_q), 4))