mirror of
https://github.com/ArthurDanjou/ArtStudies.git
synced 2026-01-20 12:22:21 +01:00
Fix
This commit is contained in:
@@ -42,5 +42,5 @@ for (j in (1:n)) {
|
||||
i <- 1
|
||||
}
|
||||
hist(S, freq = FALSE)
|
||||
# curve(dpois(S, lambda = 4), add = TRUE, col = "red")
|
||||
curve(dpois(S, lambda = 4), add = TRUE, col = "red")
|
||||
```
|
||||
|
||||
@@ -12,6 +12,6 @@ BM <- function(n) {
|
||||
n <- 10e4
|
||||
X <- BM(n)
|
||||
|
||||
hist(X, breaks = 100, freq = FALSE)
|
||||
hist(X, breaks = 50, freq = FALSE)
|
||||
curve(dnorm(x), add = TRUE, col = "red")
|
||||
```
|
||||
@@ -2,21 +2,17 @@
|
||||
|
||||
```{r}
|
||||
f <- function(x) {
|
||||
return(
|
||||
(2 / pi * sqrt(1 - x^2)) * (x >= -1 & x <= 1)
|
||||
)
|
||||
2 / pi * sqrt(1 - x^2) * (x >= -1 & x <= 1)
|
||||
}
|
||||
|
||||
n <- 10000
|
||||
|
||||
M <- 4 / pi
|
||||
g <- function(x) {
|
||||
return(
|
||||
1 / 2 * (x >= -1 & x <= 1)
|
||||
)
|
||||
1 / 2 * (x >= -1 & x <= 1)
|
||||
}
|
||||
|
||||
x <- NULL
|
||||
x <- numeric(0)
|
||||
while (length(x) < n) {
|
||||
U <- runif(1)
|
||||
X <- runif(1, -1, 1)
|
||||
|
||||
Reference in New Issue
Block a user