MathGroup Archive 2009

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

Search the Archive

Re: stirring chocolate pudding backwards: identifying coordinates

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101466] Re: stirring chocolate pudding backwards: identifying coordinates
  • From: Andreas <aagas at ix.netcom.com>
  • Date: Wed, 8 Jul 2009 07:09:26 -0400 (EDT)

I think I need to better illustrate my problem. Let's try this:

values = Array[v## &, {3, 3}]; 
"values =" MatrixForm[values]

The above generates: 3 time intervals in 3 dimensions.  "values" is a times series.  Time runs down the matrix.

samples = Array[s## &, {4, 3}];
"samples =" MatrixForm[samples] 

The above generates 4 sample points in 3 dimensions.  "samples" is not a time series.

Each of the numbers in each row of the "samples" matrix represents a percent as well as a coordinate.  The total of each row in "samples" always equals 1.  In the real world they could represent proportions of 3 fluids in a mixture or perhaps percentages of 3 assets in a portfolio.  

Each of the numbers in "values" represents an amount relative to some original value.  They are independent measurements and must be >=0.

The number of columns in each of the two matrices needs to correspond.  The number of rows does not. 

In its planned application, I might sample 1,000 or even 1,000,000 coordinates to better get an approximation of the weighted average of the sample space. 

Next we generate a time series (corresponding to the time increments in "values") of weighted averages of the samples where the weights stand in proportion to the measurements in each column at each interval in the time
series "values":

values.Mean[samples]

Still, so far so good (and much speeded up from my original code thanks to your values.Mean[samples]).

Now, back to my original representation of the space from which I select samples:

sampleSimplex[sampleSize_, dimensions_] := Normalize[#, Total]& /@ RandomReal[ExponentialDistribution[2], 

{sampleSize, dimensions}]

The following graphs the coordinates of the samples so you can see what the sampleSimplex[] function does:

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

Instead of trying to calculate from the entire simplex (the triangle defined by coordinates: {{1,0,0},{0,1,0},

{0,0,1}}), I sample from a finite set of points.  The entire simplex would represent all possible mixtures.

An aside, I wonder if Mathematica has a way for me to do this continuously rather than messing around with sampling?  I still have a lot to learn.

Using my original post's example:

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

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

values.Mean[samples]

{0.599181, 0.372042, 0.397434}

I want to identify the coordinates on the plane (from which I select "samples") for each of these three weighted averages.  The plane has an infinite number of points so at least one must have the same individual value as the weighted average of the sample.  More generally, this point should vary, over time, across the plane (especially as, in its projected application, I'll have values for thousands of time increments and they may have far greater variance than my simple example). Also, it seems like it wouldn't have to correspond to any specific point in the list of samples.

I hope this makes the problem clearer.

Thanks for your patience.


  • Prev by Date: Re: Re: Re: Collect exponents only
  • Next by Date: Re: Re: Jens-Peer Kuska passed away
  • Previous by thread: Re: stirring chocolate pudding backwards: identifying coordinates
  • Next by thread: Re: stirring chocolate pudding backwards: identifying coordinates