From abb04e6d220ba32c1b0dfa7d0845aaf98a804710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20MARQUET?= Date: Wed, 18 Dec 2024 10:24:54 +0100 Subject: [PATCH] =?UTF-8?q?feat(Add=20bonus=20to=20Exercice=2051):=20Ajout?= =?UTF-8?q?e=20du=20calcul=20de=20l'esp=C3=A9rence=20a=20l'exercice=2051?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajout du calcul de l'espérence à l'exercice 51 --- TD1/Exercice51.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TD1/Exercice51.R b/TD1/Exercice51.R index 32ef563..5c1635c 100644 --- a/TD1/Exercice51.R +++ b/TD1/Exercice51.R @@ -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) \ No newline at end of file