On 5/11/2010 12:19:46 PM, lpoulo wrote:
>While perusing Richard's
>recent post "Hexagonal
>Packing(4).mcd," which
>contained Stuart's vector
>support functions, I saw one
>vector function - locate (x,v)
>- that I was about to write
>for myself. Loosely described,
>the function determines the
>effective index of an
>arbitrary value x within a
>given vector v. As the test
>value x is swept thru the
>various vector values, the
>returned index should step in
>unity increments. The actual
>behavior for one simple test
>is in the attachment, and does
>not show the expected
>behavior.
>
>A second function,
>IndexOfNearest, behaves as
>expected, but is not what I
>was looking for.
>
>I created the locate2 function
>for my own needs, but it may
>be useful for others wanting a
>similar function. This new
>fct. distinguishes among test
>values equal to vector values,
>test values which fall between
>vector values, and test values
>outside the range of the
>vector. It is straightforward
>to collapse the result into
>integer index ony functions.
>
>I haven't as yet found any
>errors in the new routine, but
>test volunteers are encouraged
>to find bugs.
>
>Lou
_______________________________
Sorry Richard, I forgot to say "thanks" for the hexagonal packing.
Lou,
About that vector routine, many functionalities come out directly from Match(z, A, modifier). The function is built-in DAEP [Data Analysis Extension pack], quickly demonstrated. Often, it is necessary to have it in a more general way PWL [PieceWiseLinear] bisection. You will find two examples left in their complete accompanying full "Simplex" form. Because the "simplex" is another simple/double/triple integration method.
Example 1: ranges asymmetric 0 ...
Example 2: is symmetric [�] a ... b
Jean