Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SOLUTION BY R Give an efficient method for generating nine uniform points on (0,

ID: 3255357 • Letter: S

Question

SOLUTION BY R Give an efficient method for generating nine uniform points on (0, 1) conditional on the event than no two of them are within 0.1 of each other. (It can be shown that if n points are independent and uniformly distributed on (0, 1), then the probability that no two of them are within d of each other is, for 0 < d < 1/(n 1), [1- (n-1)d]n.) SOLUTION BY R Give an efficient method for generating nine uniform points on (0, 1) conditional on the event than no two of them are within 0.1 of each other. (It can be shown that if n points are independent and uniformly distributed on (0, 1), then the probability that no two of them are within d of each other is, for 0 < d < 1/(n 1), [1- (n-1)d]n.)

Explanation / Answer

x=runif(1,0,1)
count=0
while(count < 9)
{
y=runif(1,0,1)

if(abs(x-y)>=0.1)
{count=count+1
print(y)
x=y}
}