• To: mathgroup at smc.vnet.net
• From: Joe Hays <hays.joe at gmail.com>
• Date: Sat, 8 May 2010 07:08:22 -0400 (EDT)

```I would use a FOR loop and collect the generated points in a preallocated
vector like,

M=74;
n=88;
T = Range[10000];
For[i=1, i<=10000, i++,
R= RandomReal[{15,23}];
T[[i]]= M/(R/n);
];
myMean = Mean[T];

However, this is very much a procedural programming approach. I'm sure the
Mathematica experts helping on this list can provide a more efficient
approach...

Joe

On Fri, May 7, 2010 at 6:28 AM, Kevin <kxcarmichael250 at hotmail.com> wrote:

> I am trying to run the function t= M/(R/n), where R is a random number
> generated between 15 and 25. What function do i use to run this simulation
> 10,000 times and calculate the mean and std error from 306.
>
> This is what i have so far
> M=74
> n=88
> No=306
> R= RandomReal[{15,23}]
> t= M/(R/n)
> t = x; Do[t = M/(R/n), {10000}]
>
> Everything is working for me except how to run the simulation 10,000 times
>
>

```

• Prev by Date: Variables in Iterator limits?
• Next by Date: How to Explain This Behavior of Simple Procedures?