Für Vorlesungen, bitte die Webseite verwenden. https://flavigny.de/lecture
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
347B

  1. approx_p <- function(n0, a, b) {
  2. x <- rnorm(n0)
  3. sum(x >= a & x <= b) / n0
  4. }
  5. # berechne wahres p durch Integration
  6. p <- integrate(dnorm, lower=-1, upper=3)$value
  7. p
  8. # berechne Differenz zwischen Näherung und wahrem Wert für verschiedene n0
  9. abs(p - approx_p(1e1, -1, 3))
  10. abs(p - approx_p(1e3, -1, 3))
  11. abs(p - approx_p(1e5, -1, 3))