MathGroup Archive 1992

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

Search the Archive

Re: timing of Table operation - a functional form

  • To: mathgroup <mathgroup at yoda.physics.unc.edu>
  • Subject: Re: timing of Table operation - a functional form
  • From: HAY at leicester.ac.uk
  • Date: Fri, 14 AUG 92 13:37:52 GMT

 
Further to Todd Gayley's reply to Jeff MacKie-Mason's enquiry

Timings with version 2.1 on a Mac IIfx

Needs["Statistics`ContinuousDistributions`"]

We start as before:

rdist = NormalDistribution[(1.1^(1/240)-1),(0.2/240)]

        NormalDistribution[0.000397205, 0.000833333]

Timing[ Short[ y = Table[Random[rdist],{240}] ] ]

       {3.73333 Second, {-0.000170285, -0.00148865, 0.000980608, <<236>>,

        0.000995661}}
        
But instead of 

Timing[ Product[(1+y[[i]]),{i,1,240}]-1 ]

       {0.583333 Second, 0.0949357}

use

Timing[ Times@@(1+y)-1 ]

       {0.35 Second, 0.0949357}
       
       
We can also write a ONE STEP FUNCTIONAL VERSION:

Timing[ 
       (Times@@(1+#)-1)&[Table[Random[rdist],{240}]] 
]
       
       {4. Second, 0.130792}

--- slightly quicker than the two step form.


Allan Hayes
Department of Mathematics
The University
Leicester LE1 7RH
U.K.
hay at leicester.ac.uk





  • Prev by Date: Re: Binary data files
  • Next by Date: Re: Hello World
  • Previous by thread: Re: Limit[FresnelC[t],t->Infinity]
  • Next by thread: Can't get RecordSeparators t