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: [mg78451] Re: position of matrix elements for intervals
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Mon, 2 Jul 2007 06:47:46 -0400 (EDT)

On 7/1/07 at 7:44 AM, kristophs.post at web.de (kristoph) wrote:

>Assume you have the following table:

>{{1, 1.`, 0.9999999932328848`}, {1.`, 0.9985849617864345`,
>3.7570598417296495`*^-108}, {0.9999999999267634`,
>4.0643593704937925`*^-207, 0}}

>I would like the position of all the elements >= 0.99.

In your specific example, each element is either ~0 or >.99. So,
the following works:

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

In[5]:= Most[ArrayRules@SparseArray@Chop@mat] /.
  HoldPattern[a_ -> _] :> a

Out[5]= {{1, 1}, {1, 2}, {1, 3}, {2, 1}, {2, 2}, {3, 1}}

>Or the position of all the elements of [0.4, 0.9] which in the above
>table does make a lot of sense. I'm familiar with Position[...,.] but
>since I look for reals of an interval I would kindly ask for help.

One way to find elements of a matrix on an interval using
Position would be:

In[10]:= Block[{x}, Position[mat /. _?(0.4 < # < .9 &) :> x, x]]

Out[10]= {}
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: novice needs help using Manipulate with Plot
  • Next by Date: Re: UI Question / Threading
  • Previous by thread: Re: position of matrix elements for intervals
  • Next by thread: Re: position of matrix elements for intervals