Question about monte carlo simulation

I have a question about Monte Carlo Simulation.
Suppose that three random numbers are generated. a) Determine the probability that the numbers are in increasing order using a Monte Carlo simulation where (i) the distribution is uniform in [

4 件のコメント

James Tursa
James Tursa 2016 年 2 月 4 日
What have you done so far? Do you know how to generate three random numbers? Do you know how to compare them to see if they are in increasing order? Do you know how to do this multiple times and count how many times they were in increasing order?
John D'Errico
John D'Errico 2016 年 2 月 4 日
You don't have a question. You DO have a homework problem. :) One on which you apparently have not started work, but should make an effort.
Bo Wang
Bo Wang 2016 年 2 月 4 日
I know how to generate random numbers, I just don't know what the probability is. Is the probability should be 1/factorial(n) or probability should be 1?
Walter Roberson
Walter Roberson 2016 年 2 月 4 日
編集済み: Walter Roberson 2016 年 2 月 4 日
You appear to be missing a few characters from the end of your question. Part of what is missing is whether the distribution is over integers or over real numbers.

サインインしてコメントする。

 採用された回答

James Tursa
James Tursa 2016 年 2 月 4 日
編集済み: James Tursa 2016 年 2 月 4 日

1 投票

Monte Carlo means you will be estimating the probability by making a large number of sample runs (aka trials) and then counting. Suppose you have a loop that runs for 1000000 iterations. On each iteration you generate 3 random numbers and check to see if they are in increasing order. The estimated probability is then the number of times they were in increasing order divided by the total number of trials. E.g.,
n = 1000000; % <-- The total number of trials
count = 0; % <-- A counter to keep track of the number of successes
for k=1:n
% You put code here to generate your three random numbers
if( numbers are in increasing order ) % <-- You fill in this logic
count = count + 1;
end
end
estimated_probability = count / n;

1 件のコメント

Bo Wang
Bo Wang 2016 年 2 月 4 日
this helps me a lot. Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMonte-Carlo についてさらに検索

質問済み:

2016 年 2 月 4 日

編集済み:

2016 年 2 月 4 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by