Re: Position
- To: mathgroup at smc.vnet.net
- Subject: [mg119231] Re: Position
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Wed, 25 May 2011 19:32:34 -0400 (EDT)
- References: <irijmq$qck$1@smc.vnet.net>
On 25/05/2011 10:55, Joerg Schroeder wrote:
> Dear Group,
>
> I don't understand the following:
>
> I have a list of data and want to find the position of special elements:
>
> data=Table[CDF[BinomialDistribution[150,0.3],k],{k,0,150}]
>
> Position[data,#>=0.95&]
>
> With this I get {} (null set) as an answer, whereas for example Select gives the answer I expect.
>
> Select[data,#>=0.95&]
>
> Do I do something wrong with Position?
>
> Thanks
>
> Jorg Schroder
Position is looking for a pattern - it doesn't take a function argument
like Select.
In[11]:= Position[{0.1, 1.0, 0.8, 1.1, 3.3}, x_ /; x > 0.95]
Out[11]= {{2}, {4}, {5}}
David Bailey
http://www.dbaileyconsultancy.co.uk