Consider a loop of string with unit length. Take n cuts independently and randomly along the string, what is the expected length of the smallest and the largest piece?
이전 댓글 표시
This is what I did.
The probability is (1+(1-n)x)^n
So, expected value of x is it integral for x varies from 0 to 1/n which evaluates to 1/n^2
If this is right how should I write the code?
댓글 수: 7
Walter Roberson
2016년 2월 8일
The probability of what?
Jan
2016년 2월 8일
Does a loop have a length? Are the randomly distributed cuts set according to a equasl, normal Gauss , Lorenz, etc distribution?
Walter Roberson
2016년 2월 8일
"unit" length according to the title.
Vin Sen Lee
2016년 2월 9일
Guillaume
2016년 2월 9일
'randomly distributed' does not mean anything. You can have 'uniform' distribution, 'normal' distribution, 'log normal' distribution, and many more.
Vin Sen Lee
2016년 2월 10일
답변 (1개)
Are Mjaavatten
2016년 2월 8일
Your question is not very clear. The code below is an answer to: How can I code a test of this result?
N=100000; % Number of samples
n=8; % Number of cuts
d = zeros(N,n); % Allocate space for results
for i = 1:N
a = sort(rand(1,n)); % Draw random cut poins and distribute them along the string
b = [a(end)-1,a]; % Join ends
d(i,:) = sort(diff(b)); % Sort the pieces by length
end
mean_lengths = mean(d); % mean_lengths(i) is the mean length of the i'th shortest piece
disp(mean_lengths);
댓글 수: 2
Vin Sen Lee
2016년 2월 9일
Walter Roberson
2016년 2월 9일
편집: Walter Roberson
2016년 2월 9일
mean_lengths(end) is the mean of the longest.
The shortest out of all of the runs is min(d(:)) and the longest out of all of the runs is max(d(:)) (those might occur on different runs.)
카테고리
도움말 센터 및 File Exchange에서 Sparse Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!