MathGroup Archive 2007

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

Search the Archive

Re: position of matrix elements for intervals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78558] Re: position of matrix elements for intervals
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Wed, 4 Jul 2007 05:35:19 -0400 (EDT)
  • References: <f68491$eqh$1@smc.vnet.net>

kristoph <kristophs.p... at web.de> wrote:
> Thanks a lot, this was helpful! But it seems that I have an
> extended problem and I would kindly ask for your help.
>
> Do you have an idea how to allocate the position of the first
> element satisfying the condition of each column from below?
>
> Example:
> data = {{1, 1.`, 0.9999999932328848`},
>  {1.`, 0.9985849617864345`, 3.7570598417296495`*^-108},
>  {0.9999999999267634`, 4.0643593704937925`*^-207, 0}};
>
> I'm looking for the position from below of the first element
> in each column meeting #>=0.99.
>
> The output should be:
> {{1,3},{2,2},{3,1}}
>
> I appreciate your help very much,
> Kristoph

The symmetry in your example allows for different interpretations
of what you say. Here is code that finds the position of the last
element >= .99 in each column, and reports the indices as {col,row}.

In[1]:=
data = {{1, 1.`, 0.9999999932328848`},
 {1.`, 0.9985849617864345`, 3.7570598417296495`*^-108},
 {0.9999999999267634`, 4.0643593704937925`*^-207, 0}};

In[2]:=
MapIndexed[Flatten@{#2, 1 + Length@#1 - Position[
               Reverse@#1, x_ /; x >= .99, {1}, 1]}&, Transpose@data]
Out[2]=
{{1,3},{2,2},{3,1}}



  • Prev by Date: Re: Working with factors of triangular numbers.
  • Next by Date: Re: new behavior of Plot
  • Previous by thread: Re: position of matrix elements for intervals
  • Next by thread: Integration in a range of value