Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: is there a better way to iterate this?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77906] Re: is there a better way to iterate this?
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Tue, 19 Jun 2007 06:45:21 -0400 (EDT)
  • References: <f532ln$3ab$1@smc.vnet.net>

On Jun 18, 4:19 am, dan siegal-gaskins <dantimat... at gmail.com> wrote:
> ... all that's really important is that listA and listB
> are lists of 21 sublists, and each sublist has 18 elements.

I should have wrapped N around the right hand sides of a & b, and you
should have said sooner that all the sublists have the same length.
This will be faster:

c = Outer[Dot, N[#/Norm@Flatten@#]&[listA - Mean@Flatten@listA],
               N[#/Norm@Flatten@#]&[listB - Mean@Flatten@listB], 1];
bar = Table[ Total@Extract[ c, Transpose@{Range@21,
             Ordering@Table[Random[],{21}]} ], {1*^5}]

Here's one way to look at the distribution:

With[{n = Length@bar, m = Mean@bar},
ListPlot[Transpose@{Sort@bar,Range[.5,n]/n}, PlotJoined->True,
Frame->True, AxesOrigin->{m,.5}]; {m,StandardDeviation@bar}]



  • Prev by Date: Re: A question about RegionFunction in ver. 6.0
  • Next by Date: Re: Re: FFT of the piecewise step function
  • Previous by thread: Re: is there a better way to iterate this?
  • Next by thread: Re: is there a better way to iterate this?