Re: Re: RandomReplacement

*To*: mathgroup at smc.vnet.net*Subject*: [mg51414] Re: [mg51380] Re: RandomReplacement*From*: sean kim <sean_incali at yahoo.com>*Date*: Sat, 16 Oct 2004 04:20:58 -0400 (EDT)*Reply-to*: sean_incali at yahoo.com*Sender*: owner-wri-mathgroup at wolfram.com

actually, I made a mistake in the last post. i forgot the index for RandomArray. if it's put back in, i get the similar slowing down effect. sorry for any confusions. but i noticed something else peculiar. Please consider the following. without the package loaded, i get In[1]:= <<"Statistics`NormalDistribution`"; In[2]:= Table[RandomArray[NormalDistribution[50,25], 1],{10^4}];//Timing Out[2]= {0.992 Second,Null} In[3]:= Table[RandomArray[NormalDistribution[50,25], 1],{10^5}];//Timing Out[3]= {9.143 Second,Null} In[4]:= Table[RandomArray[NormalDistribution[50,25], 1],{10^6}];//Timing Out[4]= {91.361 Second,Null} In[5]:= Timing[Table[Random[Real, {0, 100}],{10^6}];] Out[5]= {0.671 Second,Null} as Daniel was saying, no secret here. as you increase the number of samples, you increase the time. it take 10x time to pick 10x more numbers. (lol, to think I was wondering why that was...) anyway, obviously using the RandomArray to sample the number from a distribution is less efficient than just using Random[]. but that's not what is kinda peculiar for me. now if we do the same thing with the RandomReplacement loaded... In[1]:= <<"Statistics`NormalDistribution`"; <<RandomReplacement` In[3]:= Table[RandomArray[NormalDistribution[50,25], 1],{10^4}];//Timing Out[3]= {1.221 Second,Null} In[4]:= Table[RandomArray[NormalDistribution[50,25], 1],{10^5}];//Timing Out[4]= {11.867 Second,Null} In[5]:= Table[RandomArray[NormalDistribution[50,25], 1],{10^6}];//Timing Out[5]= {120.953 Second,Null} In[6]:=Timing[Table[Random[Real, {0, 100}],{10^6}];] Out[6]={27.389 Second,Null} so... the differences in timing between loading and not loading the RandomReplacement package is more pronounced in using Random[Real, {}] alone. When I used RandomArray, package slowed things down 1.3 times. (120.953 seconds/91.361 seconds) but using Random[Real], it slows it down by 40 times!( 27.389 seconds /0.671seconds) I wonder if this gives you guys soem ideas to speed things up. hope that helps a bit. sean __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail