Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Vectorization

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60648] Re: Vectorization
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 23 Sep 2005 04:19:52 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, U.K.
  • References: <dgtjh4$2bk$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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.


  • Prev by Date: Re: Vectorization
  • Next by Date: Re: A Su Doku solver
  • Previous by thread: Re: Vectorization
  • Next by thread: Re: Vectorization