# Mean of the result of iterations...

Posted 9 years ago
4314 Views
|
6 Replies
|
0 Total Likes
|
 Table[r = Print[100*Log[(-1)/(RandomReal[] - 1)]], {i, 100}] OR Do[r = Print[100*Log[(-1)/(RandomReal[] - 1)]], {i, 100}] I get 100 iterations of this expression. I need to find the mean/average of these iterations. How can I do this?
6 Replies
Sort By:
Posted 9 years ago
 Beautiful! Thank you.
Posted 9 years ago
 But RandomReal[1, 100] returns 100 random numbers between 0 and 1. RandomReal[{1, 100}] returns a single random number between 1 and 100.
Posted 9 years ago
 Jim, thanks for your response. The RandomReal[] should be a random number between 0 and 1, not 1 and 100.My idea is this:I have an expression 100*Log[(-1)/(RandomReal[] - 1)]I want to solve this 100 times, using a random real number between 0 and 1 each time.Then I will get 100 values of r = 100*Log[(-1)/(RandomReal[] - 1)], and then I have to calculate the mean of all of these values.
Posted 9 years ago
 If the "100" of "100 iterations" is the same as the "100" in {i,100}, then the following will get you the mean: Mean[100 Log[-1/(RandomReal[1, 100] - 1)]] Or are there 100 iterations of the 100 random draws?
Posted 9 years ago
 Picture of what's going on... Posted 9 years ago
 So whenever I do Table[r = Print[100*Log[(-1)/(RandomReal[] - 1)]];, {i, 100}] I get the result of each iteration one by one, but then at the end I get the list with {Null, Null, Null, Null, etc...}. Why is this?