A stick of length 1 is broken at a uniformly random point, yielding two pieces. Let X and Y be the lengths of the shorter and longer pieces, respectively, and let R=X/Y be the ratio of the lengths of X and Y.
(a) Find the CDF and PDF of R.
(b) Find the expected value of R (if it exists).
(c) Find the expected value of 1/R (if it exists).
(d)Use simulations in R to gain some understanding about the distribution of the random variable R. Numerically estimate the expected value of R and 1/R.
So, the value of expectation of R and 1/R do not exist, as they do not converge. However, R is saying that the values converge and gives an answer. Can someone explain why. (R does not converge as the integral is not bound at infinity, while 1/R is not bound at 0.
My R code is as follows:
n <- 100000 r <- numeric(n) x <- runif(n) y <- 1-x r <- x/y mean(r) mean(1/r)