Explanation
To generate random variables from U(-1,5) using random variables from U(0,1), we use the inverse transform method.
For a uniform distribution U(a,b), the cumulative distribution function (CDF) is:
F(x)=b−ax−afor a≤x≤b
For X ~ U(-1,5):
- a = -1
- b = 5
- b - a = 5 - (-1) = 6
So the CDF is:
F(x)=6x−(−1)=6x+1
To generate X from U ~ U(0,1), we solve for x in terms of u:
u=6x+1
x+1=6u
x=6u−1
Now, for u = 0.10:
x=6×0.10−1=0.60−1=−0.40
Therefore, the corresponding random variable from U(-1,5) is -0.40.
Verification:
- When u = 0, x = 6×0 - 1 = -1 (lower bound)
- When u = 1, x = 6×1 - 1 = 5 (upper bound)
- When u = 0.10, x = -0.40 (correct)