Re:Re: Vectorization
- To: mathgroup at smc.vnet.net
- Subject: [mg60821] Re:[mg60648] Re: Vectorization
- From: "Marcelo Mayall" <mmayall at bol.com.br>
- Date: Thu, 29 Sep 2005 05:42:05 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Jean-Marc Gulliet, At least in my computer, it seems that the pattern is accordingly as what I had described: In[1]:= Table[Table[Sin[N[I] Random[]],{300000}]//Timing//First,{5}] Table[Sin[Table[N[I] Random[],{300000}]]//Timing//First,{5}] Out[1]= {0.312 Second,0.329 Second,0.328 Second,0.312 Second,0.328 Second} Out[2]= {0.297 Second,0.297 Second,0.297 Second,0.312 Second,0.297 Second} In[3]:= Table[Table[Sin[Random[]],{1000000}]//Timing//First,{5}] Table[Sin[Table[Random[],{1000000}]]//Timing//First,{5}] Out[3]= {0.328 Second,0.329 Second,0.328 Second,0.328 Second,0.328 Second} Out[4]= {0.234 Second,0.219 Second,0.234 Second,0.219 Second,0.235 Second} Regards, Marcelo Mayall ---------- Início da mensagem original ----------- De: "Jean-Marc Gulliet" jeanmarc.gulliet at gmail.com Para: mathgroup at smc.vnet.net Data: Fri, 23 Sep 2005 04:19:52 -0400 (EDT) Assunto: [mg60648] Re: Vectorization > Marcelo Mayall wrote: > > It's possible to initialize a vector starting from an elementary functions: > > > > In[1]:= > > Table[Sin[Random[]],{10000000}]//Timing//First > > > > Out[1]= > > 3.203 Second > > > > The same problem can be done a bit more efficiently if the elementary function is applied to the numerical vector: > > > > In[2]:= > > Sin[Table[Random[],{10000000}]]//Timing//First > > > > Out[2]= > > 1.969 Second > > > > But why the tendency is opposed when the numbers are complex ? Is this a bug ? > > > > In[3]:= > > Table[Sin[I Random[]],{1000000}]//Timing//First > > Sin[Table[I Random[],{1000000}]]//Timing//First > > > > Out[3]= > > 2.484 Second > > > > Out[4]= > > 2.656 Second > > > > > > Thanks, > > > > Marcelo Mayall > > > Compare the following results: > > In[1]:= > Table[Sin[I Random[]],{1000000}]//Timing//First > Sin[Table[I Random[],{1000000}]]//Timing//First > > Out[1]= > 2.688 Second > > Out[2]= > 2.703 Second > > In[3]:= > Table[Sin[I Random[]],{1000000}]//Timing//First > Sin[Table[I Random[],{1000000}]]//Timing//First > > Out[3]= > 2.656 Second > > Out[4]= > 2.547 Second > > What do you conclude :-) Don't you you think than more than a couple of > tests would be necessary to get a statistically significant result? > > /J.M. > >