B <- runif(10000, min = 0, max = 1)
C <- runif(10000, min = 0, max = 1)
hist(B, col = "yellow")
hist(C, col = "orange")
X <- B + C
hist(X, main = "Histogram of B + C", col = "skyblue")
(sum(X < 0.5) / 10000)
## [1] 0.1205
X <- B * C
hist(X, main = "Histogram of B x C", col = "skyblue")
(sum(X < 0.5) / 10000)
## [1] 0.8432
X <- abs(B - C)
hist(X, main = "Histogram of |B − C|", col = "skyblue")
(sum(X < 0.5) / 10000)
## [1] 0.7474
X <- pmax(B,C)
hist(X, main = "Histogram of max{B,C}", col = "skyblue")
(sum(X < 0.5) / 10000)
## [1] 0.2483
X <- pmin(B,C)
hist(X, main = "Histogram of min{B,C}", col = "skyblue")
(sum(X < 0.5) / 10000)
## [1] 0.7474