feat(Add bonus to Exercice 51): Ajoute du calcul de l'espérence a l'exercice 51

Ajout du calcul de l'espérence à l'exercice 51
This commit is contained in:
2024-12-18 10:24:54 +01:00
parent 8bc7b2bf58
commit abb04e6d22

View File

@@ -14,3 +14,10 @@ F <- function(x) {
cible <- 1 - 10^(-5)
capacite <- uniroot(function(x) F(x) - cible, lower = 0, upper = 1)$root
print(capacite * 1000)
# c) (Bonus) Calculer l'espérence
fonction_esperance <- function (x) {
x * c * (1 - x)^4
}
esperance <- integrate(fonction_esperance, lower = 0, upper = 1)$value
print(esperance)