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.
The program simulates the four problems in sequence:
clearvars
ct=0;
for trial=1:10000000
x=4*rand+1; y=4*rand+1;
LHS=ceil(3*x)+ceil(4*y);
RHS=ceil(3*x+4*y);
if LHS==RHS
ct=ct+1;
end
end
disp(ct/trial)
ct=0;
for trial=1:10000000
x=4*rand+1; y=4*rand+1;
LHS=ceil(3*x)-ceil(4*y);
RHS=ceil(3*x-4*y);
if LHS==RHS
ct=ct+1;
end
end
disp(ct/trial)
ct=0;
for trial=1:100000000
x=4*rand+1; y=4*rand+1;
LHS=ceil(3*x)*ceil(4*y);
RHS=ceil(3*x*4*y);
if LHS==RHS
ct=ct+1;
end
end
disp([ct/trial trial/ct])
ct=0;
for trial=1:100000000
x=4*rand+1; y=4*rand+1;
LHS=ceil(3*x)/ceil(4*y);
RHS=ceil(3*x/(4*y));
if LHS==RHS
ct=ct+1;
end
end
disp([ct/trial trial/ct])
simulates the four scenarios.
Results follow below. 10,000,000 trials were done for each of the first two cases, but 100,000,000 for each of the 3rd and 4th cases.
In the 3rd and 4th cases, the reciprocal of the probability is also shown.
>> risingAboveTheCeilingSim
0.4999915
0.500416
0.00588581 169.900149682032
0.03342845 29.9146385788153
For addition and subtraction the probability appears to be 1/2.
For multiplication, .00588 or .00589 or about 1 in 170.
For division, .03343 or about 1 in 29.9.
|
Posted by Charlie
on 2022-12-06 09:56:10 |