x and y are two real numbers, each of which is uniformly randomly chosen in the interval (1,5).
Determine the probability of each of the following events:
(i) ⌈3*x⌉ + ⌈4*y⌉ = ⌈3*x + 4*y⌉
(ii) ⌈3*x⌉ - ⌈4*y⌉ = ⌈3*x - 4*y⌉
(iii) ⌈3*x⌉ * ⌈4*y⌉ = ⌈12*x*y⌉
⌈3*x⌉
(iv) --------- = ⌈(3*x)/(4*y)⌉
⌈4*y⌉
*** ⌈n⌉ denotes ceiling(n), that is, the lowest integer greater than or equal to n.
I considered just probabilities and, not surprisingly, ended up with
the same equations and the same results as the others.....
If you have two uniform random variables X from i to i+1 and Y from
j to j+1, and multiply them to get a new random variable Z, what is
the likelihood C(X) C(Y) = C(Z), where C is the ceiling? Call this Pr(i,j)
Pr(i,j) is the probability that (i+1) (j+1) - 1 < Z < (i+1) (j+1).
From here on, call i1=i+1, j1=j+1, and m1= (i+1)(j+1) - 1
We compute Pr(i,j) with a double integral:
Pr(i,j) = Integral { limits x } Integral {limits y} (1) (1) dy dx
Here (1) and (1) stand for PDF=1 for each uniform distribution.
The integrals' upper limits in x and y are i1 and j1, but the lower limits
are constrained. The lowest x is m1/j1, where XY is large enough to make m1.
{limits x} = {m1/j1 to i1}
Likewise the limits on Y are constrained to {limits y} = {m1/x to j1}
Pr(i,j) = Int {m1/j1, i1} Int (m1/x, j1) dy xy
= Int {m1/j1} (j1 - m1/x) dx
= j1 (i1 - m1/j1) - m1 Int {m1/j1, i1} dx / x
= 1 - m1 ( ln(i1) - ln(m1/j1) )
Pr(i,j) = 1 + m1 ln[m1/(i1 j1)]
The following program accumulates Pr(i,j) over the 192 (i,j) pairs, and
gets the average. I use zm1 for m1 above.
program fin
ans=0
do i1=4,15
do j1=5,20
zm1=i1*j1-1
ans=ans+1+zm1*log(zm1/(i1*j1))
enddo
enddo
print*,ans/192.
end
lord@rabbit 12808 % fin
5.88916475E-03
Edited on December 9, 2022, 9:55 am