mirror of
https://github.com/ArthurDanjou/ArtStudies.git
synced 2026-02-08 11:05:51 +01:00
Fix
This commit is contained in:
@@ -42,5 +42,5 @@ for (j in (1:n)) {
|
|||||||
i <- 1
|
i <- 1
|
||||||
}
|
}
|
||||||
hist(S, freq = FALSE)
|
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
|
n <- 10e4
|
||||||
X <- BM(n)
|
X <- BM(n)
|
||||||
|
|
||||||
hist(X, breaks = 100, freq = FALSE)
|
hist(X, breaks = 50, freq = FALSE)
|
||||||
curve(dnorm(x), add = TRUE, col = "red")
|
curve(dnorm(x), add = TRUE, col = "red")
|
||||||
```
|
```
|
||||||
@@ -2,21 +2,17 @@
|
|||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
f <- function(x) {
|
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
|
n <- 10000
|
||||||
|
|
||||||
M <- 4 / pi
|
M <- 4 / pi
|
||||||
g <- function(x) {
|
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) {
|
while (length(x) < n) {
|
||||||
U <- runif(1)
|
U <- runif(1)
|
||||||
X <- runif(1, -1, 1)
|
X <- runif(1, -1, 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user