MathGroup Archive 2009

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

Search the Archive

stirring chocolate pudding backwards: identifying coordinates

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101152] stirring chocolate pudding backwards: identifying coordinates
  • From: Andreas <aagas at ix.netcom.com>
  • Date: Thu, 25 Jun 2009 07:14:12 -0400 (EDT)

Some background to start, which I'll follow with two questions:

The following function samples sets of coordinates from a multi-dimensional simplex:

    sampleSimplex[sampleSize_, dimensions_] := Normalize[#, Total](*)*)& /@ RandomReal[ExponentialDistribution[2], {sampleSize, dimensions}]

Each set of coordinates (sub-lists in the output) totals 1.  The following graphs the coordinates so you can
see what the code does:

    Graphics3D[Point /@ sampleSimplex[1000, 3, 0, 1], ImageSize -> 250, ViewPoint -> {Pi, Pi/2, 2}]

To keep things simple let's generate 4 sets of coordinates, each with 3 dimensions:

    samples = sampleSimplex[4, 3] 

    {
    {0.375153,0.412505,0.212342},
    {0.470678,0.360788,0.168533},
    {0.0510186,0.828575,0.120407},
    {0.24481,0.00851303,0.746677}
    }

Again note: each sub-list totals 1.  Also in an actual application I would take many more samples from the simplex.

Next, I generate time series data for just 3 intervals with the same dimensionality as the above:

    values = RandomReal[{.08, 1.2}, {3, 3}] 

    {
    {0.518072,0.490701,0.813364},
    {0.404083,0.356724,0.362498},
    {0.507292,0.436016,0.247148},
    }

The next function calculates a weighted average of all the sets of coordinates, with the weights in proportion to the corresponding time series values.  Note: each sub-list of values corresponds to a single time interval whereas the following function will average the values of the entire set of sub-lists in the list "samples" at each time interval.

    weightedAverage[values_, samples_] := Mean[(t = #; 1 + Inner[Times, t, # - 1, Plus] & /@ values) & /@ samples] 

    weightedAverages = weightedAverage[values, samples]

    {
    0.599181
    0.372042
    0.397434
    }

A bunch of people of this board have helped me get this far.  So far so good.  Many thanks to all of you.

Next I need to determine 2 things.  I need to identify the specific coordinates associated with: 

1. the weighted average value at each interval and 
2. the highest value at each interval.

To help clarify this (I hope), I think of the triangular surface depicted in the Graphics3D[] above and imagine a value axis extending perpendicular to it.  This represents a single time interval. I picture that the 

weightedAverage[] function calculates a value for each point on the surface hovering above the samples triangle.  It then averages them.  So one can imagine a second surface hovering above the first representing the values associated with each point of the first.  

So, again I need to identify the point associated with the highest value at each interval (this could only come 
from the highest values point from the list, "samples") and similarly the point associated with the weighted average value (this might or might not be a point within the list, "samples" because the weighted average value might fall at a point between the samples).

Not certain how to approach a solution.  From the functional programming constructs I've used so far it seems a little like stirring chocolate pudding backwards and hoping to get back to the original ingredients.       

Any help much appreciated, I hope everyone hasn't disappeared for the summer.

Thanks,
A


  • Prev by Date: Re: Re: Re: Putting an If in my function
  • Next by Date: Re: Re: Ansatz?
  • Previous by thread: TSV files as a list of list of lists?
  • Next by thread: Re: stirring chocolate pudding backwards: identifying coordinates